A13 LCD Timings

Started by dkibble, January 04, 2021, 11:58:05 am

Previous topic - Next topic

dkibble

I've just moved a project from the original A13 debian image using FEX etc to the latest Ubuntu image which great by the way! I've not had too many issues and have got most things working fine (USB, PWM etc). However, the LCD is proving a bit more challenging, having done a lot of reading I have managed to get the stock A13 Ubuntu image to work by adding

video=Unknown-1:480x800MR-32 fbcon=rotate:1 vt.global_cursor_default=0

to the uEnvt.txt. Our hardware is pin compatible with the Olimex 4.3TS LCD, but is a higher resolution panel (480x800). Using the above method the LCD displays an image, but the timings look off as there are bands visible, especially in colour gradients. These are not there when using the original debian + FEX image so I know this isn't a hardware issue.

So having read around, I'm confused as to the correct course of action. I have rebuild uBoot with the correct video config:

#define CONFIG_VIDEO_LCD_MODE "x:480,y:800,depth:18,pclk_khz:30000,le:46,ri:74,up:22,lo:22,hs:1,vs:1,sync:3,vmode:0"

but that only seems to work for the duration of the uBoot phase, once the kernel is loaded the timings revert. I assume this is because the dto is referencing the olimex 4.3 lcd.... I've looked at the dto's and have tried to set panel timings in my own overlay, but with no success. I note however that there are timings hardcoded into the uBoot lcd_olinuxino.c which I'm guessing are taking priority over what I put in the dts?

So my question is what is the correct way to achieve an override of LCD panel params for a display which is pin compatible with the Olimex 4.3TS LCD? Should I add my panel and timings to the lcd_olinuxino.c, rebuild uBoot and reference it from my own dts? Other boards have all LCD params in dts files, is that a better approach? The first option seems counter to the purpose of the device tree, but would appreciate some guidance. I'm more than happy to research exactly how to do things, but I'm after thoughts on the correct path to take please.

Thanks

LubOlimex

Technical support and documentation manager at Olimex

dkibble

Thanks for the response and yes, I've looked at those dto's already. I've created my own dto as follows:

/dts-v1/;

/ {
        compatible = "allwinner,sun5i-a13";
        description = "LCD 480x800 panel with resistive TS and analog interface";

        fragment@0 {
                target-path = "/panel";

                __overlay__ {
                        compatible = "DK-Touch";
                };
        };
};

and I modified lcd_olinuxino.c with the addition of:

                .id = 9999,
                .compatible = "DK-Touch",
                {
                        .name = "LCD-480x800-TS",
                        .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
                },
                {
                        .pixelclock = 30000,
                        .hactive = 480,
                        .hfp = 8,
                        .hbp = 46,
                        .hpw = 5,
                        .vactive = 800,
                        .vfp = 4,
                        .vbp = 23,
                        .vpw = 5,
                        .refresh = 60,
                        .flags = 0
                }
into the array of defined lcd boards and rebuilding u-boot. Loading that overlay and using the correct timing in the u-boot config gives a fully working result.

BUT - is this the right way to tackle the problem? Would it not be better to have a dto that defined all the LCD parameters without having to modify u-boot? Adding timings to the dts have no effect so I'm guessing there's code missing from u-boot to make that work? I've seen the BeagleBone guys do this, but currently lack the expertise to do it myself for the Olimex boards. I would really just like to know why things aren't done that way in the Olimex world and if anyone thinks this is a worthwhile endeavor?

Thanks