Changes between Version 19 and Version 20 of ventana/LVDS


Ignore:
Timestamp:
09/23/2021 07:44:21 PM (3 years ago)
Author:
Tim Harvey
Comment:

refactor page

Legend:

Unmodified
Added
Removed
Modified
  • ventana/LVDS

    v19 v20  
    149149
    150150
     151[=#bootscript]
     152=== Bootloader boot script
     153Most Gateworks BSP's load and execute a U-Boot bootscript from the OS that performs any OS specific kernel configuration. The bootloader will load and execute a script (if found) from the first ext2/3/4 partition on a block storage device, or the ubi boot/rootfs volume of a NAND ubi partition named {{{boot/6x_bootscript-ventana}}}. The source for these scripts can be found here:
     154 - [https://github.com/Freescale/meta-freescale-3rdparty/blob/master/recipes-bsp/u-boot/u-boot-script-gateworks-imx/6x_bootscript-yocto.txt Yocto Bootscript]
     155 - [https://github.com/Gateworks/android_device_gateworks/blob/imx_l5.1.1_2.1.0-ga/ventana/6x_bootscript.txt Android 5.1 Bootscript]
     156 - [https://github.com/Gateworks/openwrt/blob/16.02/target/linux/imx6/image/bootscript-ventana OpenWrt 16.02]
     157
     158One of the things the Yocto and Android bootscripts do is configure the 'video=' kernel parameters based on the display env variable to values that are appropriate for the kernels used there. You can always override this by setting the bootloader 'video' env parameter manually, or you can add to the bootloader script to configure the parameters for your device specifically.
     159
     160As an example, lets take the 'AUO G101EVN01.0' 1280x800 10.1" LVDS display:
     161 * for Yocto using the 3.14 kernel (see wiki:Yocto/Video_Out Yocto/Video_Out)
     162{{{#!bash
     163setenv video 'video=mxcfb0:dev=ldb,LDB-XGA,if=RGB666 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off'
     164}}}
     165 * for Android using the 3.14 kernel:
     166{{{#!bash
     167setenv video 'video=mxcfb0:dev=ldb,bpp=32,LDB-XGA,if=RGB666 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off'
     168}}}
     169 * for OpenWrt 16.02 using the 4.4 kernel (see wiki:linux/display):
     170{{{#!bash
     171setenv video 'video=LVDS-1:1280x800@60M video=HDMI-A-1:d'
     172}}}
     173
     174
     175[=#linux]
    151176=== Linux kernel
    152177From the Linux perspective there are various drivers responsible for different functions of a touchscreen:
    153  - Display
     178 - Display Timings
     179 - Display Driver kernel parameters
    154180 - Touch input events
    155181 - Backlight brightness
     
    157183Note that the kernel drivers and API's differ over time in various kernel versions.
    158184
    159 ==== Display
    160 Freescale Linux Kernels (3.0.35, 3.10.17, 3.10.31, 3.10.53, 3.14.28, 3.14.48):
    161  * the video kernel parameter can specify display details for mxcfb0, mxcfb1, mxcfb2, mxcfb3 devices (IMX6Q can support 4 simultaneous display out, while IMX6DL can support 2).
    162  * see [wiki:Yocto/Video_Out#DisplaysDevices here] for details
    163   * For 3.10.31 and later kernels the video mode settings describing resolution and timings are selected through device-tree properties
    164   * For earlier kernels the video mode settings are selected by specifying one of the following in the mxcfb device descriptor in the video command line parameter
    165 
    166 Linux Display Driver Support:
    167  * The Gateworks Yocto and Android BSP's support  A driver supporting the i.MX6 IPU is required for display. This is available in the Gateworks 3.0.35 and 3.10.17 kernels available in our Yocto BSP
    168   * mainline linux driver support is being worked on currently and targeted for the 3.15 kernel
    169  * The touch controller on the EXC7200 is compatible with the 'egalax_ts' linux driver
    170  * The display requires either a panel driver or device-tree configuration depending on kernel
    171  * The backlight can be controlled through the standard Linux pwm-backlight driver
     185==== Display Timings
     186For Linux Kernel support, the device-tree specifies the display timings. The device tree file you modify will depend on the board you are using, such as GW52xx, GW53xx, or GW54xx. For example, the GW53xx device-tree in the Gateworks 3.14 vendor kernel is [https://github.com/Gateworks/linux-imx6/blob/gateworks_fslc_3.14_1.0.x_ga/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi here].
     187
     188The Ventana kernel specifies multiple {{{display-timings}}} within the {{{lvds-channel@0}}} node and the {{{native-mode}}} property points to which one to use. This {{{native-mode}}} property gets set by the bootloader prior to booting the kernel based on the {{{display}}} env variable. Therefore, you can either add an additional timing and set the {{{display}}} variable, or you can simply overwrite the default timing0.
     189
     190The display timing device-tree bindings are documented in [https://lxr.missinglinkelectronics.com/linux+v3.14/Documentation/devicetree/bindings/video/display-timing.txt Documentation/devicetree/bindings/video/display-timing.txt]. All values are identical to those used in the bootloader except that the bootloader uses 'pixclock' which is in units of picoseconds, and the kernel uses 'clock-frequency' in units of Hz.
     191
     192
     193==== Display Driver kernel parameters
     194The Linux display drivers use kernel parameters to configure the various IMX display output devices. The parameters vary greatly depending on which kernel version you are using:
     195 * Modern mainline kernel or Gateworks kernel above 4.x: see [wiki:linux/display#kms]
     196 * Freescale Linux Kernels (3.0.35, 3.10.17, 3.10.31, 3.10.53, 3.14.28, 3.14.48):
     197  - the video kernel parameter can specify display details for mxcfb0, mxcfb1, mxcfb2, mxcfb3 devices (IMX6Q can support 4 simultaneous display out, while IMX6DL can support 2).
     198  - see [wiki:Yocto/Video_Out#DisplaysDevices here] for details
    172199
    173200
     
    738765
    739766[=#adding]
    740 == Adding Support for a New LCD ==
    741 Adding support for a new LCD requires modifying the source code of the software.
    742 
    743 While the code changes are fairly simple, determining the timings can be complicated and involves translating timings from the manufacturers datasheet to the display timings that Linux drivers need.
    744 
    745 === Determining Timing values ===
     767== Adding Support for a Touchscreen
     768Adding support for a new LCD requires modifying the source code of the software:
     769 - display timings
     770 - touch controller configuration - see [#touchcontroller]
     771 - backlight controller configuration - see [#backlight]
     772
     773While the code changes can be fairly simple, determining the timings can be complicated and involves translating timings from the manufacturers datasheet to the display timings that Linux drivers need.
     774
     775=== Determining Display Timing values
     776
     777==== Linux
     778The display timing device-tree bindings are documented in [https://lxr.missinglinkelectronics.com/linux+v3.14/Documentation/devicetree/bindings/video/display-timing.txt Documentation/devicetree/bindings/video/display-timing.txt]. All values are identical to those used in the bootloader except that the bootloader uses 'pixclock' which is in units of picoseconds, and the kernel uses 'clock-frequency' in units of Hz.
     779
     780As an example, lets take the 'AUO G101EVN01.0' 1280x800 10.1" LVDS display:
     781 * 1280x800 active pixels (6.5.1 Timing Characteristics)
     782 * pixclock = (1/68.93MHz)*(1000000) = 14507 (68.93MHz is from typical clock frequency specified in 6.5.1 Timing Characteristics)
     783
     784We would add an additional device-tree node to {{{display-timings}}} in arch/arm/boot/dts/imx6qdl-gw53xx.dtsi (to add it to the GW53xx - add it to the other board dtsi files as needed)
     785{{{
     786timing3: g101evn010 {
     787     clock-frequency = <68930000>;
     788     hactive = <1280>;
     789     vactive = <800>;
     790     hback-porch = <220>;
     791     hfront-porch = <40>;
     792     vback-porch = <21>;
     793     vfront-porch = <7>;
     794     hsync-len = <60>;
     795     vsync-len = <10>;
     796     linux,phandle = <&timing3>;
     797};
     798}}}
     799 * Note that 'timing3' needs to be unique from the other timings already defined
     800 * Note the 'linux,phandle' property that needs to reference itself (timing3 in this example). This is un-conventional but necessary in order for the Ventana U-Boot bootloader to adjust the 'native-timing' property to match (case-insenstive) the display named 'G101EVN010' in this example based on the env variable.
     801
     802Now, after our kernel device-tree is built and updated on our target board we can set the {{{display}}} variable as follows:
     803{{{#!bash
     804Ventana > setenv display G101EVN010; saveenv; reset
     805}}}
     806
     807To verify the device tree has the correct information once the board is booted, browse through the directory structure for the display-timings, and you should see your display:
     808{{{
     809root@ventana:~# ls /proc/device-tree/soc/aips-bus\@02000000/ldb\@020e0008/lvds-channel\@0/display-timings/
     810dlc700ctp    dlc700jmgt4  dlc800figt3  hsd100pxn1   name         native-mode
     811}}}
     812
     813Then, to verify the correct information, you can use something like the following command to see the values:
     814{{{
     815root@ventana:~# hexdump -C /proc/device-tree/soc/aips-bus\@02000000/ldb\@020e0008/lvds-channel\@0/display-timings/dlc700ctp/hactive
     81600000000  00 00 03 20                                       |... |
     81700000004
     818}}}
     819
     820The hex value of 0x0320 is decimal 800, which is correct for this example, of a horizontal active resolution of 800 pixels.
     821
    746822You can easily experiment with different timing values by using the Ventana bootloader 'fixfdt' script to alter the timings of the default display which is the 'hsd100pxn1' (unless you've changed it by setting the {{{display}}} env variable). Note that the timings represented in the device-tree are hex values.
    747823
     
    765841The display timing device-tree bindings are documented in [https://lxr.missinglinkelectronics.com/linux+v3.14/Documentation/devicetree/bindings/video/display-timing.txt Documentation/devicetree/bindings/video/display-timing.txt].
    766842
    767 
    768843[=#uboot]
    769 === U-Boot Bootloader LCD display support ===
     844==== U-Boot
    770845The Ventana U-Boot Bootloader specifies an array of displays via the {{{displays}}} variable [https://github.com/Gateworks/u-boot-imx6/blob/gateworks_v2015.04/board/gateworks/gw_ventana/gw_ventana.c#L328 here]. The {{{struct display_info_t}}} structure (defined [https://lxr.missinglinkelectronics.com/uboot/arch/arm/include/asm/imx-common/video.h#L11 here]) defines a bus/addr, pixel format, detect function, enable function, and video mode which includes a unique name, resolution and timings details. The {{{panel}}} env variable is used by U-Boot to determine which panel to configure and the value must match one of the video mode names in the array. Note that the {{{display}}} env variable can also be used for configuring the display for the Linux kernel (see below).
    771846
     
    828903Note that there is no support for touch-screen control in the Ventana bootloader.
    829904
    830 
    831 [=#bootscript]
    832 === Bootloader boot script ===
    833 Most Gateworks BSP's load and execute a U-Boot bootscript from the OS that performs any OS specific kernel configuration. The bootloader will load and execute a script (if found) from the first ext2/3/4 partition on a block storage device, or the ubi boot/rootfs volume of a NAND ubi partition named {{{boot/6x_bootscript-ventana}}}. The source for these scripts can be found here:
    834  - [https://github.com/Freescale/meta-freescale-3rdparty/blob/master/recipes-bsp/u-boot/u-boot-script-gateworks-imx/6x_bootscript-yocto.txt Yocto Bootscript]
    835  - [https://github.com/Gateworks/android_device_gateworks/blob/imx_l5.1.1_2.1.0-ga/ventana/6x_bootscript.txt Android 5.1 Bootscript]
    836  - [https://github.com/Gateworks/openwrt/blob/16.02/target/linux/imx6/image/bootscript-ventana OpenWrt 16.02]
    837 
    838 One of the things the Yocto and Android bootscripts do is configure the 'video=' kernel parameters based on the display env variable to values that are appropriate for the kernels used there. You can always override this by setting the bootloader 'video' env parameter manually, or you can add to the bootloader script to configure the parameters for your device specifically.
    839 
    840 As an example, lets take the 'AUO G101EVN01.0' 1280x800 10.1" LVDS display:
    841  * for Yocto using the 3.14 kernel (see wiki:Yocto/Video_Out Yocto/Video_Out)
    842 {{{#!bash
    843 setenv video 'video=mxcfb0:dev=ldb,LDB-XGA,if=RGB666 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off'
    844 }}}
    845  * for Android using the 3.14 kernel:
    846 {{{#!bash
    847 setenv video 'video=mxcfb0:dev=ldb,bpp=32,LDB-XGA,if=RGB666 video=mxcfb1:off video=mxcfb2:off video=mxcfb3:off'
    848 }}}
    849  * for OpenWrt 16.02 using the 4.4 kernel (see wiki:linux/display):
    850 {{{#!bash
    851 setenv video 'video=LVDS-1:1280x800@60M video=HDMI-A-1:d'
    852 }}}
    853 
    854 [=#linux]
    855 === Linux Kernel LCD display support ===
    856 For Linux Kernel support, the device-tree specifies the display timings. The device tree file you modify will depend on the board you are using, such as GW52xx, GW53xx, or GW54xx. For example, the GW53xx device-tree in the Gateworks 3.14 vendor kernel is [https://github.com/Gateworks/linux-imx6/blob/gateworks_fslc_3.14_1.0.x_ga/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi here].
    857 
    858 The Ventana kernel specifies multiple {{{display-timings}}} within the {{{lvds-channel@0}}} node and the {{{native-mode}}} property points to which one to use. This {{{native-mode}}} property gets set by the bootloader prior to booting the kernel based on the {{{display}}} env variable. Therefore, you can either add an additional timing and set the {{{display}}} variable, or you can simply overwrite the default timing0.
    859 
    860 The display timing device-tree bindings are documented in [https://lxr.missinglinkelectronics.com/linux+v3.14/Documentation/devicetree/bindings/video/display-timing.txt Documentation/devicetree/bindings/video/display-timing.txt]. All values are identical to those used in the bootloader except that the bootloader uses 'pixclock' which is in units of picoseconds, and the kernel uses 'clock-frequency' in units of Hz.
    861 
    862 As an example, lets take the 'AUO G101EVN01.0' 1280x800 10.1" LVDS display:
    863  * 1280x800 active pixels (6.5.1 Timing Characteristics)
    864  * pixclock = (1/68.93MHz)*(1000000) = 14507 (68.93MHz is from typical clock frequency specified in 6.5.1 Timing Characteristics)
    865 
    866 We would add an additional device-tree node to {{{display-timings}}} in arch/arm/boot/dts/imx6qdl-gw53xx.dtsi (to add it to the GW53xx - add it to the other board dtsi files as needed)
    867 {{{
    868 timing3: g101evn010 {
    869      clock-frequency = <68930000>;
    870      hactive = <1280>;
    871      vactive = <800>;
    872      hback-porch = <220>;
    873      hfront-porch = <40>;
    874      vback-porch = <21>;
    875      vfront-porch = <7>;
    876      hsync-len = <60>;
    877      vsync-len = <10>;
    878      linux,phandle = <&timing3>;
    879 };
    880 }}}
    881  * Note that 'timing3' needs to be unique from the other timings already defined
    882  * Note the 'linux,phandle' property that needs to reference itself (timing3 in this example). This is un-conventional but necessary in order for the Ventana U-Boot bootloader to adjust the 'native-timing' property to match (case-insenstive) the display named 'G101EVN010' in this example based on the env variable.
    883 
    884 Now, after our kernel device-tree is built and updated on our target board we can set the {{{display}}} variable as follows:
    885 {{{#!bash
    886 Ventana > setenv display G101EVN010; saveenv; reset
    887 }}}
    888 
    889 To verify the device tree has the correct information once the board is booted, browse through the directory structure for the display-timings, and you should see your display:
    890 {{{
    891 root@ventana:~# ls /proc/device-tree/soc/aips-bus\@02000000/ldb\@020e0008/lvds-channel\@0/display-timings/
    892 dlc700ctp    dlc700jmgt4  dlc800figt3  hsd100pxn1   name         native-mode
    893 }}}
    894 
    895 Then, to verify the correct information, you can use something like the following command to see the values:
    896 {{{
    897 root@ventana:~# hexdump -C /proc/device-tree/soc/aips-bus\@02000000/ldb\@020e0008/lvds-channel\@0/display-timings/dlc700ctp/hactive
    898 00000000  00 00 03 20                                       |... |
    899 00000004
    900 }}}
    901 
    902 The hex value of 0x0320 is decimal 800, which is correct for this example, of a horizontal active resolution of 800 pixels.
    903 
    904 If your display has a touch-screen controller you need to add support for that separately which typically involves enabling a driver and adding a device-tree binding for that driver (not described here).