public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] sunxi: display: introduce "sunxi-video" environment variable
@ 2021-01-11  9:13 Giulio Benetti
  2021-01-11  9:48 ` Maxime Ripard
  0 siblings, 1 reply; 3+ messages in thread
From: Giulio Benetti @ 2021-01-11  9:13 UTC (permalink / raw)
  To: u-boot

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));
 
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] sunxi: display: introduce "sunxi-video" environment variable
  2021-01-11  9:13 [PATCH] sunxi: display: introduce "sunxi-video" environment variable Giulio Benetti
@ 2021-01-11  9:48 ` Maxime Ripard
  2021-01-11 10:34   ` Giulio Benetti
  0 siblings, 1 reply; 3+ messages in thread
From: Maxime Ripard @ 2021-01-11  9:48 UTC (permalink / raw)
  To: u-boot

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
-------------- 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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] sunxi: display: introduce "sunxi-video" environment variable
  2021-01-11  9:48 ` Maxime Ripard
@ 2021-01-11 10:34   ` Giulio Benetti
  0 siblings, 0 replies; 3+ messages in thread
From: Giulio Benetti @ 2021-01-11 10:34 UTC (permalink / raw)
  To: u-boot

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
-- 
Giulio Benetti
Benetti Engineering sas

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-11 10:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-11  9:13 [PATCH] sunxi: display: introduce "sunxi-video" environment variable Giulio Benetti
2021-01-11  9:48 ` Maxime Ripard
2021-01-11 10:34   ` Giulio Benetti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox