LCD的配置

lcd的驱动也不需要自己写,而是在设备树中配置好即可。

设备树

    panel {
        compatible = "ti,tilcdc,panel";
        status = "okay";
        pinctrl-names = "default";
        pinctrl-0 = <&lcd_pins_s0>;
        panel-info {
            ac-bias           = <255>;
            ac-bias-intrpt    = <0>;
            dma-burst-sz      = <16>;
            bpp               = <16>;
            fdd               = <255>;
            sync-edge         = <0>;
            sync-ctrl         = <1>;
            raster-order      = <0>;
            fifo-th           = <6>;
        };

        display-timings {
            800x480p62 {
                clock-frequency = <30000000>;
                hactive = <640>;
                vactive = <480>;
                hfront-porch = <16>;
                hback-porch = <144>;
                hsync-len = <10>;
                vback-porch = <13>;
                vfront-porch = <32>;
                vsync-len = <2>;
                hsync-active = <1>;
                vsync-active = <1>;
            };
        };
    };

    lcd_pins_s0: lcd_pins_s0 {
        pinctrl-single,pins = <
            0x20 0x01   /* gpmc_ad8.lcd_data16, OUTPUT | MODE1 */
            0x24 0x01   /* gpmc_ad9.lcd_data17, OUTPUT | MODE1 */
            0x28 0x01   /* gpmc_ad10.lcd_data18, OUTPUT | MODE1 */
            0x2c 0x01   /* gpmc_ad11.lcd_data19, OUTPUT | MODE1 */
            0x30 0x01   /* gpmc_ad12.lcd_data20, OUTPUT | MODE1 */
            0x34 0x01   /* gpmc_ad13.lcd_data21, OUTPUT | MODE1 */
            0x38 0x01   /* gpmc_ad14.lcd_data22, OUTPUT | MODE1 */
            0x3c 0x01   /* gpmc_ad15.lcd_data23, OUTPUT | MODE1 */
            0xa0 0x00   /* lcd_data0.lcd_data0, OUTPUT | MODE0 */
            0xa4 0x00   /* lcd_data1.lcd_data1, OUTPUT | MODE0 */
            0xa8 0x00   /* lcd_data2.lcd_data2, OUTPUT | MODE0 */
            0xac 0x00   /* lcd_data3.lcd_data3, OUTPUT | MODE0 */
            0xb0 0x00   /* lcd_data4.lcd_data4, OUTPUT | MODE0 */
            0xb4 0x00   /* lcd_data5.lcd_data5, OUTPUT | MODE0 */
            0xb8 0x00   /* lcd_data6.lcd_data6, OUTPUT | MODE0 */
            0xbc 0x00   /* lcd_data7.lcd_data7, OUTPUT | MODE0 */
            0xc0 0x00   /* lcd_data8.lcd_data8, OUTPUT | MODE0 */
            0xc4 0x00   /* lcd_data9.lcd_data9, OUTPUT | MODE0 */
            0xc8 0x00   /* lcd_data10.lcd_data10, OUTPUT | MODE0 */
            0xcc 0x00   /* lcd_data11.lcd_data11, OUTPUT | MODE0 */
            0xd0 0x00   /* lcd_data12.lcd_data12, OUTPUT | MODE0 */
            0xd4 0x00   /* lcd_data13.lcd_data13, OUTPUT | MODE0 */
            0xd8 0x00   /* lcd_data14.lcd_data14, OUTPUT | MODE0 */
            0xdc 0x00   /* lcd_data15.lcd_data15, OUTPUT | MODE0 */
            0xe0 0x00   /* lcd_vsync.lcd_vsync, OUTPUT | MODE0 */
            0xe4 0x00   /* lcd_hsync.lcd_hsync, OUTPUT | MODE0 */
            0xe8 0x00   /* lcd_pclk.lcd_pclk, OUTPUT | MODE0 */
            0xec 0x00   /* lcd_ac_bias_en.lcd_ac_bias_en, OUTPUT | MODE0 */
        >;
    };

配置参数

配置lcd对应的管脚,方法前面已说过。
配置lcd的参数,这个需要根据自己的lcd设备spec来设置。

display-timings

在Documentation/devicetree/bindings/video/display-timing.txt有详细描述。

display-timings node
--------------------

required properties:
 - none

optional properties:
 - native-mode: The native mode for the display, in case multiple modes are
                provided. When omitted, assume the first node is the native.

timing subnode
--------------

required properties:
 - hactive, vactive: display resolution
 - hfront-porch, hback-porch, hsync-len: horizontal display timing parameters
   in pixels
   vfront-porch, vback-porch, vsync-len: vertical display timing parameters in
   lines
 - clock-frequency: display clock in Hz

optional properties:
 - hsync-active: hsync pulse is active low/high/ignored
 - vsync-active: vsync pulse is active low/high/ignored
 - de-active: data-enable pulse is active low/high/ignored
 - pixelclk-active: with
                        - active high = drive pixel data on rising edge/
                                        sample data on falling edge
                        - active low  = drive pixel data on falling edge/
                                        sample data on rising edge
                        - ignored     = ignored
 - interlaced (bool): boolean to enable interlaced mode
 - doublescan (bool): boolean to enable doublescan mode
 - doubleclk (bool): boolean to enable doubleclock mode

All the optional properties that are not bool follow the following logic:
    <1>: high active
    <0>: low active
    omitted: not used on hardware

There are different ways of describing the capabilities of a display. The
devicetree representation corresponds to the one commonly found in datasheets
for displays. If a display supports multiple signal timings, the native-mode
can be specified.
The parameters are defined as:

  +----------+-------------------------------------+----------+-------+
  |          |        ↑                            |          |       |
  |          |        |vback_porch                 |          |       |
  |          |        ↓                            |          |       |
  +----------#######################################----------+-------+
  |          #        ↑                            #          |       |
  |          #        |                            #          |       |
  |  hback   #        |                            #  hfront  | hsync |
  |   porch  #        |       hactive              #  porch   |  len  |
  |<-------->#<-------+--------------------------->#<-------->|<----->|
  |          #        |                            #          |       |
  |          #        |vactive                     #          |       |
  |          #        |                            #          |       |
  |          #        ↓                            #          |       |
  +----------#######################################----------+-------+
  |          |        ↑                            |          |       |
  |          |        |vfront_porch                |          |       |
  |          |        ↓                            |          |       |
  +----------+-------------------------------------+----------+-------+
  |          |        ↑                            |          |       |
  |          |        |vsync_len                   |          |       |
  |          |        ↓                            |          |       |
  +----------+-------------------------------------+----------+-------+

Example:

        display-timings {
                native-mode = <&timing0>;
                timing0: 1080p24 {
                        /* 1920x1080p24 */
                        clock-frequency = <52000000>;
                        hactive = <1920>;
                        vactive = <1080>;
                        hfront-porch = <25>;
                        hback-porch = <25>;
                        hsync-len = <25>;
                        vback-porch = <2>;
                        vfront-porch = <2>;
                        vsync-len = <2>;
                        hsync-active = <1>;
                };
        };
Every required property also supports the use of ranges, so the commonly used
datasheet description with minimum, typical and maximum values can be used.

Example:

        timing1: timing {
                /* 1920x1080p24 */
                clock-frequency = <148500000>;
                hactive = <1920>;
                vactive = <1080>;
                hsync-len = <0 44 60>;
                hfront-porch = <80 88 95>;
                hback-porch = <100 148 160>;
                vfront-porch = <0 4 6>;
                vback-porch = <0 36 50>;
                vsync-len = <0 5 6>;
        };

panel-info

在Documentation/devicetree/bindings/drm/tilcdc/panel.txt有详细描述。

Device-Tree bindings for tilcdc DRM generic panel output driver

Required properties:
 - compatible: value should be "ti,tilcdc,panel".
 - panel-info: configuration info to configure LCDC correctly for the panel
   - ac-bias: AC Bias Pin Frequency
   - ac-bias-intrpt: AC Bias Pin Transitions per Interrupt
   - dma-burst-sz: DMA burst size
   - bpp: Bits per pixel
   - fdd: FIFO DMA Request Delay
   - sync-edge: Horizontal and Vertical Sync Edge: 0=rising 1=falling
   - sync-ctrl: Horizontal and Vertical Sync: Control: 0=ignore
   - raster-order: Raster Data Order Select: 1=Most-to-least 0=Least-to-most
   - fifo-th: DMA FIFO threshold
 - display-timings: typical videomode of lcd panel.  Multiple video modes
   can be listed if the panel supports multiple timings, but the 'native-mode'
   should be the preferred/default resolution.  Refer to
   Documentation/devicetree/bindings/video/display-timing.txt for display
   timing binding details.

Recommended properties:
 - pinctrl-names, pinctrl-0: the pincontrol settings to configure
   muxing properly for pins that connect to TFP410 device

Example:

        /* Settings for CDTech_S035Q01 / LCD3 cape: */
        lcd3 {
                compatible = "ti,tilcdc,panel";
                pinctrl-names = "default";
                pinctrl-0 = <&bone_lcd3_cape_lcd_pins>;
                panel-info {
                        ac-bias           = <255>;
                        ac-bias-intrpt    = <0>;
                        dma-burst-sz      = <16>;
                        bpp               = <16>;
                        fdd               = <0x80>;
                        sync-edge         = <0>;
                        sync-ctrl         = <1>;
                        raster-order      = <0>;
                        fifo-th           = <0>;
                };
                display-timings {
                        native-mode = <&timing0>;
                        timing0: 320x240 {
                                hactive         = <320>;
                                vactive         = <240>;
                                hback-porch     = <21>;
                                hfront-porch    = <58>;
                                hsync-len       = <47>;
                                vback-porch     = <11>;
                                vfront-porch    = <23>;
                                vsync-len       = <2>;
                                clock-frequency = <8000000>;
                                hsync-active    = <0>;
                                vsync-active    = <0>;
                        };
                };
        };

另外,需要确保tilcdc驱动使能。

猜你喜欢

转载自blog.csdn.net/donglicaiju76152/article/details/77917696
LCD