LCD doesn't work with hlcdc driver on custom sama5d3 board

This forum is for users of Microchip MPUs and who are interested in using Linux OS.

Moderator: nferre

paguilar
Posts: 2
Joined: Sun Jan 10, 2016 4:39 pm

LCD doesn't work with hlcdc driver on custom sama5d3 board

Sun Jan 10, 2016 6:37 pm

Hi,
I'm working on a custom board based on the sama5d3_ek. I have an LCD (T430T01W01A from Cristal Clear Technology) that is compatible with the Innolux at043tn24 that should work out-of-the-box when using the sama5d34ek_pda4.dts device tree files and the panel_simple driver.

I've got at91bootstrap and uboot from the evaluation kit and they work as expected. I see in the LCD the Atmel logo with some info, this means that electrically the board and the LCD work fine.

Then I built the kernel 4.1 downloaded from the official github repo. I used the Linaro toolchain (gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabi), configured the kernel with sama5_defconfig and built the device tree blob based on the sama5d34ek_pda4 sources.

Initially, I built all the related LCD modules (pwm_atmel_hlcdc, backlight, pwm_bl, panel_simple and atmel_hlcdc_dc) inside the kernel and I had the following errors while booting (with some debug info that I added):

Code: Select all

...
[drm] Initialized drm 1.1.0 20060810
of_find_backlight_by_node(): class_find_device() failed ----->
brd: module loaded
loop: module loaded
ssc f0008000.ssc: Atmel SSC device at 0xd0880000 (irq 27)
at24 1-0050: 32768 byte 24c256 EEPROM, writable, 64 bytes/write
[drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[drm] No driver support for vblank timestamp query.
atmel-hlcdc-display-controller atmel-hlcdc-dc: failed to create panel: -517
atmel-hlcdc-display-controller atmel-hlcdc-dc: failed to initialize mode setting
...
backlight_device_register: name=backlight
[drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[drm] No driver support for vblank timestamp query.
atmel-hlcdc-display-controller atmel-hlcdc-dc: DRM device successfully registered
at91_rtc fffffeb0.rtc: setting system clock to 2015-06-06 20:07:14 UTC (1433621234)
atmel-hlcdc-display-controller atmel-hlcdc-dc: fb0:  frame buffer device
atmel-hlcdc-display-controller atmel-hlcdc-dc: registered panic notifier
...
While displaying the above booting messages, the LCD seemed to be turned-off (the Atmel logo from uboot goes away) and not even the backlight is on.

After searching around the code it seemed to me that the backlight module didn't find the device that the device tree specified. Infact, the func of_find_backlight_by_node() was failing.
I tried several user space programs (fb-set-rect and Qt5 examples built with buildroot) but the LCD seemed dead. All the entries in sysfs, such as /sys/class/backlight were present, but didn't work. For example, I tried to power on/off the backlight

Code: Select all

echo 1 > /sys/class/backlight/backlight/bl_power
echo 0 > /sys/class/backlight/backlight/bl_power
but it didn't work. The same with the brightness.

Then, I compiled the modules out of the kernel and modprobe'd manually after booting:

Code: Select all

# modprobe pwm_atmel_hlcdc
# modprobe backlight
# modprobe pwm_bl
backlight_device_register: name=backlight
# modprobe panel_simple
# modprobe atmel_hlcdc_dc
[drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[drm] No driver support for vblank timestamp query.
atmel-hlcdc-display-controller atmel-hlcdc-dc: DRM device successfully registered
atmel-hlcdc-display-controller atmel-hlcdc-dc: fb0:  frame buffer device
atmel-hlcdc-display-controller atmel-hlcdc-dc: registered panic notifier
#
The result when modprobing pwm_bl is the same as before, the LCD seems to be turned-off.

This LCD is compatible with the Innolux LCD according to the supplier, and the datasheets seem equivalent. But if I'm missing something, which panel, backlight or pwm parameters in the device tree or in the panel_simple sources could cause this behaviour?
Something related to the voltage in the backlight or panel regulators?

Do you have any other idea/hint of what could cause this issue?

Thanks!
blue_z
Location: USA
Posts: 1943
Joined: Thu Apr 19, 2007 10:15 pm

Re: LCD doesn't work with hlcdc driver on custom sama5d3 boa

Mon Jan 11, 2016 10:00 pm

paguilar wrote:Then I built the kernel 4.1 downloaded from the official github repo.
Presumably you mean the Linux4SAM github, rather than mainline?
paguilar wrote:While displaying the above booting messages, the LCD seemed to be turned-off (the Atmel logo from uboot goes away) ...
That's not significant.
You should expect the U-Boot screen to disappear when Linux boots unless you configure U-Boot and Linux kernel to use the same display memory.
paguilar wrote:... and not even the backlight is on.
You are not clear on how you have determined that the backlight is not on.
If you're just looking at the LCD screen, then you have a chicken versus egg dilemma:
You cannot begin to tell if the backlight is on unless you've (successfully) written an image to the LCD (i.e. the default/quiescent state is black).
You cannot tell if you have successfully written an image to the LCD screen unless the backlight is on.
paguilar wrote:I tried several user space programs (fb-set-rect and Qt5 examples built with buildroot) but the LCD seemed dead.
What is fb-set-rect?
Do you mean the fb-test programs, which use /dev/fb0 (rather than the required libdrm)?
Do the Qt5 examples use libdrm?

Seems like you have not read (but need to study) the salient Linux4SAM web page: How to use the Atmel KMS/DRM LCD driver
With proper runtime kernel setup (i.e. fbdev emulation), you can use /dev/fb0 and the DRM driver.
At the very least use the modetest utility to display a color-bar test pattern.

Regards
User avatar
koan
Contact:
Location: Bergamo, Italia
Posts: 212
Joined: Wed May 12, 2004 6:59 pm

Re: LCD doesn't work with hlcdc driver on custom sama5d3 boa

Thu Jan 21, 2016 5:32 pm

More or less same problem here using linux 4.1.0-linux4sam_5.0 from Atmel.
Still debugging...
Marco Cavallini
Koan s.a.s. - Bergamo - ITALIA
Embedded and Real-Time Software Engineering
- Atmel Third Party Consultant
Tel. +39-(0)35-255.235 - Fax +39-178-223.9748
http://www.KoanSoftware.com | http://www.KaeilOS.com
User avatar
koan
Contact:
Location: Bergamo, Italia
Posts: 212
Joined: Wed May 12, 2004 6:59 pm

Re: LCD doesn't work with hlcdc driver on custom sama5d3 boa

Thu Feb 04, 2016 2:03 pm

Everything works fine here, (of course) ;-)

Please check powers and Device Tree settings.
In case you still have problems, please post your .dts
Marco Cavallini
Koan s.a.s. - Bergamo - ITALIA
Embedded and Real-Time Software Engineering
- Atmel Third Party Consultant
Tel. +39-(0)35-255.235 - Fax +39-178-223.9748
http://www.KoanSoftware.com | http://www.KaeilOS.com
paguilar
Posts: 2
Joined: Sun Jan 10, 2016 4:39 pm

Re: LCD doesn't work with hlcdc driver on custom sama5d3 boa

Mon Feb 29, 2016 5:10 pm

Hi,

Sorry for the very late reply. Everything was solved a couple of days after the first post. Thanks for your input!
The backlight worked properly directly with the framebuffer and with Qt5 with 'linuxfb' as backend.

We modified the driver:

Code: Select all

diff --git a/drivers/pwm/pwm-atmel-hlcdc.c b/drivers/pwm/pwm-atmel-hlcdc.c
index f994c7e..97abd3e 100644
--- a/drivers/pwm/pwm-atmel-hlcdc.c
+++ b/drivers/pwm/pwm-atmel-hlcdc.c
@@ -67,11 +67,13 @@ static int atmel_hlcdc_pwm_config(struct pwm_chip *c,
        if (!clk_freq)
            return -EINVAL;
 
-       clk_period_ns = (u64)NSEC_PER_SEC * 256;
+        /*clk_period_ns = (u64)NSEC_PER_SEC * 256;*/
+       clk_period_ns = (u64)NSEC_PER_SEC * 128;
        do_div(clk_period_ns, clk_freq);
    }   
 
    /* Errata: cannot use slow clk on some IP revisions */
+#if 0
    if ((chip->errata && chip->errata->slow_clk_erratum) ||
        clk_period_ns > period_ns) {
        new_clk = hlcdc->sys_clk;
@@ -82,6 +84,7 @@ static int atmel_hlcdc_pwm_config(struct pwm_chip *c,
        clk_period_ns = (u64)NSEC_PER_SEC * 256;
        do_div(clk_period_ns, clk_freq);
    }   
+#endif
 
    for (pres = 0; pres <= ATMEL_HLCDC_PWMPS_MAX; pres++) {
        /* Errata: cannot divide by 1 on some IP revisions */

Return to “LINUX”

Who is online

Users browsing this forum: Google [Bot] and 1 guest