Skip to contentSkip to conversation

sunxi: display: introduce "sunxi-video" environment variable

PATCH New Giulio Benetti 2 participants 3 messages Jan 11, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sunxi: display: introduce "sunxi-video" environment variable

From: Giulio Benetti <[email protected]>

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.

---
 drivers/video/sunxi/sunxi_display.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/video/sunxi/sunxi_display.c +9 -1
index f52aba4d21..99bafc544a 100644
@@ -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));
 
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/1 sunxi: display: introduce "sunxi-video" environment variable

Hi,

Quoted 11 lines · Giulio Benetti

From: Giulio Benetti <[email protected]>

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.

What's different from the video= parameter that already exists (and should work like you suggest)?

Maxime
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210111/5cd5efdd/attachment.sig>

#2 lore raw

PATCH 1/1 sunxi: display: introduce "sunxi-video" environment variable

Quoted 13 lines · Maxime Ripard

Hi,

Quoted 10 lines · Giulio Benetti

From: Giulio Benetti <[email protected]>

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.

Quoted 4 lines
Quoted 1 line

What's different from the video= parameter that already exists (and should work like you suggest)?

My bad, don't even know why I haven't noticed it.

So please drop this patch.

Thank you
Best regards

Signature · 2 lines
Giulio Benetti
Benetti Engineering sas