From patchwork Tue Feb 5 13:35:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 2097721 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 1F78F3FC23 for ; Tue, 5 Feb 2013 13:37:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754941Ab3BENhJ (ORCPT ); Tue, 5 Feb 2013 08:37:09 -0500 Received: from mail-lb0-f182.google.com ([209.85.217.182]:55673 "EHLO mail-lb0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753862Ab3BENhI (ORCPT ); Tue, 5 Feb 2013 08:37:08 -0500 Received: by mail-lb0-f182.google.com with SMTP id gg6so218678lbb.41 for ; Tue, 05 Feb 2013 05:37:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=b3+FmLiH8Y1PrMZwXFsBzLvmCSZNODy7DsO6ypHbsl8=; b=faZZ9jZf0i1mjoi+Z4sUgrNBCiMBScYiKmvFHwfvyoOwIiMVXv/YhUmkYgBoNZR16F i86rAZj8PjfS1h51bFUFjrDelePhkyN6/U5jERfufROH4ihK1Z4k81KaszX7jfvlx6BF 7p/Y7US342ip09u2mccj9h5qW1AB2KnRO54GraTCiwGgMtG5maUTxYvMygMxhMi9gvfR aHmbswacPLFRluKcLScdpkW6Xy9RO7mfCcsPsligLf+BGsA+1vrzrDyMtPD4uir5b7Um hfhXVZyny9HJScfSdAC0Eqx2hwVjlDPigUZVofYe9y/nHByYxs7hxCxaj2dbAtXIEBsA yvLg== X-Received: by 10.152.113.66 with SMTP id iw2mr22614412lab.37.1360071426890; Tue, 05 Feb 2013 05:37:06 -0800 (PST) Received: from xi.lan (c83-179-13-247.cust.tele2.se. [83.179.13.247]) by mx.google.com with ESMTPS id ft8sm10970950lab.9.2013.02.05.05.37.04 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 05 Feb 2013 05:37:05 -0800 (PST) Received: from johan by xi.lan with local (Exim 4.80.1) (envelope-from ) id 1U2ige-000146-HY; Tue, 05 Feb 2013 14:35:48 +0100 From: Johan Hovold To: Nicolas Ferre Cc: Florian Tobias Schandinat , Jean-Christophe PLAGNIOL-VILLARD , Andrew Victor , Peter Korsgaard , Haavard Skinnemoen , Hans-Christian Egtvedt , linux-arm-kernel@lists.infradead.org, linux-fbdev@vger.kernel.org, Johan Hovold , Subject: [PATCH 1/5] atmel_lcdfb: fix 16-bpp modes on older SOCs Date: Tue, 5 Feb 2013 14:35:11 +0100 Message-Id: <1360071315-4032-2-git-send-email-jhovold@gmail.com> X-Mailer: git-send-email 1.8.1 In-Reply-To: <1360071315-4032-1-git-send-email-jhovold@gmail.com> References: <20130129135435.GN7360@game.jcrosoft.org> <1360071315-4032-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 at91sam9263 and at91sam9g45. Cc: Acked-by: Peter Korsgaard Signed-off-by: Johan Hovold --- 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 12cf5f3..025428e 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