Jump to content

sun4i-drm and LCD-Panels


musicPi

Recommended Posts

Hello,

Im currently working on making lima run with an original 5"-LCD on BananaPro.
My problem is to make it work with the sun4i-drm driver.
At boot everything works fine and the display shows u-boot and kernel outputs but when the kernel starts the sun4i-drm driver the display freezes and turns white after some seconds.
dmesg says:

 

[   11.178221] sun4i-drm display-engine: bound 1e00000.display-frontend (ops 0xc09986d4)
[   11.178361] sun4i-drm display-engine: bound 1e20000.display-frontend (ops 0xc09986d4)
[   11.178858] sun4i-drm display-engine: bound 1e60000.display-backend (ops sun4i_backend_ops [sun4i_backend])
[   11.179226] sun4i-drm display-engine: bound 1e40000.display-backend (ops sun4i_backend_ops [sun4i_backend])
[   11.179943] sun4i-drm display-engine: No panel or bridge found... RGB output disabled
[   11.179970] sun4i-drm display-engine: bound 1c0c000.lcd-controller (ops 0xc09973fc)
[   11.180653] sun4i-drm display-engine: No panel or bridge found... RGB output disabled
[   11.180675] sun4i-drm display-engine: bound 1c0d000.lcd-controller (ops 0xc09973fc)
[   11.195807] sun4i-codec 1c22c00.codec: Codec <-> 1c22c00.codec mapping ok

[   11.204374] sun4i-drm display-engine: bound 1c16000.hdmi (ops sun4i_hdmi_driver_exit [sun4i_drm_hdmi])
[   11.204391] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[   11.204395] [drm] No driver support for vblank timestamp query.
[   11.204411] checking generic (7fe89000 177000) vs hw (0 ffffffff)
[   11.204422] fb0: switching to sun4i-drm-fb from simple
[   11.205292] Console: switching to colour dummy device 80x30
[   11.206140] [drm] Initialized sun4i-drm 1.0.0 20150629 for display-engine on    

 

Lima was set up properly and works with HDMI output so far.

What confuses me is the line where it says "No panel or bridge found... RGB output disabled".
The 5"LCD is connected via RGB-Interface and has already been working less than a second before.
So it seems the display has not been detected properly by the sun4i-drm module.

 

Has anyone ever had a similar Problem?
Any suggestions where to search for the problem's solution?


regards

Edited by musicPi
Link to comment
Share on other sites

Hello Werner,


Thank you for your propt reply.
The output of armbianmonitor -u has been located here: http://ix.io/2qTs

The device tree has been changed according this description (last post):

I changed the device tree to integrate the axp209 PMIC driver according to the configuration given in BananaPi's device tree and added SPDIF-Support.

So please don't mind about messages which don't appear on usual BananaPro images.

 

regards
 

Edited by musicPi
Link to comment
Share on other sites

Hello,

I got I finally working. There are some changes to be done in the device tree to make sun4i-drm and lima work with LCD-Panels on BananaPi / BananaPro.
Short version: create a panel in device tree and connect it to the correct driver.

Here's what I did:

1. Start compilation with

./compile.sh CREATE_PATCHES=yes BOARD=bananapipro INSTALL_HEADERS=yes

2. If asked to apply changes modify u-boot-config:

nano /build/cache/sources/v2020.04/configs/Bananapro_defconfig

add

#5" RGB LCD
CONFIG_VIDEO_LCD_MODE="x:800,y:480,depth:24,pclk_khz:30000,le:40,ri:40,up:29,lo:13,hs:48,vs:3,sync:3,vmode:0"
CONFIG_VIDEO_LCD_POWER="PH12"
CONFIG_VIDEO_LCD_BL_EN="PH8"
CONFIG_VIDEO_LCD_BL_PWM="PB2"

3. modify sun7i-a20 device tree

nano build/cache/sources/v2020.04/arch/arm/dts/sun7i-a20.dtsi

add the tcon0_out_lcd section to tcon0:

tcon0: lcd-controller@1c0c000 {
            //.....
            
            ports {
                //.....

                tcon0_out: port@1 {
                    #address-cells = <1>;
                    #size-cells = <0>;
                    reg = <1>;
                    tcon0_out_lcd: endpoint@0 {
                        reg = <0>;
                        remote-endpoint = <&lcd_in_tcon0>;
                    };
                    tcon0_out_hdmi: endpoint@1 {
                        reg = <1>;
                        remote-endpoint = <&hdmi_in_tcon0>;
                    };
                };
            };
        };

I don't know if it works for tcon1 too but feel free to try. Then add the same lines to tcon1 and replace each "tcon0" with "tcon1".
Then add a panel section:

panel: panel {
            #address-cells = <1>;
            #size-cells = <0>;
            port {
                #address-cells = <1>;
                #size-cells = <0>;
                lcd_in_tcon0: endpoint {
                    remote-endpoint = <&tcon0_out_lcd>;
                };
            };
        };

If you also want to use tcon1 add lcd_in_tcon1 section .

My Lemaker 5"LCD-Display uses RGB-Mode so this has to be added to pio section

		pio: pinctrl@1c20800 {
			compatible = "allwinner,sun7i-a20-pinctrl";
              
            //.....
              
			lcd0_rgb888_pins: lcd0-rgb888 {
				pins = "PD0", "PD1", "PD2", "PD3",
				       "PD4", "PD5", "PD6", "PD7",
				       "PD8", "PD9", "PD10", "PD11",
				       "PD12", "PD13", "PD14", "PD15",
				       "PD16", "PD17", "PD18", "PD19",
				       "PD20", "PD21", "PD22", "PD23",
				       "PD24", "PD25", "PD26", "PD27";
				function = "lcd0";
			};
              
           	//.....
              
		};

4. modify bananapro device tree

nano build/cache/sources/v2020.04/arch/arm/dts/sun7i-a20-bananapro.dts

Add backlight and power management for the panel

#include <dt-bindings/pwm/pwm.h>

/ {
    model = "LeMaker Banana Pro";
    compatible = "lemaker,bananapro", "allwinner,sun7i-a20";

    //.....

    backlight: backlight {
            compatible = "pwm-backlight";
            pwms = <&pwm 0 50000 0>;
            brightness-levels = <  0   1   1   1   1   2   2   2
                                   2   3   3   3   3   4   4   4
                                   5   5   5   6   6   6   7   7
                                   8   8   8   9   9   9  10  10
                                  10  11  11  12  12  12  13  13
                                  14  14  14  15  15  16  16  17
                                  17  17  18  18  19  19  20  20
                                  21  21  21  22  22  23  23  24
                                  24  25  25  26  26  27  27  28
                                  28  29  30  30  31  31  32  32
                                  33  33  34  35  35  36  36  37
                                  38  38  39  39  40  41  41  42
                                  43  43  44  44  45  46  47  47
                                  48  49  49  50  51  51  52  53
                                  54  54  55  56  57  57  58  59
                                  60  61  61  62  63  64  65  65
                                  66  67  68  69  70  71  71  72
                                  73  74  75  76  77  78  79  80
                                  81  82  83  84  85  86  87  88
                                  89  90  91  92  93  94  95  96
                                  97  98  99 101 102 103 104 105
                                 106 108 109 110 111 112 114 115
                                 116 117 119 120 121 123 124 125
                                 127 128 129 131 132 133 135 136
                                 138 139 141 142 144 145 147 148
                                 150 151 153 154 156 157 159 161
                                 162 164 166 167 169 171 173 174
                                 176 178 180 181 183 185 187 189
                                 191 192 194 196 198 200 202 204
                                 206 208 210 212 214 216 219 221
                                 223 225 227 229 232 234 236 238
                                 241 242 244 246 248 250 253 255>;
            default-brightness-level = <128>;
            enable-gpios = <&pio 7 8 GPIO_ACTIVE_HIGH>; /* PH8 */
    };

    panel_power: panel_power {
            compatible = "regulator-fixed";
            regulator-name = "panel-power";
            regulator-min-microvolt = <10400000>;
            regulator-max-microvolt = <10400000>;
            gpio = <&pio 7 12 GPIO_ACTIVE_HIGH>; /* PH12 */
            enable-active-high;
            regulator-boot-on;
    };
};

Configure tcon to use our panel and enable display engine

&de {
	status = "okay";
};

&tcon0 {
    pinctrl-names = "default";
    pinctrl-0 = <&lcd0_rgb888_pins>;
    status = "okay";
};

&panel {
    compatible = "lemaker,bl050-rgb-002";
    power-supply = <&panel_power>;
    backlight = <&backlight>;
};

Add touch driver for edt-ft5x06:

&i2c3 {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&i2c3_pins>;
    edt: edt-ft5x06@38 {
        compatible = "edt,edt-ft5x06", "edt,edt-ft5306";
        reg = <0x38>;
        interrupt-parent = <&pio>;
        interrupts = <7 9 IRQ_TYPE_EDGE_FALLING>;
//      wake-gpios = <7 7 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&edt_ft5x06_pins_a &edt_ft5x06_pins_b>;
        touchscreen-size-x = <800>;
        touchscreen-size-y = <480>;
        //touchscreen-inverted-x;
        //touchscreen-inverted-y;
        //touchscreen-swapped-x-y;
    };
}; 

Add edt_ft5x06 and backlight pins:

&pio {
        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;
        };
};

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

Hit <Enter>

 

If asked the nexttime to press enter:

 

5. Make sure your panel driver available in kernel drivers. Mine was not. So I had to add it to the simple panel driver which already contains the Lemeker 3,5"LCD-Display.

 

nano build/cache/sources/linux-mainline/orange-pi-5.4/drivers/gpu/drm/panel/panel-simple.c

add this right after lemaker_bl035_rgb_002

static const struct panel_desc lemaker_bl050_rgb_002 = {
    .modes = &lemaker_bl050_rgb_002_mode,
    .num_modes = 1,
    .size = {
        .width = 108,
        .height = 64,
    },
    .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
    .bus_flags = DRM_BUS_FLAG_DE_HIGH,
};

static const struct drm_display_mode lg_lb070wv8_mode = {
    .clock = 33246,
    .hdisplay = 800,
    .hsync_start = 800 + 88,
    .hsync_end = 800 + 88 + 80,
    .htotal = 800 + 88 + 80 + 88,
    .vdisplay = 480,
    .vsync_start = 480 + 10,
    .vsync_end = 480 + 10 + 25,
    .vtotal = 480 + 10 + 25 + 10,
    .vrefresh = 60,
};

and this right after lemaker,bl035-rgb-002

static const struct of_device_id platform_of_match[] = {
	{
//.....
    }, {
    .compatible = "lemaker,bl050-rgb-002",
    .data = &lemaker_bl050_rgb_002,
    }, {
//.....
	}
}

Do steps 3 and 4 to

build/cache/sources/linux-mainline/orange-pi-5.4/arch/arm/boot/dts/sun7i-a20.dtsi

and

build/cache/sources/linux-mainline/orange-pi-5.4/arch/arm/boot/dts/sun7i-a20-bananapro.dts

and hit <Enter> and proceed build

 

 

Have a look at this page for other display configurations:

http://linux-sunxi.org/LCD#Mainline_Linux_.28simple-panel.29

 

Thanks a lot to sgei and his tutorial!

Many thanks to authors of another hunderd websites which also helped but I can't even list.

Please let me know if this works for BananaPi too.

Edited by musicPi
Link to comment
Share on other sites

Hi. Thank you musicPi for your guide.
I have A40 based board with 5" RGB display and I'm trying to make it Workstation under mainline kernel.
But I figure out that A40 incompatible with option VIDEO_SUNXI in u-boot (according to https://github.com/u-boot/u-boot/blob/master/arch/arm/mach-sunxi/Kconfig#L817 ), so I can not reproduce 2nd step.
Is it possible to bring up RGB display without u-boot?

Link to comment
Share on other sites

Hi,

I have lamobo-r1(A20) with pinout same as bananapi pro and i have LCD display 7" (more info here: https://forum.banana-pi.org/t/lcd-module-dsi-rgb-with-touch-and-s070swv20hg-dc16-lcd-panel-mainline-kernel/11172 ) and i cannot make it work with armbian. The main difference between your display and my is backlight enabler(CONFIG_VIDEO_LCD_BL_EN) which on mine is PH9. I made it work with u-boot but i can't force it to work with linux (you can see it in the link above). Do you have any hints where i can search for help(or even simple hints) that would help me to run it under linux?
I've tried to follow your tutorial and i even tried to change pins according to those i have in u-boot configuration(which are working) and nothing - i loosing hope :) so any help will be appreciated.

Link to comment
Share on other sites

Hi s3b0,
Did you replace every occurance of "PH9" properly:

 

For LCD panel:

build/cache/sources/v2020.04/configs/<YOUR_BOARD>_defconfig
    CONFIG_VIDEO_LCD_BL_EN="PH8" ->     CONFIG_VIDEO_LCD_BL_EN="PH9"

build/cache/sources/v2020.04/arch/arm/dts/sun7i-a20-<YOUR_BOARD>.dts
    enable-gpios = <&pio 7 8 GPIO_ACTIVE_HIGH>; -> enable-gpios = <&pio 7 9 GPIO_ACTIVE_HIGH>;

 

For touch panel:

build/cache/sources/linux-mainline/orange-pi-5.4/arch/arm/boot/dts/sun7i-a20-<YOUR_BOARD>.dts

    interrupts = <7 9 IRQ_TYPE_EDGE_FALLING>; -> interrupts = <7 ####interupt pin#### IRQ_TYPE_EDGE_FALLING>;
    
    edt_ft5x06_pins_a: ft5@0 { // interrupt ->     edt_ft5x06_pins_a: ft5@0 { // interrupt
                pins               = "PH9";                pins               = "PH9";
                function           = "irq";                   function           = "irq";
                drive-strength     = <20>;            drive-strength     = <20>;
                bias-pull-up;                        bias-pull-up;
        };                        };
        
Add changes to:
build/cache/sources/v2020.04/arch/arm/dts/sun7i-a20-<YOUR_BOARD>.dts
build/cache/sources/linux-mainline/orange-pi-5.4/arch/arm/boot/dts/sun7i-a20.dtsi

 

Link to comment
Share on other sites

21 hours ago, musicPi said:

For LCD panel:

build/cache/sources/v2020.04/configs/<YOUR_BOARD>_defconfig
    CONFIG_VIDEO_LCD_BL_EN="PH8" ->     CONFIG_VIDEO_LCD_BL_EN="PH9"

Changed - u-boot working fine

 

Quote

build/cache/sources/v2020.04/arch/arm/dts/sun7i-a20-<YOUR_BOARD>.dts
    enable-gpios = <&pio 7 8 GPIO_ACTIVE_HIGH>; -> enable-gpios = <&pio 7 9 GPIO_ACTIVE_HIGH>;

Changed - backlight works

 

Quote

For touch panel:

build/cache/sources/linux-mainline/orange-pi-5.4/arch/arm/boot/dts/sun7i-a20-<YOUR_BOARD>.dts

    interrupts = <7 9 IRQ_TYPE_EDGE_FALLING>; -> interrupts = <7 ####interupt pin#### IRQ_TYPE_EDGE_FALLING>;
    
    edt_ft5x06_pins_a: ft5@0 { // interrupt ->     edt_ft5x06_pins_a: ft5@0 { // interrupt
                pins               = "PH9";                pins               = "PH9";
                function           = "irq";                   function           = "irq";
                drive-strength     = <20>;            drive-strength     = <20>;
                bias-pull-up;                        bias-pull-up;
        };                        };
        
Add changes to:
build/cache/sources/v2020.04/arch/arm/dts/sun7i-a20-<YOUR_BOARD>.dts
build/cache/sources/linux-mainline/orange-pi-5.4/arch/arm/boot/dts/sun7i-a20.dtsi

I have problem with this - on our boards there are 4 IO GPIO PINS for LCD PH7,PH8,PH9,PH12(i think so, according to pin definitions that can be found here:https://web.archive.org/web/20210906165454/http://wiki.lemaker.org/BananaPro/Pi:Pin_definition#Banana_Pi_CON2_definition)  I've tried to change touch pane definition and I've put there PH8 but result are the same as during my previous tries:

 

Uboot shows loading kernel and when kerenl takes controls i goes like above.

Link to comment
Share on other sites

Looks like kernels's display driver is not working properly.


Your Board is identical with BananaPi R1. So try to use device trees and configurations accordingly, if they exist.

 

From the schematics of BPi-R1 can be seen that the display is driven by constant 3v3.

The "panel_power" device ist linked to PH12 which is connected to the wifi module's power down pin on your board.

From that Wifi driver and display driver wont wirk properly.

So try to remove all occurences of "panel_power"(sections and calls) from device tree and from build/cache/sources/v2020.04/configs/<YOUR_BOARD>_defconfig
Have a look at the schematics:


For BananaPi:

https://linux-sunxi.org/images/9/9d/A20_Bananapi_Schematic.pdf

For BananaPi
R1:
https://linux-sunxi.org/images/2/20/Banan_pi_BPI-R1_MP_Schematic-SD_V3-20140922.pdf

 

 

Link to comment
Share on other sites

I removed panel_power from dts(u-boot and linux) and CONFIG_VIDEO_LCD_POWER="PH12" u-boot defconfig for Lamobo-R1 and you have right, power is fixed according to schematics but panel is still death after u-boot loads kernel :((same behavior as you have seen on my youtube video). Still clueless :( - it must be linux driver but i don't have knowledge to fix it (i know c but don't know anything about linux panel drivers development)

Some time ago i talked with owner of this repo https://github.com/wens/dt-overlays/ and he gave me this overlay https://github.com/wens/dt-overlays/blob/master/bpi-m1p-lcd.dts - maybe it will work with your hint implemented (removing of PH12 as panel_power)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines