Edit online

LVDS

4 Dec 2024
Read time: 3 minute(s)

LVDS 屏的调试和 RGB 类似,只需要把规格书中所描述的时序和规格参数加入相应的配置文件即可,也不需要额外的驱动程序。

uboot 配置

在 Luban 根目录下执行 make um,进入 uboot 的功能配置界面,使能显示模块驱动:

Device Drivers
    Graphics support
        ArtInChip Graphics  --->
            [*]   Enable ArtInChip Video Support
            [ ]   ArtInChip display rgb support
            [*]   ArtInChip display lvds support
            [ ]   ArtInChip display mipi-dsi support
            <*>   ArtInChip Panel Drivers (ArtInChip general LVDS panel)  --->

kernel 配置

在 Luban 根目录下执行 make km,进入 kernel 的功能配置界面,使能显示模块驱动:

Device Drivers
    Graphics support
        ArtInChip Graphics  --->
            <*> ArtInChip Framebuffer support
            [ ]   ArtInChip display rgb support
            [*]   ArtInChip display lvds support
            [ ]   ArtInChip display mipi-dsi support
            <*>   ArtInChip Panel Drivers (ArtInChip general LVDS panel)  --->

uboot dts

uboot 如果要进行显示,则声明相应的配置为预加载,以 demo128_nand 工程为例,文件为 target/d211/demo128_nand/board-u-boot.dtsi

声明通路
&disp {
    u-boot,dm-pre-reloc;
    fb0: fb@0 {
        u-boot,dm-pre-reloc;
        port {
            fb0_out: endpoint {
                u-boot,dm-pre-reloc;
            }
        };
    };
};

&de0 {
    u-boot,dm-pre-reloc;
    port@0 {
        de0_in: endpoint {
            u-boot,dm-pre-reloc;
        };
    };

    port@1 {
        de0_out: endpoint {
            u-boot,dm-pre-reloc;
        };
    };
};
&lvds0 {                            //lvds
    u-boot,dm-pre-reloc;
    port@0 {
        lvds0_in: endpoint {
            u-boot,dm-pre-reloc;
        };
    };

    port@1 {
        lvds0_out: endpoint {
            u-boot,dm-pre-reloc;
        };
    };
};
声明屏幕参数
panel_lvds {
    u-boot,dm-pre-reloc;
    port {
        panel_lvds_in: endpoint {
            u-boot,dm-pre-reloc;
        };
    };

    display-timings {
        u-boot,dm-pre-reloc;
        timing1: 1024x600 {
            u-boot,dm-pre-reloc;
        };
    };
};
声明屏幕引脚
lvds1_pins: lvds1-0 {
        u-boot,dm-pre-reloc;
    pins {
        u-boot,dm-pre-reloc;
    };
};

系统 DTS 参数

系统的 dts 将进行完整的功能配置,以 demo128_nand 工程为例,文件为 target/d211/demo128_nand/board.dts
  1. 配置通路
    通过 port 和 status 结点,定义一条数据通道:
    fb       |      de    |     |     lvds    |     panel
    port  --> port0   port1 -->  port0   port1 -->  port
  2. 配置屏幕参数
    panel_lvds {
        compatible = "artinchip,aic-general-lvds-panel";
        data-mapping = "vesa-24";
        data-channel = "single-link1";
        status = "okay";
    
        enable-gpios = <&gpio_c 7 GPIO_ACTIVE_HIGH>;
        port {
            panel_lvds_in: endpoint {
                remote-endpoint = <&lvds0_out>;
            };
        };
    
        display-timings {
            native-mode = <&timing1>;
            timing1: 1024x600 {
                clock-frequency = <52000000>;
                hactive = <1024>;
                vactive = <600>;
                hback-porch = <160>;
                hfront-porch = <160>;
                hsync-len = <20>;
                vback-porch = <20>;
                vfront-porch = <12>;
                vsync-len = <3>;
                de-active = <1>;
                pixelclk-active = <1>;
            };
        };
    };
  3. 配置引脚

    引脚的配置统一在 d211-pinctrl.dtsi 中完成,在 rgb0 节点中直接进行了引用

    &lvds0 {
        pinctrl-names = "default";
        pinctrl-0 = <&lvds1_pins>;
        status = "okay";
        ......
    }