From patchwork Fri Oct 26 11:23:14 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: 194441 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 011652C0093 for ; Fri, 26 Oct 2012 22:23:44 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8B93D4A4F2; Fri, 26 Oct 2012 13:23:43 +0200 (CEST) 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 dxKPvX8gfqWZ; Fri, 26 Oct 2012 13:23:43 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AD0EC4A4E6; Fri, 26 Oct 2012 13:23:41 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0FE654A4E6 for ; Fri, 26 Oct 2012 13:23:39 +0200 (CEST) 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 w8O5v2-b6DGG for ; Fri, 26 Oct 2012 13:23:35 +0200 (CEST) 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 AED114A48A for ; Fri, 26 Oct 2012 13:23:34 +0200 (CEST) Received: by mail-bk0-f44.google.com with SMTP id jc3so1127827bkc.3 for ; Fri, 26 Oct 2012 04:23:33 -0700 (PDT) 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:mime-version :content-type:content-transfer-encoding; bh=FSrI7Ltne7GUe+LD1Dkco2tV26NGsVV8qP+a7aAC73U=; b=Tf2dR5tb4xtut5Bpj8aN0rNuVMqOQwZuYCzHbjpdoTwnAdkuR1EjaEYTMnaXzp9TiG 1SVGeEFcG2auXCY8t4CyAQL3/UI9sEbprR4lREcMFvw2agRMCTPeNIBMfkn6YZuwq88W 9omvPMkCPGBkf4TK+iu+yZYiquhmi/nv8FBDbw8kgEybQZ9jP5bWAAK8tCb5Tix/l0Pj SRCQiLu2sGG1Bnj90dC00ZyA7lnB2g5hq/ttQcFEl/ypSNwjF1ZOZVzszl/Y85hDCKae tObxA16FSDy66FIB2x/MOFo0lN6E+/EbxFUbO80tduN4jzVRphtEUCf/U3uDpuLbrYPd L8ew== Received: by 10.204.149.2 with SMTP id r2mr7111424bkv.0.1351250612994; Fri, 26 Oct 2012 04:23:32 -0700 (PDT) Received: from localhost ([2a01:198:47b:1:210:75ff:fe1a:cd1e]) by mx.google.com with ESMTPS id g8sm737285bkv.6.2012.10.26.04.23.31 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 26 Oct 2012 04:23:32 -0700 (PDT) From: =?UTF-8?q?Andreas=20Bie=C3=9Fmann?= To: u-boot@lists.denx.de Date: Fri, 26 Oct 2012 13:23:14 +0200 Message-Id: <1351250594-5397-1-git-send-email-andreas.devel@googlemail.com> X-Mailer: git-send-email 1.7.10.4 MIME-Version: 1.0 Cc: Marek Vasut , Tom Rini , Bo Shen Subject: [U-Boot] [RFC] common/lcd: use lcd_setcolreg() in bitmap_plot 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 which are cleanly hidden by the API call. Remove that and use the API. Signed-off-by: Andreas Bießmann Cc: Marek Vasut Cc: Bo Shen Cc: Tom Rini Tested-by: Bo Shen --- This is a RFC currently cause it touches a lot of boards but is only runtime tested on at91sam9263ek. Unfortunately a 'MAKEALL -a arm' does break cause the atmel_hlcd driver do not provide the required API (lcd_setcolreg()) -> Bo, can you please fix this, I do not have an atmel_hlcdc enabled device. On the other hand this change also touches other architectures I can not test. This patch is actually only compile tested for arm and avr32 arches. And last I have to say that there is another position in this file where the CLUT is modified directly by the code. This should also be changed to use the lcd_setcolreg API. This patch shall superseed http://patchwork.ozlabs.org/patch/193466/ common/lcd.c | 47 +++++++++-------------------------------------- 1 file changed, 9 insertions(+), 38 deletions(-) diff --git a/common/lcd.c b/common/lcd.c index b6be800..4938381 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();