Patchwork [U-Boot,V3,3/4] lcd: calculate line_length after lcd_ctrl_init()

login
register
mail settings
Submitter Stephen Warren
Date Nov. 8, 2012, 6:38 a.m.
Message ID <1352356713-11538-3-git-send-email-swarren@wwwdotorg.org>
Download mbox | patch
Permalink /patch/197784/
State Changes Requested
Delegated to: Albert ARIBAUD
Headers show

Comments

Stephen Warren - Nov. 8, 2012, 6:38 a.m.
When an LCD driver is actually driving a regular external display, e.g.
an HDMI monitor, the display resolution might not be known until the
display controller has initialized, i.e. during lcd_ctrl_init(). However,
lcd.c calculates lcd_line_length before calling this function, thus
relying on a hard-coded resolution in struct panel_info.

Instead, defer this calculation until after lcd_ctrl_init() has had the
chance to dynamically determine the resolution. This needs to happen
before lcd_clear(), since the value is used there.

grep indicates that no code outside lcd.c uses this lcd_line_length; in
particular, no lcd_ctrl_init() implementations read it.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
--
v3: No change.
---
 common/lcd.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Anatolij Gustschin - Nov. 9, 2012, 8:17 a.m.
On Wed,  7 Nov 2012 23:38:32 -0700
Stephen Warren <swarren@wwwdotorg.org> wrote:

> When an LCD driver is actually driving a regular external display, e.g.
> an HDMI monitor, the display resolution might not be known until the
> display controller has initialized, i.e. during lcd_ctrl_init(). However,
> lcd.c calculates lcd_line_length before calling this function, thus
> relying on a hard-coded resolution in struct panel_info.
> 
> Instead, defer this calculation until after lcd_ctrl_init() has had the
> chance to dynamically determine the resolution. This needs to happen
> before lcd_clear(), since the value is used there.
> 
> grep indicates that no code outside lcd.c uses this lcd_line_length; in
> particular, no lcd_ctrl_init() implementations read it.
> 
> Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
> --
> v3: No change.
> ---
>  common/lcd.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Acked-by: Anatolij Gustschin <agust@denx.de>
Albert ARIBAUD - Nov. 26, 2012, 9:43 p.m.
Hi Stephen,

On Fri, 9 Nov 2012 09:17:21 +0100, Anatolij Gustschin <agust@denx.de>
wrote:

> On Wed,  7 Nov 2012 23:38:32 -0700
> Stephen Warren <swarren@wwwdotorg.org> wrote:
> 
> > When an LCD driver is actually driving a regular external display, e.g.
> > an HDMI monitor, the display resolution might not be known until the
> > display controller has initialized, i.e. during lcd_ctrl_init(). However,
> > lcd.c calculates lcd_line_length before calling this function, thus
> > relying on a hard-coded resolution in struct panel_info.
> > 
> > Instead, defer this calculation until after lcd_ctrl_init() has had the
> > chance to dynamically determine the resolution. This needs to happen
> > before lcd_clear(), since the value is used there.
> > 
> > grep indicates that no code outside lcd.c uses this lcd_line_length; in
> > particular, no lcd_ctrl_init() implementations read it.
> > 
> > Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
> > --
> > v3: No change.
> > ---
> >  common/lcd.c |    3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> Acked-by: Anatolij Gustschin <agust@denx.de>

Sorry, but this one does not apply cleanly any more. Can you fix it, and
make sure 4/4 also applies on u-boot-arm/master? I'll apply all four
patches then.

Amicalement,

Patch

diff --git a/common/lcd.c b/common/lcd.c
index b6be800..1a20f85 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -333,8 +333,6 @@  int drv_lcd_init (void)
 
 	lcd_base = (void *)(gd->fb_base);
 
-	lcd_line_length = (panel_info.vl_col * NBITS (panel_info.vl_bpix)) / 8;
-
 	lcd_init(lcd_base);		/* LCD initialization */
 
 	/* Device initialization */
@@ -416,6 +414,7 @@  static int lcd_init(void *lcdbase)
 	debug("[LCD] Initializing LCD frambuffer at %p\n", lcdbase);
 
 	lcd_ctrl_init(lcdbase);
+	lcd_line_length = (panel_info.vl_col * NBITS(panel_info.vl_bpix)) / 8;
 	lcd_is_enabled = 1;
 	lcd_clear();
 	lcd_enable ();