Olimex Support Forum

OLinuXino Android / Linux boards and System On Modules => A20 => Topic started by: PaddleStroke on May 02, 2019, 03:52:15 PM

Title: How to interface other LCD while using mainline kernel
Post by: PaddleStroke on May 02, 2019, 03:52:15 PM
Hi there,

I am trying to setup a RGB24 LCD with a different form factor (a 3.5") to a lime2 board, but without success so far. Try to make it work on armbian mainline.

Hardware connection is done correctly, including backlight power connected to the PWM.
Only missing bit that I could not connect to my LCD is the LCD_POWER enable pin. But as this is an output pin from the SoC, not having it should only prevent turning off the LCD.

Tried to follow this tutorial https://forum.armbian.com/topic/1905-enabling-lcd-in-u-boot-kernel-472/page/2/?fbclid=IwAR1xRXhlx_auRAODnmC0Q-3rVpUZf_AytaIK1abzdPHDki86c0h20XMYAQ8 (https://forum.armbian.com/topic/1905-enabling-lcd-in-u-boot-kernel-472/page/2/?fbclid=IwAR1xRXhlx_auRAODnmC0Q-3rVpUZf_AytaIK1abzdPHDki86c0h20XMYAQ8)
without luck, seems the LCD is not recognized at all.

Any hint would be appreciated
Title: Re: How to interface other LCD while using mainline kernel
Post by: Jonathan Fether on July 16, 2019, 11:19:53 PM
Hello PaddleStroke,

   I encountered this issue before and wanted to share my solution. It may or may not be correct.

   It is difficult to get the Mainline Linux to initialize the LCD without it having been previously initialized by the U-Boot, so this was the path we took. You'll have to customize the configuration to the particular panel and pins you are using. The A20 user manual from linux-sunxi.org is very helpful. We also did a device tree overlay to enable the backlight control, this will also need to be customized:

U-Boot config patch (Used with the Armbian build system)
--- a/configs/A20-Olimex-SOM204-EVB-eMMC_defconfig
+++ b/configs/A20-Olimex-SOM204-EVB-eMMC_defconfig
@@ -8,6 +8,16 @@
CONFIG_USB0_VBUS_PIN="PC17"
CONFIG_USB0_VBUS_DET="PH5"
CONFIG_I2C1_ENABLE=y
+CONFIG_VIDEO_SUNXI=y
+CONFIG_VIDEO_LCD_MODE="x:800,y:480,depth:24,pclk_khz:40000,hs:1,vs:1,le:46,ri:210,up:23,lo:22,sync:0,vmode:0"
+CONFIG_VIDEO_LCD_DCLK_PHASE=1
+CONFIG_VIDEO_LCD_POWER="PC24"
+CONFIG_VIDEO_LCD_RESET=""
+CONFIG_VIDEO_LCD_BL_EN=""
+CONFIG_VIDEO_LCD_BL_PWM="PB2"
+CONFIG_VIDEO_LCD_BL_PWM_ACTIVE_LOW=y
+CONFIG_VIDEO_LCD_IF_PARALLEL=y
+CONFIG_VIDEO_LCD_PANEL_PARALLEL=y
CONFIG_SATAPWR="PC3"
CONFIG_GMAC_TX_DELAY=4
CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-olimex-som204-evb-emmc"


Device tree overlay (Used with armbian-add-overlay)
/dts-v1/;
/plugin/;

/ {
        compatible = "allwinner,sun7i-a20";

        fragment@0 {
                target-path = "/";
                __overlay__ {
                        backlight: backlight {
                                compatible = "pwm-backlight";
                                power-supply = <&reg_vcc5v0>;
                                pwms = <&pwm 0 8000000 0>;
                                brightness-levels = <0 10 20 30 40 50 60 70 80 90 100>;
                                default-brightness-level = <5>;
                                status = "okay";
                        };
                };
        };
};