From patchwork Mon Dec 10 12:28:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 1857901 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 9C9D2DFB79 for ; Mon, 10 Dec 2012 12:29:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752612Ab2LJM36 (ORCPT ); Mon, 10 Dec 2012 07:29:58 -0500 Received: from mail-lb0-f174.google.com ([209.85.217.174]:60016 "EHLO mail-lb0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752588Ab2LJM36 (ORCPT ); Mon, 10 Dec 2012 07:29:58 -0500 Received: by mail-lb0-f174.google.com with SMTP id gi11so1927392lbb.19 for ; Mon, 10 Dec 2012 04:29:57 -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; bh=bYJS8iRuYz31Bw7I3MLJ7FptX4PIzphNEU2ZV8e/RPI=; b=eTRdYN7uAYr9cG7o6LdkTcHdTRWIqlY/zc/7engfx2dRJuWfKgLRxYyTjG/LA/pWhv uXJma8Ma+a9PIOy77aR36UL1D4pF5D8YT7n6rO/sWKT3nuP4RwYcEixCCwzRv4jq+x/z KKtIyMUm4jJIbhAD0Kn0yAx6nV0XbFKdAvYcWm4hKOzVRFHE/bkzrUn3wTA3orE7qImw mJzHTbpql1H0qniiKTW7P3R2GlInS4yx2KFuLaXygW9XcAfDGMPECR6NHqLr/dOfcJ8i wJhnIH/6ght82WfBdtAfhW6JjdjwANXFSNkdCZy+WO39N2XhGmZ83DyKueWCT23xL5qJ opQw== Received: by 10.152.103.99 with SMTP id fv3mr9566984lab.16.1355142597242; Mon, 10 Dec 2012 04:29:57 -0800 (PST) Received: from xi.lan (s83-177-171-79.cust.tele2.se. [83.177.171.79]) by mx.google.com with ESMTPS id u9sm7808054lbf.5.2012.12.10.04.29.55 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 10 Dec 2012 04:29:56 -0800 (PST) Received: from johan by xi.lan with local (Exim 4.80.1) (envelope-from ) id 1Ti2Tk-0002ih-8Y; Mon, 10 Dec 2012 13:29:00 +0100 From: Johan Hovold To: Florian Tobias Schandinat Cc: Andrew Victor , Nicolas Ferre , Jean-Christophe Plagniol-Villard , linux-arm-kernel@lists.infradead.org, linux-fbdev@vger.kernel.org, Peter Korsgaard , Johan Hovold , Subject: [PATCH 1/3] atmel_lcdfb: fix 16-bpp modes on older SOCs Date: Mon, 10 Dec 2012 13:28:48 +0100 Message-Id: <1355142530-10366-2-git-send-email-jhovold@gmail.com> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1355142530-10366-1-git-send-email-jhovold@gmail.com> References: <1355142530-10366-1-git-send-email-jhovold@gmail.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Fix regression introduced by commit 787f9fd23283 ("atmel_lcdfb: support 16bit BGR:565 mode, remove unsupported 15bit modes") which broke 16-bpp modes for older SOCs which use IBGR:555 (msb is intensity) rather than BGR:565. Use SOC-type to determine the pixel layout. Tested on custom at91sam9263-board. Cc: Signed-off-by: Johan Hovold Acked-by: Peter Korsgaard --- drivers/video/atmel_lcdfb.c | 22 +++++++++++++++------- include/video/atmel_lcdc.h | 1 + 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index 1505539..1f68fa6 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c @@ -422,17 +422,22 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var, = var->bits_per_pixel; break; case 16: + /* Older SOCs use IBGR:555 rather than BGR:565. */ + if (sinfo->have_intensity_bit) + var->green.length = 5; + else + var->green.length = 6; + if (sinfo->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) { - /* RGB:565 mode */ - var->red.offset = 11; + /* RGB:5X5 mode */ + var->red.offset = var->green.length + 5; var->blue.offset = 0; } else { - /* BGR:565 mode */ + /* BGR:5X5 mode */ var->red.offset = 0; - var->blue.offset = 11; + var->blue.offset = var->green.length + 5; } var->green.offset = 5; - var->green.length = 6; var->red.length = var->blue.length = 5; break; case 32: @@ -679,8 +684,7 @@ static int atmel_lcdfb_setcolreg(unsigned int regno, unsigned int red, case FB_VISUAL_PSEUDOCOLOR: if (regno < 256) { - if (cpu_is_at91sam9261() || cpu_is_at91sam9263() - || cpu_is_at91sam9rl()) { + if (sinfo->have_intensity_bit) { /* old style I+BGR:555 */ val = ((red >> 11) & 0x001f); val |= ((green >> 6) & 0x03e0); @@ -870,6 +874,10 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev) } sinfo->info = info; sinfo->pdev = pdev; + if (cpu_is_at91sam9261() || cpu_is_at91sam9263() || + cpu_is_at91sam9rl()) { + sinfo->have_intensity_bit = true; + } strcpy(info->fix.id, sinfo->pdev->name); info->flags = ATMEL_LCDFB_FBINFO_DEFAULT; diff --git a/include/video/atmel_lcdc.h b/include/video/atmel_lcdc.h index 28447f1..5f0e234 100644 --- a/include/video/atmel_lcdc.h +++ b/include/video/atmel_lcdc.h @@ -62,6 +62,7 @@ struct atmel_lcdfb_info { void (*atmel_lcdfb_power_control)(int on); struct fb_monspecs *default_monspecs; u32 pseudo_palette[16]; + bool have_intensity_bit; }; #define ATMEL_LCDC_DMABADDR1 0x00