将 LCD 添加到设备树

将 LCD 添加到设备树

我正在尝试在 Beaglebone Black Debian 映像的设备树中定义我的 SHARP 并行 24 位 LCD 屏幕panel-infodisplay-timings为此,我使用了覆盖.dtbo文件。我的问题是,我似乎无法找到某些值的计时,例如hsync-lende-active夏普 LS037V7DW05 数据表

我希望有更多阅读 LCD 数据表经验的人可以帮助我从该文档中解读正确的值以添加到我的覆盖文件中。

覆盖文件如下所示,很可能有错误:

/*
 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

/dts-v1/;
/plugin/;

#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/am33xx.h>
#include <dt-bindings/board/am335x-bbw-bbb-base.h>

/ {
    compatible = "ti,beaglebone", "ti,beaglebone-black";

    /* identification */
    part-number = "am335x-osd3358-mt";
    version = "01";

    /* state the resources this cape uses */
    exclusive-use =
        /* the pin header uses */
        "P8.45",    /* lcd: lcd_data0 */
        "P8.46",    /* lcd: lcd_data1 */
        "P8.43",    /* lcd: lcd_data2 */
        "P8.44",    /* lcd: lcd_data3 */
        "P8.41",    /* lcd: lcd_data4 */
        "P8.42",    /* lcd: lcd_data5 */
        "P8.39",    /* lcd: lcd_data6 */
        "P8.40",    /* lcd: lcd_data7 */
        "P8.37",    /* lcd: lcd_data8 */
        "P8.38",    /* lcd: lcd_data9 */
        "P8.36",    /* lcd: lcd_data10 */
        "P8.34",    /* lcd: lcd_data11 */
        "P8.35",    /* lcd: lcd_data12 */
        "P8.33",    /* lcd: lcd_data13 */
        "P8.31",    /* lcd: lcd_data14 */
        "P8.32",    /* lcd: lcd_data15 */
        "P8.15",    /* lcd: lcd_data16 */
        "P8.16",    /* lcd: lcd_data17 */
        "P8.11",    /* lcd: lcd_data18 */
        "P8.12",    /* lcd: lcd_data19 */
        "P8.17",    /* lcd: lcd_data20 */
        "P8.14",    /* lcd: lcd_data21 */
        "P8.13",    /* lcd: lcd_data22 */
        "P8.19",    /* lcd: lcd_data23 */
        "P8.27",    /* lcd: lcd_vsync */
        "P8.29",    /* lcd: lcd_hsync */
        "P8.28",    /* lcd: lcd_pclk */
        "P8.30",    /* lcd: lcd_ac_bias_en */
        "P9.27",    /* lcd: gpio3_19 DISPEN */

        "P9.31",    /* touch interrupt on gpio3_14 */
        "P9.24",    /*uart1_txd*/
        "P9.26",    /*uart1_rxd*/
        /* the hardware IP uses */
        "i2c2",
        "gpio2_7",
        "gpio2_8",
        "gpio3_15",
        "uart1",
        "lcdc";

    /*
     * Free up the pins used by the cape from the pinmux helpers.
     */
    fragment@0 {
        target = <&ocp>;
        __overlay__ {
            P8_45_pinmux { status = "disabled"; };  /* lcd: lcd_data0 */
            P8_46_pinmux { status = "disabled"; };  /* lcd: lcd_data1 */
            P8_43_pinmux { status = "disabled"; };  /* lcd: lcd_data2 */
            P8_44_pinmux { status = "disabled"; };  /* lcd: lcd_data3 */
            P8_41_pinmux { status = "disabled"; };  /* lcd: lcd_data4 */
            P8_42_pinmux { status = "disabled"; };  /* lcd: lcd_data5 */
            P8_39_pinmux { status = "disabled"; };  /* lcd: lcd_data6 */
            P8_40_pinmux { status = "disabled"; };  /* lcd: lcd_data7 */
            P8_37_pinmux { status = "disabled"; };  /* lcd: lcd_data8 */
            P8_38_pinmux { status = "disabled"; };  /* lcd: lcd_data9 */
            P8_36_pinmux { status = "disabled"; };  /* lcd: lcd_data10 */
            P8_34_pinmux { status = "disabled"; };  /* lcd: lcd_data11 */
            P8_35_pinmux { status = "disabled"; };  /* lcd: lcd_data12 */
            P8_33_pinmux { status = "disabled"; };  /* lcd: lcd_data13 */
            P8_31_pinmux { status = "disabled"; };  /* lcd: lcd_data14 */
            P8_32_pinmux { status = "disabled"; };  /* lcd: lcd_data15 */

            P8_15_pinmux { status = "disabled"; };  /* gpmc_ad15.lcd_data16 */
            P8_16_pinmux { status = "disabled"; };  /* gpmc_ad14.lcd_data17 */
            P8_11_pinmux { status = "disabled"; };  /* gpmc_ad13.lcd_data18 */
            P8_12_pinmux { status = "disabled"; };  /* gpmc_ad12.lcd_data19 */
            P8_17_pinmux { status = "disabled"; };  /* gpmc_ad11.lcd_data20 */
            P8_14_pinmux { status = "disabled"; };  /* gpmc_ad10.lcd_data21 */
            P8_13_pinmux { status = "disabled"; };  /* gpmc_ad9.lcd_data22 */
            P8_19_pinmux { status = "disabled"; };  /* gpmc_ad8.lcd_data23 */

            P8_27_pinmux { status = "disabled"; };  /* lcd: lcd_vsync */
            P8_29_pinmux { status = "disabled"; };  /* lcd: lcd_hsync */
            P8_28_pinmux { status = "disabled"; };  /* lcd: lcd_pclk */
            P8_30_pinmux { status = "disabled"; };  /* lcd: lcd_ac_bias_en */

            P9_27_pinmux { status = "disabled"; };  /* lcd: gpio3_19 DISPEN */
            P9_31_pinmux { status = "disabled"; };  /* touch interrupt on gpio3_21 */
            
        };
    };

    fragment@1 {
        target = <&am33xx_pinmux>;
        __overlay__ {

            
            bb_lcd_lcd_pins: pinmux_bb_lcd_lcd_pins {
                pinctrl-single,pins = <
                    BONE_P8_45 (PIN_OUTPUT | MUX_MODE0) /* lcd: lcd_data0.lcd_data0 */
                    BONE_P8_46 (PIN_OUTPUT | MUX_MODE0) /* lcd: lcd_data1.lcd_data1 */
                    BONE_P8_43 (PIN_OUTPUT | MUX_MODE0) /* lcd: lcd_data2.lcd_data2 */
                    BONE_P8_44 (PIN_OUTPUT | MUX_MODE0) /* lcd: lcd_data3.lcd_data3 */
                    BONE_P8_41 (PIN_OUTPUT | MUX_MODE0) /* lcd: lcd_data4.lcd_data4 */
                    BONE_P8_42 (PIN_OUTPUT | MUX_MODE0) /* lcd: lcd_data5.lcd_data5 */
                    BONE_P8_39 (PIN_OUTPUT | MUX_MODE0) /* lcd: lcd_data6.lcd_data6 */
                    BONE_P8_40 (PIN_OUTPUT | MUX_MODE0) /* lcd: lcd_data7.lcd_data7 */
                    BONE_P8_37 (PIN_OUTPUT | MUX_MODE0) /* lcd: lcd_data8.lcd_data8 */
                    BONE_P8_38 (PIN_OUTPUT | MUX_MODE0) /* lcd: lcd_data9.lcd_data9 */
                    BONE_P8_36 (PIN_OUTPUT | MUX_MODE0) /* lcd: lcd_data10.lcd_data10 */
                    BONE_P8_34 (PIN_OUTPUT | MUX_MODE0) /* lcd: lcd_data11.lcd_data11 */
                    BONE_P8_35 (PIN_OUTPUT | MUX_MODE0) /* lcd: lcd_data12.lcd_data12 */
                    BONE_P8_33 (PIN_OUTPUT | MUX_MODE0) /* lcd: lcd_data13.lcd_data13 */
                    BONE_P8_31 (PIN_OUTPUT | MUX_MODE0) /* lcd: lcd_data14.lcd_data14 */
                    BONE_P8_32 (PIN_OUTPUT | MUX_MODE0) /* lcd: lcd_data15.lcd_data15 */
                    BONE_P8_15 (PIN_OUTPUT | MUX_MODE0) /* lcd: lcd_data15.lcd_data16 */
                    BONE_P8_16 (PIN_OUTPUT | MUX_MODE0) /* lcd: lcd_data15.lcd_data17 */
                    BONE_P8_11 (PIN_OUTPUT | MUX_MODE0) /* lcd: lcd_data15.lcd_data18 */
                    BONE_P8_12 (PIN_OUTPUT | MUX_MODE0) /* lcd: lcd_data15.lcd_data19 */
                    BONE_P8_17 (PIN_OUTPUT | MUX_MODE0) /* lcd: lcd_data15.lcd_data20 */
                    BONE_P8_14 (PIN_OUTPUT | MUX_MODE0) /* lcd: lcd_data15.lcd_data21 */
                    BONE_P8_13 (PIN_OUTPUT | MUX_MODE0) /* lcd: lcd_data15.lcd_data22 */
                    BONE_P8_19 (PIN_OUTPUT | MUX_MODE0) /* lcd: lcd_data15.lcd_data23 */

                    BONE_P8_27 (PIN_OUTPUT | MUX_MODE0) /* lcd: lcd_vsync.lcd_vsync */
                    BONE_P8_29 (PIN_OUTPUT | MUX_MODE0) /* lcd: lcd_hsync.lcd_hsync */
                    BONE_P8_28 (PIN_OUTPUT | MUX_MODE0) /* lcd: lcd_pclk.lcd_pclk */
                    BONE_P8_30 (PIN_OUTPUT | MUX_MODE0) /* lcd: lcd_ac_bias_en.lcd_ac_bias_en */
                    
                    0x1a4 0x17  /* mcasp0_fsr.gpio3_19, OUTPUT | MODE7 LCD DISEN*/

                >;
            };

            bb_uart1_pins: pinmux_bb_uart1_pins {
                pinctrl-single,pins = <
                    0x184 0x20 /* P9.24 uart1_txd.uart1_txd  OUTPUT  */
                    0x180 0x20 /* P9.26 uart1_rxd.uart1_rxd  INPUT  */
                >;
            };          

            bu21023_tp_pins: pinmux_bu21023_tp_pins {
                pinctrl-single,pins = <
                    0x190 0x37  // INPUT_PULLUP | MODE7
                >;
            };
            

            gpio_helper_pins: pinmux_gpio_helper_pins {
                pinctrl-single,pins = <
                    0x044 0x17  /* gpio2_7 gpmc_a1 | MODE7 | OUTPUT */
                    0x048 0x17  /* gpio2_8 gpmc_a2 | MODE7 | OUTPUT */
                    0x194 0x17  /* gpio3_15 mcasp0_fx | MODE7 | OUTPUT*/

                               /* OUTPUT  GPIO(mode7) 0x07 pulldown, 0x17 pullup, 0x?f no pullup/down */
                   /* INPUT   GPIO(mode7) 0x27 pulldown, 0x37 pullup, 0x?f no pullup/down */
                >;
            };
        };
    };


    fragment@2 {
        target = <&i2c2>;
        __overlay__ {
            status = "okay";
            //pinctrl-names = "default";
            //pinctrl-0 = <&bb_i2c2_pins>;

            // configuration start
            clock-frequency = <100000>;

            #address-cells = <1>;
            #size-cells = <0>;

            bu21023:bu21023_ts@5d {
                pinctrl-names = "default";
                pinctrl-0 = <&bu21023_tp_pins>;
                compatible = "rohm,bu21023_ts";
                reg=<0x5d>;
                touch-gpio = <&gpio3 14 IRQ_TYPE_LEVEL_HIGH>;
                rohm,touch-max-x = <480>;
                rohm,touch-max-y = <640>;
                interrupt-parent = <&gpio3>;
                interrupts = <14 IRQ_TYPE_LEVEL_HIGH>;
            };

            

        };
    };

    /*
     * Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
     */
    fragment@3 {
        target-path="/";
        __overlay__ {

            chosen {
                overlays {
                    am335x-osd3358-mt-01 = __TIMESTAMP__;
                };
            };
        };
    };

    fragment@4 {
        target = <&lcdc>;
        __overlay__ {
            status = "okay";
            blue-and-red-wiring = "crossed";
        };
    };

    fragment@5 {
        target-path="/";
        __overlay__ {

            /* avoid stupid warning */
            #address-cells = <1>;
            #size-cells = <1>;

            lcd0:panel {
                status = "okay";
                compatible = "ti,tilcdc,panel";
                pinctrl-names = "default";
                pinctrl-0 = <&lcd_pins>;
                enable-gpios = <&gpio2 17 1>;
                backlight = <&lcd_backlight>;

                panel-info {
                    ac-bias           = <255>;
                    ac-bias-intrpt    = <0>;
                    dma-burst-sz      = <16>;
                    bpp               = <24>;
                    fdd               = <0x80>;
                    sync-edge         = <0>;
                    sync-ctrl         = <1>;
                    raster-order      = <0>;
                    fifo-th           = <0>;
                };
                
                display-timings {
                    native-mode = <&timing0>;
                    timing0: 480x640 {
                        clock-frequency = <30000000>;
                        hactive = <480>;
                        vactive = <640>;
                        hfront-porch = <4>;
                        hback-porch = <2>;
                        hsync-len = <648>;
                        vback-porch = <0>;
                        vfront-porch = <0>;
                        vsync-len = <2>;
                        hsync-active = <0>;
                        vsync-active = <0>;
                        de-active = <1>;
                        pixelclk-active = <0>;
                    };
                };
            };
        };
    };

    fragment@6 {
        target = <&ocp>;
        __overlay__ {

            gpio_helper: gpios {
                compatible = "bone-pinmux-helper";
                status = "okay";
                pinctrl-names = "default";
                pinctrl-0 = <&gpio_helper_pins>;

                //lcd_pwr_en {
                //  gpio-name = "LCD_PWR_EN";
                //  gpio = <&gpio3 7 0x00>; /* gpio3 is gpio2 */
                //  output;
                //  init-high;
                //};
    
                //lcd_reset {
                //  gpio-name = "LCD_RST";
                //  gpio = <&gpio3 8 0x00>; /* gpio3 is gpio2 */
                //  output;
                //  init-high;
                //};

                //ts_reset {
                //  gpio-name = "TS_RST";
                //  gpio = <&gpio4 15 0x00>;    /* gpio3 is gpio2 */
                //  output;
                //  init-high;
                //};
            };
        };
    };

    fragment@7 {
        target = <&uart2>;  /* really uart1 */
        __overlay__ {
            status = "okay";
            pinctrl-names = "default";
            pinctrl-0 = <&bb_uart1_pins>;
        };
    };

    fragment@8 {
        target-path = "/";
        __overlay__ {
            lcd_backlight: backlight {
                status = "okay";
                compatible = "gpio-backlight";
                pinctrl-names = "default";
                pinctrl-0 = <&backlight_pin>;
                gpios = <&gpio2 17 GPIO_ACTIVE_HIGH>;
            };
        };
    }
};

相关内容