[PATCH] sunxi: display: introduce "sunxi-video" environment variable

Giulio Benetti giulio.benetti at benettiengineering.com
Mon Jan 11 10:13:32 CET 2021


From: Giulio Benetti <giulio.benetti at micronovasrl.com>

At the moment you can specify lcd_mode only through hardcoded
CONFIG_VIDEO_LCD_MODE but this way, if you have a board with multiple lcds
compatible, you have to rebuild u-boot for every single lcd, so let's add
sunxi-video environment variable to give the possibility to specify lcd
settings at runtime. It's mandatory to "saveenv" after setting sunxi-video
variable and then "reset" since sunxi_display driver apply those settings
only on startup.

Signed-off-by: Giulio Benetti <giulio.benetti at micronovasrl.com>
---
 drivers/video/sunxi/sunxi_display.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/video/sunxi/sunxi_display.c b/drivers/video/sunxi/sunxi_display.c
index f52aba4d21..99bafc544a 100644
--- a/drivers/video/sunxi/sunxi_display.c
+++ b/drivers/video/sunxi/sunxi_display.c
@@ -1017,6 +1017,10 @@ static bool sunxi_has_lcd(void)
 {
 	char *lcd_mode = CONFIG_VIDEO_LCD_MODE;
 
+	lcd_mode = env_get("sunxi-video");
+	if(lcd_mode == NULL)
+		lcd_mode = CONFIG_VIDEO_LCD_MODE;
+
 	return lcd_mode[0] != 0;
 }
 
@@ -1065,7 +1069,11 @@ void *video_hw_init(void)
 	int i, overscan_offset, overscan_x, overscan_y;
 	unsigned int fb_dma_addr;
 	char mon[16];
-	char *lcd_mode = CONFIG_VIDEO_LCD_MODE;
+	char *lcd_mode;
+
+	lcd_mode = env_get("sunxi-video");
+	if(lcd_mode == NULL)
+		lcd_mode = CONFIG_VIDEO_LCD_MODE;
 
 	memset(&sunxi_display, 0, sizeof(struct sunxi_display));
 
-- 
2.25.1



More information about the U-Boot mailing list