MIPI
4 Dec 2024
Read time: 4 minute(s)
每一款 MIPI 屏都需要一个独立的驱动程序,因此调试 MIPI 屏时,不仅需要在 DTS 中设置参数,还需要在 kernel 和 uboot 中添加屏幕所对应的驱动:
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 panel driver for B080XAN) --->
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 panel driver for B080XAN) --->
uboot dts
uboot 如果要进行显示,则声明相应的配置为预加载,以 demo88_nand 工程为例,文件为 target/d211/demo88_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;
};
};
};
&dsi0 { //mipi dsi
u-boot,dm-pre-reloc;
port@0 {
dsi0_in: endpoint {
u-boot,dm-pre-reloc;
};
};
port@1 {
dsi0_out: endpoint {
u-boot,dm-pre-reloc;
};
};
};
声明屏幕参数panel_dsi {
u-boot,dm-pre-reloc;
port {
panel_dsi_in: endpoint {
u-boot,dm-pre-reloc;
};
};
};
声明屏幕引脚dsi_pins: dsi-0 {
u-boot,dm-pre-reloc;
pins {
u-boot,dm-pre-reloc;
};
};
系统 dts
系统的 dts 将进行完整的功能配置,以 demo128_nand 工程为例,文件为
target/d211/demo128_nand/board.dts 中
- 配置通路通过 port 和 status 结点,定义了一条数据通道
fb | de | | mipi | panel port --> port0 port1 --> port0 port1 --> port
&fb0 { port { fb0_out: endpoint { remote-endpoint = <&de0_in>; }; }; }; &de0 { status = "okay"; port@0 { reg = <0>; de0_in: endpoint { remote-endpoint = <&fb0_out>; }; }; port@1 { reg = <1>; de0_out: endpoint { remote-endpoint = <&dsi0_in>; //mipi dsi }; }; }; &dsi0 { pinctrl-names = "default"; pinctrl-0 = <&dsi_pins>; status = "okay"; data-clk-inverse; port@0 { reg = <0>; dsi0_in: endpoint { remote-endpoint = <&de0_out>; }; }; port@1 { reg = <1>; dsi0_out: endpoint { remote-endpoint = <&panel_dsi_in>; }; }; };
- 配置屏幕参数
panel_dsi { compatible = "artinchip,aic-dsi-panel-simple"; status = "okay"; enable-gpios = <&gpio_c 6 GPIO_ACTIVE_HIGH>; port { panel_dsi_in: endpoint { remote-endpoint = <&dsi0_out>; }; }; };
- 配置引脚
引脚的配置统一在 d211-pinctrl.dtsi 中完成,在 rgb0 节点中直接进行了引用
&dsi0 { pinctrl-names = "default"; pinctrl-0 = <&dsi_pins>; status = "okay"; ...... }