diff mbox

[U-Boot] lcd: allow overriding lcd_get_size()

Message ID 1383991209-2862-1-git-send-email-agust@denx.de
State Accepted
Delegated to: Anatolij Gustschin
Headers show

Commit Message

Anatolij Gustschin Nov. 9, 2013, 10 a.m. UTC
Remove the redundant lcd_line_length initialisation which
sneaked in when an earlier version of the patch of commit
6d330719 has been rebased.

Some lcd drivers need to setup lcd_line_length not from the
panel_info parameters but by different means. Make the
lcd_get_size() weak to allow setting lcd_line_length in
a driver specific way.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Stephen Warren <swarren@wwwdotorg.org>
---
 common/lcd.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comments

Anatolij Gustschin Nov. 12, 2013, 8:44 a.m. UTC | #1
On Sat,  9 Nov 2013 11:00:09 +0100
Anatolij Gustschin <agust@denx.de> wrote:

> Remove the redundant lcd_line_length initialisation which
> sneaked in when an earlier version of the patch of commit
> 6d330719 has been rebased.
> 
> Some lcd drivers need to setup lcd_line_length not from the
> panel_info parameters but by different means. Make the
> lcd_get_size() weak to allow setting lcd_line_length in
> a driver specific way.
> 
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> Cc: Stephen Warren <swarren@wwwdotorg.org>
> ---
>  common/lcd.c |   10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)

applied to u-boot-video/master, thanks!

Anatolij
diff mbox

Patch

diff --git a/common/lcd.c b/common/lcd.c
index 5dd7948..56bf067 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -386,8 +386,13 @@  static void test_pattern(void)
 /************************************************************************/
 /* ** GENERIC Initialization Routines					*/
 /************************************************************************/
-
-int lcd_get_size(int *line_length)
+/*
+ * With most lcd drivers the line length is set up
+ * by calculating it from panel_info parameters. Some
+ * drivers need to calculate the line length differently,
+ * so make the function weak to allow overriding it.
+ */
+__weak int lcd_get_size(int *line_length)
 {
 	*line_length = (panel_info.vl_col * NBITS(panel_info.vl_bpix)) / 8;
 	return *line_length * panel_info.vl_row;
@@ -495,7 +500,6 @@  static int lcd_init(void *lcdbase)
 	debug("[LCD] Using LCD frambuffer at %p\n", lcd_base);
 
 	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();