lcd: calculate line_length after lcd_ctrl_init()
authorStephen Warren <swarren@wwwdotorg.org>
Tue, 29 Jan 2013 16:37:38 +0000 (16:37 +0000)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Wed, 20 Mar 2013 14:29:39 +0000 (15:29 +0100)
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>
Acked-by: Anatolij Gustschin <agust@denx.de>
common/lcd.c

index 590bbb9301fd7c9e456dd355ab30af005da5ee6b..77914adbce558aca4a67607dcd3292519cf02275 100644 (file)
@@ -386,8 +386,6 @@ int drv_lcd_init (void)
 
        lcd_base = (void *)(gd->fb_base);
 
-       lcd_get_size(&lcd_line_length);
-
        lcd_init(lcd_base);             /* LCD initialization */
 
        /* Device initialization */
@@ -470,6 +468,8 @@ static int lcd_init(void *lcdbase)
        debug("[LCD] Initializing LCD frambuffer at %p\n", lcdbase);
 
        lcd_ctrl_init(lcdbase);
+       lcd_get_size(&lcd_line_length);
+       lcd_line_length = (panel_info.vl_col * NBITS(panel_info.vl_bpix)) / 8;
        lcd_is_enabled = 1;
        lcd_clear();
        lcd_enable ();