1 1
sgei

BananaPi Pro 7" TouchLCD with Debian Stretch and Mainline-Kernel 4.XX.XX

Recommended Posts

Hi everybody,

 

Here is a tutorial to enable the Lemaker 7" Touchscreen on BananaPi Pro with Debian Stretch and Mainline-Kernel 4.XX.XX.

 

Kernel: Mainline 4.17.13 / Stretch
Board: BananaPi Pro

 

WebLinks:

    • https://forum.armbian.com/topic/1905-enabling-lcd-in-u-boot-kernel-472/
    • https://forum.armbian.com/topic/1849-touch-driver-banana-pi/
    • http://www.atakansarioglu.com/getting-started-bananapi-linux/
    • http://forum.lemaker.org/thread-15482-1-1.html
    • http://linux-sunxi.org/LCD

 

To make the 7"LCD and the Touchscreen working with BananaPi Pro we need to patch some files and change the kernel config to build the driver for the touchscreen.
To do this we need a working setup of the Armbian build tool chain (https://docs.armbian.com/Developer-Guide_Build-Preparation/)

 

/home/<USER>/build/cache/sources/u-boot/v201X.XX/configs/Bananapro_defconfig
/home/<USER>/build/cache/sources/u-boot/v201X.XX/arch/arm/dts/sun7i-a20-bananapro.dts
/home/<USER>/build/cache/sources/linux-mainline/linux-4.XX.y/arch/arm/boot/dts/sun7i-a20-bananapro.dts

 

1. U-Boot ( u-boot version that supports the LCD - must be compiled)

 

Start the build process with ./compile.sh CREATE_PATCHES=yes

 

When asked for:
[ warn ] Applying existing u-boot patch [ /home/armbian/build/output/patch/u-boot-sunxi-next.patch ]
[ warn ] Make your changes in this directory: [ /home/armbian/build/cache/sources/u-boot/v201X.XX ]
[ warn ] Press <Enter> after you are done [ waiting ]

 

a) edit /home/<USER>/build/cache/sources/u-boot/v201X.XX/configs/Bananapro_defconfig

 

add the following:

#7" LVDS LCD
CONFIG_VIDEO_LCD_MODE="x:1024,y:600,depth:24,pclk_khz:55000,le:100,ri:170,up:10,lo:15,hs:50,vs:10,sync:3,vmode:0"
CONFIG_VIDEO_LCD_PANEL_LVDS=y
CONFIG_VIDEO_LCD_POWER="PH12"
CONFIG_VIDEO_LCD_BL_EN="PH8"
CONFIG_VIDEO_LCD_BL_PWM="PB2"

 

b) edit /home/<user>/build/cache/sources/u-boot/v201X.XX/arch/arm/dts/sun7i-a20-bananapro.dts

 

LCD:

 

add after:

 

&pio {
    ...
};

 

the following:

 

&pwm {
      pinctrl-names = "default";
      pinctrl-0 = <&pwm0_pins_a>, <&pwm1_pins_a>;
      status = "okay";
};


Touchdriver:

 

add after:

 

&i2c2 {
    pinctrl-names = "default";
    pinctrl-0 = <&i2c2_pins_a>;
    status = "okay";
};

 

the following:

 

&i2c3 {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&i2c3_pins_a>;
    edt: edt-ft5x06@38 {
        compatible = "edt,edt-ft5x06", "edt,edt-ft5206";
        reg = <0x38>;
        pinctrl-names = "default";
        pinctrl-0 = <&edt_ft5x06_pins_a &edt_ft5x06_pins_b>;
        interrupt-parent = <&pio>;
        interrupts = <7 9 IRQ_TYPE_EDGE_FALLING>;
        touchscreen-size-x = <1024>;
        touchscreen-size-y = <600>;
    };
};

 

add after:

 

&pio {
    gmac_power_pin_bananapro: gmac_power_pin@0 {
        allwinner,pins = "PH23";
        allwinner,function = "gpio_out";
        allwinner,drive = <SUN4I_PINCTRL_10_MA>;
        allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
    };

    led_pins_bananapro: led_pins@0 {
        allwinner,pins = "PH24", "PG2";
        allwinner,function = "gpio_out";
        allwinner,drive = <SUN4I_PINCTRL_10_MA>;
        allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
    };

 

the following:

 

    edt_ft5x06_pins_a: ft5@0 { // interrupt
        pins = "PH9";
        function = "irq";
        drive-strength = <20>;
        bias-pull-up;
    };
    edt_ft5x06_pins_b: ft5@1 { // reset-gpios
        pins = "PH7";
        function = "gpio_out";
        drive-strength = <20>;
        bias-pull-up;
        output-high;
    };

 

Then save and press <Enter> to continue.

 

2. Kernel patches - DTB (Device Tree Blob) file that fits to your Kernel and supports pwm

 

When asked for:
[ warn ] Applying existing kernel patch [ /home/<USER>/build/output/patch/kernel-sunxi-next.patch ]
[ warn ] Make your changes in this directory: [ /home/<USER>/build/cache/sources/linux-mainline/linux-4.XX.y ]
[ warn ] Press <Enter> after you are done [ waiting ]

 

c) edit /home/<USER>/build/cache/sources/linux-mainline/linux-4.XX.y/arch/arm/boot/dts/sun7i-a20-bananapro.dts

 

add the same lines like section b)

 

Then save and press <Enter> to continue.

 

3. Compile Touchdriver

 

menuconfig > Device Drivers > Input Device Support > Touchscreens > EDT FocalTech FT5x06 I2C Touchscreen support

 

grafik.png.75a03d1a3b2332b9aaf10e31edfb6198.png

 

Exit and save the Kernel configuration.

 

This is the outcome. You probably have a newer version than 5.41.

 

grafik.thumb.png.64a61be5574e2a9ca2936741a268e41c.png

 

grafik.png.b60b3f2a8c0e0d5ce8ed8cc21e4d2cf2.png


Now we have to install the new DEBs.

 

dpkg -i linux-u-boot-next-bananapipro_5.41_armhf.deb
dpkg -i linux-dtb-next-bananapipro_5.41_armhf.deb
dpkg -i linux-image-next-bananapipro_5.41_armhf.deb


(dpkg -i linux-source-next-bananapipro_5.41_armhf.deb
dpkg -i linux-headers-next-bananapipro_5.41_armhf.deb)

 

reboot

 

The result:

 

The LCD and the touchscreen are working. :D

 

Attention!
Kernel version 4.14.XX still had problems with the shutdown.
When the patches were made for the LCD, the board did not shut down completely during a shutdown (LCD still had voltage and the red LED on the board did not go out).

With the kernel 4.17.XX (4.17.13) the problem is solved.

Furthermore, with this kernel version the kworker problem (kworker needs 10% CPU) is solved.

 

4. Control the Power of the Backlight:

 

The backlight PWM is on PIN CON2 PB2.

 

Following the instructions on

http://linux-sunxi.org/GPIO#Accessing_the_GPIO_pins_through_sysfs_with_mainline_kernel

http://forum.lemaker.org/thread-10852-1-1.html

we have to export GPIO-PIN 34.

 

(position of letter in alphabet - 1) * 32 + pin number

position of letter in alphabet: B = 2
pin number: 2

 

( 2 - 1 ) * 32 + 2 = 34

 

echo 34 > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio34/direction

 

Power on the Backlight:
echo "1" > /sys/class/gpio/gpio34/value

 

Power off the Backlight:
echo "0" > /sys/class/gpio/gpio34/value

 

Now we could use a switch connected to a GPIO-IN to control the backlight.

 

Steffen

Share this post


Link to post
Share on other sites
1 1