点亮Openharmony的mipi屏幕

发布于 2024-08-12  545 次阅读


01_修改的目标文件

/oh/out/kernel/src_tmp/linux-5.10/arch/arm64/boot/dts/rockchip/rk3568-toybrick-mipi-tx0-beiqicloud.dtsi

修改资料来源: 【北京迅为】itop-rk3568开发板官方android11移植教程.pdf (第245行)

02_修改的具体内容

1.显示配置修改

[1]修改位置

第58行

[2]添加屏幕reset引脚
//reset-gpios 表示屏幕 reset 引脚,拉低,具体的拉高或者拉低 要根据内核配置和时序要求来进行对应的修改
reset-gpios = <&gpio3 RK_PC7 GPIO_ACTIVE_LOW>; 
//enable-gpios = <&gpio3 RK_PC6 GPIO_ACTIVE_HIGH>;
[3]添加和修改延时
//reset-delay-ms 是在屏幕初始化过程中,第一次操作 reset 引脚之前的延时。init-delay-ms,是在屏幕初始化过程中,第一次操作 reset 引脚之后的延时。
reset-delay-ms = <60>;
enable-delay-ms = <60>;//<35>; //<60>;
prepare-delay-ms = <60>;//<6>; //<60>;
unprepare-delay-ms = <60>;//<0>; //<60>;
disable-delay-ms = <60>;//<20>; //<60>;
dsi,flags = <(MIPI_DSI_MODE_VIDEO |
MIPI_DSI_MODE_VIDEO_BURST | MIPI_DSI_MODE_LPM |
MIPI_DSI_MODE_EOT_PACKET)>;
dsi,format = <MIPI_DSI_FMT_RGB888>;
//dsi,lanes = <4>;是配置当前 mipi 是几通道的,需根据屏幕实际情况配置。
dsi,lanes = <4>;

和文件重合的部分修改,没有的添加

[4]修改初始化序列
panel-init-sequence = [
39 00 03 E0 AB BA
39 00 03 E1 BA AB
15 00 02 B0 00
39 00 05 B1 10 01 47 FF
39 00 07 B2 0C 0E 04 14 14 14
39 00 04 B3 56 D3 00
39 00 04 B4 22 30 04
15 00 02 B5 00
39 00 08 B6 B0 00 00 10 00 10 00
39 00 09 B7 0E 00 FF 08 08 FF FF 00
39 00 08 B8 05 12 29 49 48 00 00
39 00 27 B9 4D 42 38 31 33 27 2F 1B 36 35 35 53 41 49 3D 3D 33 29 26 4C 42 39 31 33 27 2F 1B 36 35 35 53 41 49 3D 3D 33 29 26
39 00 09 BA 00 00 00 44 24 00 00 00
39 00 04 BB 76 00 00
39 00 03 BC 00 00
39 00 06 BD FF 00 00 00 00
15 00 02 BE 00
39 00 11 C0 98 76 12 34 33 33 44 44 06 04 8A 04 0F 00 00 00
39 00 0B C1 53 94 02 85 06 04 8A 04 54 00
39 00 0D C2 37 09 08 89 08 10 22 21 44 BB 18 00
39 00 17 C3 9C 1D 1E 1F 10 12 0C 0E 05 24 24 24 24 24 24 07 24 24 24 24 24 24
39 00 17 C4 1C 1D 1E 1F 11 13 0D 0F 04 24 24 24 24 24 24 06 24 24 24 24 24 24
39 00 04 C5 E8 85 76
39 00 03 C6 20 20
39 00 17 C7 41 01 0D 11 09 15 19 4F 10 D7 CF 19 1B 1D 03 02 25 30 00 03 FF 00
39 00 07 C8 61 00 31 42 54 16
39 00 06 C9 A1 22 FF Cd 23
39 00 03 CA 4B 43
39 00 05 CC 2E 02 04 08
39 00 09 CD 0E 64 64 20 1E 6B 06 83
39 00 04 D0 27 10 80
39 00 05 D1 00 0D FF 0F
39 00 05 D2 E3 2B 38 00
39 00 0C D4 00 01 00 0E 04 44 08 10 00 07 00
15 00 02 D5 00
39 00 03 D6 00 00
39 00 05 D7 00 00 00 00
39 00 04 E4 08 55 03
39 00 09 E6 00 01 FF FF FF FF FF FF
39 00 04 E7 00 00 00
39 00 08 E8 D5 FF FF FF 00 00 00
15 00 02 E9 FF
39 00 06 F0 12 03 20 00 FF
39 00 1B F1 A6 C8 EA E6 E4 CC E4 BE F0 B2 AA C7 FF 66 98 E3 87 C8 99 C8 8C BE 96 91 8F FF
15 00 02 F3 03
39 00 1B F4 FF FE FC FA F8 F4 F0 E8 E0 D0 C0 A0 80 7F 5F 3F 2F 1F 17 0F 0B 07 05 03 01 00
39 00 1B F5 FF FE FC FA F8 F4 F0 E8 E0 D0 C0 A0 80 7F 5F 3F 2F 1F 17 0F 0B 07 05 03 01 00
39 00 1B F6 FF FE FC FA F8 F4 F0 E8 E0 D0 C0 A0 80 7F 5F 3F 2F 1F 17 0F 0B 07 05 03 01 00
39 00 08 F7 00 00 00 00 00 00 00
39 00 08 F8 00 00 00 00 00 00 00
39 00 08 F9 00 00 00 00 00 00 00
39 00 1A FA 00 84 12 21 48 48 21 12 84 69 69 5A A5 96 96 A5 5A B7 DE ED 7B 7B ED DE B7
39 00 18 FB 00 12 0F FF FF FF 00 38 40 08 70 0B 40 19 50 21 C0 27 60 2D 00 00 0F
39 00 03 E3 20 21
05 C8 01 11
05 14 01 29
];

直接替换文件中的77行

[5]退出序列
panel-exit-sequence = [
05 05 01 28
05 78 01 10
];
[6]修改屏参(276行)

改为:

disp_timings0: display-timings {
native-mode = <&dsi1_timing0>;
dsi1_timing0: timing0 {
//clock-frequency 像素时钟频率
//像素时钟频率 = (hactive+hbp+hfp+hsync-len)x(vactive+vbp+vfp+vsync-len)xfps
// 然后保留两位有效数字(不要四舍五入),后面数据直接填 0 即可。
clock-frequency = <72000000>;
//以下的这些参数在数据手册中
hactive = <800>;
vactive = <1280>;
hfront-porch = <48>; //20
hsync-len = <20>;
hback-porch = <48>; //20
vfront-porch = <16>; //10
vsync-len = <6>; //10
vback-porch = <15>; //4
hsync-active = <0>;
vsync-active = <0>;
de-active = <0>;
pixelclk-active = <0>;
};
[7]配置ports
    //配置 ports
    ports {
        #address-cells = <1>;
        #size-cells = <0>;
        port@0 {
            reg = <0>;
            panel_in_dsi1: endpoint {
                remote-endpoint =
                <&dsi1_out_panel>;
                };
            };
        };
    };
    ports {
        #address-cells = <1>;
        #size-cells = <0>;
        port@1 {
            reg = <1>;
            dsi1_out_panel: endpoint {
                 remote-endpoint = <&panel_in_dsi1>;
            };
        };
    };
};

我们使用 dsi1 绑定到 vp1 上,所以 dsi1_in_vp0 节点为 disabled,dsi1_in_vp1 节 点为 okay 当 dsi1 使 能 的 时 候 , video_phy1 要 使 能 , video_phy0 要 关 闭 。 设 备 树 topeet_rk3568_lcds.dtsi 中添加如下图所示

&dsil_in_vp0 {
    status = "disabled";
};

&dsil_in_vp1 {
    status = "okay";
};

&video_phy1 {
    status = "okay";
};

&video_phy0 {
    status = "disabled";
};
[8]修改LCD屏幕供电(378行)
 &vcc3v3_lcd0_n {
-   gpio = <&gpio0 RK_PC7 GPIO_ACTIVE_HIGH>;
+   gpio = <&gpio0 RK_PC7 GPIO_ACTIVE_HIGH>;
    enable-active-high;
 };
[9]修改引脚控制器(389行)
 &pinctrl {
    mipi_pwren {
        mipi_power_en: mipi_power_en {
-           rockchip,pins = <3 RK_PB5 RK_FUNC_GPIO &pcfg_output_high>;
+           rockchip,pins = <1 RK_PA2 1 &pcfg_pull_none>;
        };
    };
 };

QQ_1723429493901.png

数据来源

/oh/rk3568_linux_5.10/kernel/arch/arm64/boot/dts/rockchip/rk3568-pinctrl.dtsi


踏上取经路,比抵达灵山更重要