All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikita Kiryanov <nikita@compulab.co.il>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V2 06/13] lcd: mpc823: move mpc823-specific lcd_logo_set_cmap code to mpc8xx_lcd.c
Date: Tue,  3 Feb 2015 13:32:25 +0200	[thread overview]
Message-ID: <1422963152-17634-7-git-send-email-nikita@compulab.co.il> (raw)
In-Reply-To: <1422963152-17634-1-git-send-email-nikita@compulab.co.il>

Reduce the bitmap_plot #ifdef complexity by extracting MPC823-specific code for
setting cmap into its own implementation of lcd_logo_set_cmap(), implemented in
mpc8xx_lcd.c. In the MPC823 implementation, ARRAY_SIZE(bmp_logo_palette) is
switched for BMP_LOGO_COLORS to avoid having to include bmp_logo_data.h, which
would cause a compilation error because the logo data and palette arrays would
be defined twice.

This is a step towards cleaning bitmap_plot() of platform-specific code.

Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
Reviewed-by: Simon Glass <sjg@chromium.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Anatolij Gustschin <agust@denx.de>
---
Changes in V2:
	- Minor commit message update

 common/lcd.c               | 10 +---------
 drivers/video/mpc8xx_lcd.c | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/common/lcd.c b/common/lcd.c
index 7fcac1d..355c144 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -396,10 +396,6 @@ void bitmap_plot(int x, int y)
 	uchar *bmap;
 	uchar *fb;
 	ushort *fb16;
-#if defined(CONFIG_MPC823)
-	immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
-	cpm8xx_t *cp = &(immr->im_cpm);
-#endif
 	unsigned bpix = NBITS(panel_info.vl_bpix);
 
 	debug("Logo: width %d  height %d  colors %d  cmap %d\n",
@@ -415,16 +411,12 @@ void bitmap_plot(int x, int y)
 		 * cmap was set to the source palette, so no change is done.
 		 * This avoids even more ifdefs in the next stanza
 		 */
-#if defined(CONFIG_MPC823)
-		cmap = (ushort *) &(cp->lcd_cmap[BMP_LOGO_OFFSET * sizeof(ushort)]);
-#else
 		cmap = configuration_get_cmap();
-#endif
 
 		WATCHDOG_RESET();
 
 		/* Set color map */
-#ifdef CONFIG_ATMEL_LCD
+#if defined(CONFIG_ATMEL_LCD) || defined(CONFIG_MPC823)
 		lcd_logo_set_cmap();
 #else
 		for (i = 0; i < ARRAY_SIZE(bmp_logo_palette); ++i) {
diff --git a/drivers/video/mpc8xx_lcd.c b/drivers/video/mpc8xx_lcd.c
index 190c05a..faa58c0 100644
--- a/drivers/video/mpc8xx_lcd.c
+++ b/drivers/video/mpc8xx_lcd.c
@@ -371,6 +371,21 @@ void fb_put_byte(uchar **fb, uchar **from)
 }
 #endif
 
+#ifdef CONFIG_LCD_LOGO
+#include <bmp_logo.h>
+void lcd_logo_set_cmap(void)
+{
+	int i;
+	ushort *cmap;
+	immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
+	cpm8xx_t *cp = &(immr->im_cpm);
+	cmap = (ushort *)&(cp->lcd_cmap[BMP_LOGO_OFFSET * sizeof(ushort)]);
+
+	for (i = 0; i < BMP_LOGO_COLORS; ++i)
+		*cmap++ = bmp_logo_palette[i];
+}
+#endif
+
 void lcd_enable (void)
 {
 	volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
-- 
1.9.1

  parent reply	other threads:[~2015-02-03 11:32 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-03 11:32 [U-Boot] [PATCH V2 00/13] common lcd refactor Nikita Kiryanov
2015-02-03 11:32 ` [U-Boot] [PATCH V2 01/13] lcd: move platform-specific structs to their own headers Nikita Kiryanov
2015-02-04  6:48   ` Bo Shen
2015-02-03 11:32 ` [U-Boot] [PATCH V2 02/13] lcd: split configuration_get_cmap Nikita Kiryanov
2015-02-04  7:25   ` Bo Shen
2015-02-08 11:35     ` Nikita Kiryanov
2015-02-09  3:43       ` Bo Shen
2015-02-03 11:32 ` [U-Boot] [PATCH V2 03/13] lcd: atmel: move atmel-specific fb_put_word to atmel_lcdfb Nikita Kiryanov
2015-02-04  7:26   ` Bo Shen
2015-02-03 11:32 ` [U-Boot] [PATCH V2 04/13] lcd: mpc8xx: move mpc823-specific fb_put_byte to mpc8xx_lcd.c Nikita Kiryanov
2015-02-03 11:32 ` [U-Boot] [PATCH V2 05/13] lcd: atmel: introduce lcd_logo_set_cmap Nikita Kiryanov
2015-02-03 11:32 ` Nikita Kiryanov [this message]
2015-02-03 11:32 ` [U-Boot] [PATCH V2 07/13] lcd: logo: move generic cmap setting to lcd_logo_set_cmap() Nikita Kiryanov
2015-02-03 11:32 ` [U-Boot] [PATCH V2 08/13] lcd: introduce lcd_set_cmap Nikita Kiryanov
2015-02-03 11:32 ` [U-Boot] [PATCH V2 09/13] lcd: remove unused includes Nikita Kiryanov
2015-02-03 11:32 ` [U-Boot] [PATCH V2 10/13] lcd: various cleanups Nikita Kiryanov
2015-02-03 11:32 ` [U-Boot] [PATCH V2 11/13] lcd: rename bitmap_plot to better represent its functionality Nikita Kiryanov
2015-02-03 11:32 ` [U-Boot] [PATCH V2 12/13] lcd: dt: extract simplefb support Nikita Kiryanov
2015-02-03 11:32 ` [U-Boot] [PATCH V2 13/13] lcd: split splash code into its own function Nikita Kiryanov
2015-02-04  2:37 ` [U-Boot] [PATCH V2 00/13] common lcd refactor Josh Wu
2015-02-04  8:03 ` Bo Shen
2015-02-10 12:43 ` Anatolij Gustschin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1422963152-17634-7-git-send-email-nikita@compulab.co.il \
    --to=nikita@compulab.co.il \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.