本文主要是介绍显示篇(1)兼容屏mipi(1),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
固件支持多款屏,但烧录完毕后仅支持一个屏幕
即该固件虽有兼容屏功能,但是烧录后,判断屏幕A.B.C。如果第一次识别当前屏A,会记录下来A屏相关配置。后面开机只匹配A。
该种做法目的为了加快开机速度,不会每次开机都会识别匹配。
适用场景:同一固件兼容多款产品,后期不会再次换屏。
uboot补丁
diff --git a/drivers/video/sunxi/disp2/disp/de/disp_lcd.c b/drivers/video/sunxi/disp2/disp/de/disp_lcd.c
--- a/drivers/video/sunxi/disp2/disp/de/disp_lcd.c
+++ b/drivers/video/sunxi/disp2/disp/de/disp_lcd.c
@@ -3085,15 +3085,12 @@ s32 disp_init_lcd(disp_bsp_init_para * para)}#ifdef CONFIG_COMPATIBLE_PANEL
- g_compat_index = disp_get_set_lcd_param_index_from_flash(READ, &g_disp_index, 0);
- if (g_compat_index < 0) {
- g_compat_index = 0;
- for (i = 0; i < num_devices_support_lcd; i++) {
- int num = disp_get_compat_lcd_panel_num(i);
- num_compat += num;
- g_lcd_compat_msg[i][0] = i;
- g_lcd_compat_msg[i][1] = num;
- }
+ g_compat_index = 0;
+ for (i = 0; i < num_devices_support_lcd; i++) {
+ int num = disp_get_compat_lcd_panel_num(i);
+ num_compat += num;
+ g_lcd_compat_msg[i][0] = i;
+ g_lcd_compat_msg[i][1] = num;}if (num_compat > 0) {
diff --git a/drivers/video/sunxi/disp2/disp/disp_sys_intf.c b/drivers/video/sunxi/disp2/disp/disp_sys_intf.c
--- a/drivers/video/sunxi/disp2/disp/disp_sys_intf.c
+++ b/drivers/video/sunxi/disp2/disp/disp_sys_intf.c
@@ -483,21 +483,13 @@ int disp_update_lcd_param(int disp, int lcd_param_index, int is_set_index)unsigned int retry_skip_count = 0;u8 prop_tmp[32] = {0};u8 prop_name_tmp[32] = {0};
- int flash_idx = 0;char lcd_node_pre[32] = "/soc/lcd0";if (is_set_index == 0) {#ifdef CONFIG_COMPATIBLE_PANEL
- int disp_tmp = 0;
+ lcd_param_index = to_update_lcd_compat_index;- flash_idx = disp_get_set_lcd_param_index_from_flash(READ, &disp_tmp, 0);
- if (flash_idx == -1) { // first start.
- disp_get_set_lcd_param_index_from_flash(WRITE, &disp, to_update_lcd_compat_index);
- flash_idx = disp_get_set_lcd_param_index_from_flash(READ, &disp_tmp, 0);
- }
- lcd_param_index = flash_idx;
-
- disp = disp_tmp;
+ disp = to_update_disp_num;/*if not using compatible panel, following operation is useless and wasting time, so just return.*/if (disp_get_compat_lcd_panel_num(disp) == 0) {return 0;
@@ -513,7 +505,7 @@ int disp_update_lcd_param(int disp, int lcd_param_index, int is_set_index)snprintf(val, 2, "%d", lcd_param_index);fdt_find_and_setprop(working_fdt, ctp_path, "ctp_fw_idx", val, 2, 1);#else
- flash_idx = 0;
+ int flash_idx = 0;lcd_param_index = flash_idx;#endif} else if (is_set_index == 1) {
dts配置修改,以lcd1为例
--- a/longan/bsp/configs/linux-5.15/sun55iw3p1.dtsi
+++ b/longan/bsp/configs/linux-5.15/sun55iw3p1.dtsi
@@ -1482,7 +1482,12 @@reg = <0x0 0x1c0c000 0x0 0x0>;pinctrl-names = "active","sleep";};
-
+ lcd1_2: lcd1_2@1c0c000 {
+ compatible = "allwinner,sunxi-lcd1_2";
+ /* Fake registers to avoid dtc compiling warnings */
+ reg = <0x0 0x1c0c000 0x0 0x0>;
+ pinctrl-names = "active","sleep";
+ };--- a/longan/device/config/chips/a523/configs/pro1/linux-5.15/board.dts
+++ b/longan/device/config/chips/a523/configs/pro1/linux-5.15/board.dts
@@ -13,7 +13,7 @@pmu0 = &pmu0;axp1530 = &axp1530;serial0 = &uart0;
- lcd1 = &lcd1;
+ lcd1 = &lcd1,&lcd1_2;+#if 1
+&lcd1_2 {
+ lcd_used = <1>;
+ status = "okay";
+ lcd_driver_name = "*";
+ lcd_backlight = <50>;
+ lcd_if = <4>;
+.......
+
+ lcd_gpio_0 = <&pio PD 22 GPIO_ACTIVE_HIGH>; //reset
+
+ pinctrl-0 = <&dsi1_4lane_pins_a>;
+ pinctrl-1 = <&dsi1_4lane_pins_b>;
+
+ lcd_bl_en = <&pio PH 18 GPIO_ACTIVE_HIGH>;
+ lcd_bl_0_percent = <10>;
+};
+#endif
这篇关于显示篇(1)兼容屏mipi(1)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!