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

From: Giulio Benetti giulio.benetti@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@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));

Hi,
On Mon, Jan 11, 2021 at 10:13:32AM +0100, Giulio Benetti wrote:
From: Giulio Benetti giulio.benetti@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@micronovasrl.com
What's different from the video= parameter that already exists (and should work like you suggest)?
Maxime

On 1/11/21 10:48 AM, Maxime Ripard wrote:
Hi,
On Mon, Jan 11, 2021 at 10:13:32AM +0100, Giulio Benetti wrote:
From: Giulio Benetti giulio.benetti@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@micronovasrl.com
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
participants (2)
-
Giulio Benetti
-
Maxime Ripard