From patchwork Wed Jan 16 02:26:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [U-Boot, V5, REPOST, 3/7] lcd: calculate line_length after lcd_ctrl_init() From: Stephen Warren X-Patchwork-Id: 212378 Message-Id: <1358303219-17503-3-git-send-email-swarren@wwwdotorg.org> To: Albert Aribaud Cc: u-boot@lists.denx.de, linux-rpi-kernel@lists.infradead.org Date: Tue, 15 Jan 2013 19:26:55 -0700 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 Acked-by: Anatolij Gustschin --- v5: No change; merged patch series. v4: Adjusted to addition of lcd_get_size() function. Rebased. v3: No change. --- common/lcd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/lcd.c b/common/lcd.c index 66d4f94..9fa4e5c 100644 --- a/common/lcd.c +++ b/common/lcd.c @@ -384,8 +384,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 */ @@ -468,6 +466,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 ();