From patchwork Tue Nov 6 10:13:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_Bie=C3=9Fmann?= X-Patchwork-Id: 197443 X-Patchwork-Delegate: agust@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id A1DDB2C00B1 for ; Tue, 6 Nov 2012 21:14:31 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2C55C4A54C; Tue, 6 Nov 2012 11:14:26 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bwhO5BfeoIUe; Tue, 6 Nov 2012 11:14:25 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A38C04A109; Tue, 6 Nov 2012 11:14:24 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0D2E74A105 for ; Tue, 6 Nov 2012 11:14:23 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 28xVgbUBcik5 for ; Tue, 6 Nov 2012 11:14:22 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-bk0-f44.google.com (mail-bk0-f44.google.com [209.85.214.44]) by theia.denx.de (Postfix) with ESMTPS id A3CE44A536 for ; Tue, 6 Nov 2012 11:14:20 +0100 (CET) Received: by mail-bk0-f44.google.com with SMTP id jc3so109730bkc.3 for ; Tue, 06 Nov 2012 02:14:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=3q779E9Ip/DYOZXK/CYKRrsGDeDeB4CIztdPIwANSm0=; b=jzdZerYUT2RNPYfeVnPwzxLGomWeYrP7Lvszql36tm0x9ysM6/7LP9/6PDl+hIKs/4 MlkMJuxVUMmsOhLA4qjvt+zGGv15bZZKiPJhFwrdljzbkqBj9GFv9HBhZOibbgvECjNm d20DG3/FHS5UFA97ID2my0/2H9+yJFKDzKnEDXMIPtE9TBbYb0EQoy8tUSG0zlOGUsGM bp9aM6Lb6sL4V/C7mYZ/5zLBdFNdiOw/BoFmNc8RofzQWpegB/tZ7WorhySrI3TV5Z4v nRqegjUTOi8vu81TC9+VHxHiOjkY2g6onDxgZED0mzJLrfQpQ6ft2KfnzGLI4qITraT3 c7vw== Received: by 10.205.134.140 with SMTP id ic12mr114296bkc.140.1352196859991; Tue, 06 Nov 2012 02:14:19 -0800 (PST) Received: from localhost ([2a01:198:47b:1:210:75ff:fe1a:cd1e]) by mx.google.com with ESMTPS id ia2sm11511573bkc.11.2012.11.06.02.14.18 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 06 Nov 2012 02:14:19 -0800 (PST) From: =?UTF-8?q?Andreas=20Bie=C3=9Fmann?= To: u-boot@lists.denx.de Date: Tue, 6 Nov 2012 11:13:49 +0100 Message-Id: <1352196829-27879-3-git-send-email-andreas.devel@googlemail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1352196829-27879-1-git-send-email-andreas.devel@googlemail.com> References: <1351865915-8238-1-git-send-email-andreas.devel@googlemail.com> <1352196829-27879-1-git-send-email-andreas.devel@googlemail.com> MIME-Version: 1.0 Cc: Marek Vasut Subject: [U-Boot] [PATCH v3 2/2] common/lcd: use lcd_setcolreg() to setup CLUT X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de The lcd_setcolreg() is a API provided by the lcd driver and used to setup the color lookup table. However the lcd driver setup the CLUT by using a lot of ifdiffery and accessing the CLUT arrays directly instead. Remove that and use the API. Signed-off-by: Andreas Bießmann Cc: Marek Vasut Cc: Anatolij Gustschin --- since v1: * also use lcd_setcolreg() in lcd_display_bitmap() * remove RFC since v2: * no change common/lcd.c | 79 ++++++++++++---------------------------------------------- 1 file changed, 16 insertions(+), 63 deletions(-) diff --git a/common/lcd.c b/common/lcd.c index b6be800..6835e65 100644 --- a/common/lcd.c +++ b/common/lcd.c @@ -523,11 +523,6 @@ static inline ushort *configuration_get_cmap(void) #ifdef CONFIG_LCD_LOGO void bitmap_plot(int x, int y) { -#ifdef CONFIG_ATMEL_LCD - uint *cmap = (uint *)bmp_logo_palette; -#else - ushort *cmap = (ushort *)bmp_logo_palette; -#endif ushort i, j; uchar *bmap; uchar *fb; @@ -545,44 +540,20 @@ void bitmap_plot(int x, int y) fb = (uchar *)(lcd_base + y * lcd_line_length + x); if (NBITS(panel_info.vl_bpix) < 12) { - /* Leave room for default color map - * default case: generic system with no cmap (most likely 16bpp) - * 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)]); -#elif defined(CONFIG_ATMEL_LCD) - cmap = (uint *)configuration_get_cmap(); -#else - cmap = configuration_get_cmap(); -#endif WATCHDOG_RESET(); /* Set color map */ for (i = 0; i < ARRAY_SIZE(bmp_logo_palette); ++i) { - ushort colreg = bmp_logo_palette[i]; -#ifdef CONFIG_ATMEL_LCD - uint lut_entry; -#ifdef CONFIG_ATMEL_LCD_BGR555 - lut_entry = ((colreg & 0x000F) << 11) | - ((colreg & 0x00F0) << 2) | - ((colreg & 0x0F00) >> 7); -#else /* CONFIG_ATMEL_LCD_RGB565 */ - lut_entry = ((colreg & 0x000F) << 1) | - ((colreg & 0x00F0) << 3) | - ((colreg & 0x0F00) << 4); -#endif - *(cmap + BMP_LOGO_OFFSET) = lut_entry; - cmap++; -#else /* !CONFIG_ATMEL_LCD */ -#ifdef CONFIG_SYS_INVERT_COLORS - *cmap++ = 0xffff - colreg; -#else - *cmap++ = colreg; -#endif -#endif /* CONFIG_ATMEL_LCD */ + /* use the most significant bits here */ + uint8_t red = ((bmp_logo_palette[i] >> 4) & 0xF0); + uint8_t green = ((bmp_logo_palette[i] >> 0) & 0xF0); + uint8_t blue = ((bmp_logo_palette[i] << 4) & 0xF0); + debug("LCD: setup colreg %u with " + "R: 0x%02x G: 0x%02x B: 0x%02x (0x%04x)\n", + i+BMP_LOGO_OFFSET, red, green, blue, bmp_logo_palette[i]); + /* leave room for the default colormap here */ + lcd_setcolreg(i+BMP_LOGO_OFFSET, red, green, blue); } WATCHDOG_RESET(); @@ -667,9 +638,6 @@ static inline void fb_put_word(uchar **fb, uchar **from) int lcd_display_bitmap(ulong bmp_image, int x, int y) { -#if !defined(CONFIG_MCC200) - ushort *cmap = NULL; -#endif ushort *cmap_base = NULL; ushort i, j; uchar *fb; @@ -716,34 +684,18 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) #if !defined(CONFIG_MCC200) /* MCC200 LCD doesn't need CMAP, supports 1bpp b&w only */ if (bmp_bpix == 8) { - cmap = configuration_get_cmap(); - cmap_base = cmap; + cmap_base = configuration_get_cmap(); /* Set color map */ for (i = 0; i < colors; ++i) { bmp_color_table_entry_t cte = bmp->color_table[i]; -#if !defined(CONFIG_ATMEL_LCD) - ushort colreg = - ( ((cte.red) << 8) & 0xf800) | - ( ((cte.green) << 3) & 0x07e0) | - ( ((cte.blue) >> 3) & 0x001f) ; -#ifdef CONFIG_SYS_INVERT_COLORS - *cmap = 0xffff - colreg; -#else - *cmap = colreg; -#endif -#if defined(CONFIG_MPC823) - cmap--; -#else - cmap++; -#endif -#else /* CONFIG_ATMEL_LCD */ + debug("LCD: setup colreg %u with " + "R: 0x%02x G: 0x%02x B: 0x%02x\n", + i, cte.red, cte.green, cte.blue); lcd_setcolreg(i, cte.red, cte.green, cte.blue); -#endif } } -#endif - +#else /* * BMP format for Monochrome assumes that the state of a * pixel is described on a per Bit basis, not per Byte. @@ -754,7 +706,6 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) * their own ways, so make the converting to be MCC200 * specific. */ -#if defined(CONFIG_MCC200) if (bpix == 1) { width = ((width + 7) & ~7) >> 3; x = ((x + 7) & ~7) >> 3; @@ -786,6 +737,8 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) else byte_width = width * 2; + debug("LCD: draw %i b/pix image on %i b/pix display\n", bmp_bpix, bpix); + for (i = 0; i < height; ++i) { WATCHDOG_RESET(); for (j = 0; j < width; j++) {