Linux Kernel 4.6.2 LVDS Display

Dear Mr,

Due to lack of the gpios under 4.6.2 mainstream linux kernel is there possible and if yes, how to configure lvds display to work in single channel mode and 1024x768R-16@60 resolution?

Best regards,

Kamil

Due to lack of the gpios under 4.6.2 mainstream linux kernel is there possible and if yes, how to configure lvds display to work in single channel mode

Well, GPIOs should work just fine in mainline however they won’t be exported by default. Just export them first as explained in the following article on our developer website.

and 1024x768R-16@60 resolution?

Panels and with it the exact display resolution and timing information should be added to the panel-simple.c driver and referenced from the device tree as documented here.

So, I have created the script: /usr/bin/lvds-single-channel.sh

#!/bin/sh
#enable the parallel RGB to LVDS controller in single channel mode

echo 216 > /sys/class/gpio/export
echo 219 > /sys/class/gpio/export
echo 222 > /sys/class/gpio/export
echo 223 > /sys/class/gpio/export
echo 226 > /sys/class/gpio/export
echo 225 > /sys/class/gpio/export
echo 221 > /sys/class/gpio/export
echo 220 > /sys/class/gpio/export

echo high  > /sys/class/gpio/gpio216/direction
echo high  > /sys/class/gpio/gpio219/direction
echo high  > /sys/class/gpio/gpio222/direction
echo high  > /sys/class/gpio/gpio223/direction
echo high  > /sys/class/gpio/gpio226/direction
echo high  > /sys/class/gpio/gpio225/direction
echo high  > /sys/class/gpio/gpio221/direction
echo high  > /sys/class/gpio/gpio220/direction

added it to the init.d directiory, and set to run during system start:

#!/bin/sh
/usr/bin/lvds-single-channel.sh

edited and deployed device tree as bellow:

panel: panel {
                /*
                 * edt,et057090dhu: EDT 5.7" LCD TFT
                 * edt,et070080dh6: EDT 7.0" LCD TFT
                 */
                compatible = "innolux,g121x1-l03", "simple-panel";

                backlight = <&backlight>;
        };

where, my panel is already defined in panel-simple.c as bellow:

static const struct drm_display_mode innolux_g121x1_l03_mode = {
        .clock = 65000,
        .hdisplay = 1024,
        .hsync_start = 1024 + 0,
        .hsync_end = 1024 + 1,
        .htotal = 1024 + 0 + 1 + 320,
        .vdisplay = 768,
        .vsync_start = 768 + 38,
        .vsync_end = 768 + 38 + 1,
        .vtotal = 768 + 38 + 1 + 0,
        .vrefresh = 60,
        .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
};

static const struct panel_desc innolux_g121x1_l03 = {
        .modes = &innolux_g121x1_l03_mode,
        .num_modes = 1,
        .bpc = 6,
        .size = {
                .width = 246,
                .height = 185,
        },
        .delay = {
                .enable = 200,
                .unprepare = 200,
                .disable = 400,
        },
};

Additionally I set boot vidargs to null, but still cannot see proper image on lvds display. I can only see random color during system start. On toradex custom kernel display works fine. How can I debug this problem? I am using apalis T30 on custom extension board. In attachment you can find xorg log link text

I just quickly tried it myself albeit using a somewhat recent linux-next from last week plus a 800x600 LVDS panel I had handy and it worked fine. I even used your exact GPIO script. A few things to double check: Did you ever try executing your script manually? As we are not really using any init.d stuff but rather systemd I’m rather unsure what exactly you did there. You could also double check this doing ‘cat /sys/kernel/debug/gpio’. Depending on the panel it might not synchronise if it is not feed with its exact timings. Are you sure that is kosher?

Dear mr Marcel,

Thank you very much for your assistance and sorry for taking your time. I have tried to run this script manually, but still the same result. Just after running this script, screen became white, and kept changing through red color to finish with black at the end. Below is my gpio debug:

   cat /sys/kernel/debug/gpio                                                                                                                                                         
gpiochip0: GPIOs 0-255, tegra-gpio:
 gpio-111 (                    |HDMI hotplug detect ) in  lo IRQ
 gpio-157 (                    |usbo1_vbus          ) out hi    
 gpio-169 (                    |WAKE1_MICO          ) in  lo IRQ
 gpio-170 (                    |enable              ) out hi    
 gpio-171 (                    |cd                  ) in  lo IRQ
 gpio-216 (                    |sysfs               ) out hi    
 gpio-219 (                    |sysfs               ) out hi    
 gpio-220 (                    |sysfs               ) out hi    
 gpio-221 (                    |sysfs               ) out hi    
 gpio-222 (                    |sysfs               ) out hi    
 gpio-223 (                    |sysfs               ) out hi    
 gpio-225 (                    |sysfs               ) out hi    
 gpio-226 (                    |sysfs               ) out hi    
 gpio-229 (                    |cd                  ) in  lo IRQ
 gpio-233 (                    |usbh_vbus           ) out hi    

gpiochip1: GPIOs 1015-1023, parent: platform/tps65910-gpio, tps65911, can sleep:
 gpio-1021 (                    |+V1.8_AVDD_HDMI_PLL ) out hi    
root@apalis-t30:~# 

My LCD exact model is: G121X1-L03 Rev. C4, so I found innolux,g121x1-l03 in panel-simple.c file and decided to use it. And the question is what do you mean by feeding the screen with exact timings?

As you are using a mainline Linux kernel I just want to double check whether you do actually get proper output e.g. when using a HDMI screen? If you are still using LXDE and/or at least X this will only work with the modesetting driver as e.g. explained here. For testing you may just stop/disable LXDE (e.g. using ‘systemctl stop lxde’) to get at least some framebuffer console output. Please also note that in the LXDE case the dual channel LVDS script may already be run automatically from /etc/xdg/lxsession/LXDE/autostart as explained here.

Dear Mr Marcel,

Thank you very much for your assistance again. Thanks to your yesterday help, I finally got it working. What I had to do, was to set display timings to the xorg.conf, so I have added lines as bellow:

Section "Monitor"
        Identifier  "LCD"
        Option      "DPMS" "off"
        Modeline "1024x768"   65   1024 1048 1184 1344   768 771 777 806  -hsyncc
 -vsync
EndSection

Only think, which is not working, is console, after press alt+ctr+f1, but I believe that setting correct frame buffer parameters with fbset command will help. The question is, can I move somehow this settings to kernel or device tree? It would be much nicer to have them in one place, rather than in two separate places. I tried to do it with device tree as bellow:

panel: panel {
                /*
                 * edt,et057090dhu: EDT 5.7" LCD TFT
                 * edt,et070080dh6: EDT 7.0" LCD TFT
                 */
                compatible = "innolux,g121x1-l03", "simple-panel";

                backlight = <&backlight>;

bits-per-pixel = <16>;
                display-timings {
                    native-mode = <&timing_xvga>;
                    /* Standard VGA timing */
                    timing_xvga: 1024x768 {
                        clock-frequency = <65000>;
                        hactive = <1024>;
                        vactive = <768>;
                        hback-porch = <160>;
                        hfront-porch = <24>;
                        vback-porch = <29>;
                        vfront-porch = <3>;
                        hsync-len = <136>;
                        vsync-len = <6>;
                        hsync-active = <0>;
                        vsync-active = <0>;
                        pixelclk-active = <0>;
                    };
                };
        };

but it`s not working.

I don’t think any such configuration is required at all be it xorg.conf nor device tree.

I just flashed the root file system of our latest Apalis TK1 BSP V2.6 beta 2 to my Apalis T30 as that one ships with the modesetting X driver (e.g. setenv board apalis-tk1; setenv board_name apalis-tk1; run setupdate; run update_rootfs). I then removed the /etc/X11/xorg.conf file and commented out the xrandr LVDS-0 disabling from /etc/xdg/lxsession/LXDE/autostart and now the display works just fine out-of-the-box.