显示篇(1)兼容屏mipi(1)

固件支持多款屏,但烧录完毕后仅支持一个屏幕

即该固件虽有兼容屏功能,但是烧录后,判断屏幕A.B.C。如果第一次识别当前屏A,会记录下来A屏相关配置。后面开机只匹配A。

该种做法目的为了加快开机速度,不会每次开机都会识别匹配。

适用场景:同一固件兼容多款产品,后期不会再次换屏。

uboot配置

make menuconfig后选中

Device Drivers > Graphics support 

[*] LCD compatible panel                                                                                                                   
 [*]   record LCD compatible panel

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;


+&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>;
+};

--- a/longan/device/config/chips/a523/configs/pro1/uboot-board.dts
+++ b/longan/device/config/chips/a523/configs/pro1/uboot-board.dts
+&lcd1_2 {
+       lcd_used            = <1>;
+       status              = "okay";
+       lcd_driver_name     = "*";
+       lcd_backlight       = <50>;
+       lcd_if              = <4>;
+
        .......

+       lcd_bl_0_percent        = <10>;
+};

  • 4
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值