From patchwork Thu May 26 14:02:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timur Tabi X-Patchwork-Id: 97580 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 07A8EB6F92 for ; Fri, 27 May 2011 00:02:37 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6714028118; Thu, 26 May 2011 16:02:35 +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 3zle0KSZ+CZh; Thu, 26 May 2011 16:02:35 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 684A828124; Thu, 26 May 2011 16:02:33 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 893D428124 for ; Thu, 26 May 2011 16:02:31 +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 rsCHj0253dK2 for ; Thu, 26 May 2011 16:02:29 +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 DB3EHSOBE001.bigfish.com (db3ehsobe001.messaging.microsoft.com [213.199.154.139]) by theia.denx.de (Postfix) with ESMTPS id 0531B28118 for ; Thu, 26 May 2011 16:02:27 +0200 (CEST) Received: from mail113-db3-R.bigfish.com (10.3.81.249) by DB3EHSOBE001.bigfish.com (10.3.84.21) with Microsoft SMTP Server id 14.1.225.22; Thu, 26 May 2011 14:02:26 +0000 Received: from mail113-db3 (localhost.localdomain [127.0.0.1]) by mail113-db3-R.bigfish.com (Postfix) with ESMTP id 8575418E0089; Thu, 26 May 2011 14:02:26 +0000 (UTC) X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275bhz2dh2a8h668h839h61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPVD:NLI; H:mail.freescale.net; RD:none; EFVD:NLI Received: from mail113-db3 (localhost.localdomain [127.0.0.1]) by mail113-db3 (MessageSwitch) id 1306418546170735_21380; Thu, 26 May 2011 14:02:26 +0000 (UTC) Received: from DB3EHSMHS009.bigfish.com (unknown [10.3.81.249]) by mail113-db3.bigfish.com (Postfix) with ESMTP id 266EB132804B; Thu, 26 May 2011 14:02:26 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by DB3EHSMHS009.bigfish.com (10.3.87.109) with Microsoft SMTP Server (TLS) id 14.1.225.22; Thu, 26 May 2011 14:02:20 +0000 Received: from az33smr02.freescale.net (10.64.34.200) by 039-SN1MMR1-002.039d.mgd.msft.net (10.84.1.15) with Microsoft SMTP Server id 14.1.270.2; Thu, 26 May 2011 09:02:19 -0500 Received: from efes.am.freescale.net (efes.am.freescale.net [10.82.123.3]) by az33smr02.freescale.net (8.13.1/8.13.0) with ESMTP id p4QE2Ias024421; Thu, 26 May 2011 09:02:18 -0500 (CDT) From: Timur Tabi To: , , Date: Thu, 26 May 2011 09:02:17 -0500 Message-ID: <1306418537-21470-1-git-send-email-timur@freescale.com> X-Mailer: git-send-email 1.7.3.4 MIME-Version: 1.0 X-OriginatorOrg: freescale.com Subject: [U-Boot] [PATCH] [v2] video: Add SHARP LQ084S3LG01 LCD support on P1022DS X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 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 SHARP LQ084S3LG01 is a TFT LCD used on the P1022DS (revision "C") board. This device only supports 800x600 resolution, so if that resolution is selected, assume that this is the device. The device is attached to the LVDS port on the P1022DS board. The existing 800x600 entry (for the PDM360NG board) is actually 800x480, so we fix that. To support two different 800x resolutions, the Y-resolution is now passed to fsl_diu_init() and both values are used to pick the proper fb_videomode structure. The data for the 800x600 video mode is originally from Jiang Yutang. Signed-off-by: Timur Tabi Signed-off-by: Jiang Yutang --- arch/powerpc/cpu/mpc512x/diu.c | 2 +- board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c | 2 +- board/freescale/p1022ds/diu.c | 2 +- drivers/video/fsl_diu_fb.c | 51 +++++++++++++++++------- include/fsl_diu_fb.h | 2 +- 5 files changed, 40 insertions(+), 19 deletions(-) diff --git a/arch/powerpc/cpu/mpc512x/diu.c b/arch/powerpc/cpu/mpc512x/diu.c index 9dc1e48..b7db249 100644 --- a/arch/powerpc/cpu/mpc512x/diu.c +++ b/arch/powerpc/cpu/mpc512x/diu.c @@ -56,5 +56,5 @@ int platform_diu_init(unsigned int xres, unsigned int yres, const char *port) unsigned int pixel_format = 0x88883316; debug("mpc5121_diu_init\n"); - return fsl_diu_init(xres, pixel_format, 0); + return fsl_diu_init(xres, yres, pixel_format, 0); } diff --git a/board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c b/board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c index 3011bb8..358a432 100644 --- a/board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c +++ b/board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c @@ -83,5 +83,5 @@ int platform_diu_init(unsigned int xres, unsigned int yres, const char *port) printf("DIU: Switching to %s monitor @ %ux%u\n", name, xres, yres); out_8(&pixis->brdcfg0, temp); - return fsl_diu_init(xres, pixel_format, gamma_fix); + return fsl_diu_init(xres, yres, pixel_format, gamma_fix); } diff --git a/board/freescale/p1022ds/diu.c b/board/freescale/p1022ds/diu.c index 7d1f6aa..cef81ce 100644 --- a/board/freescale/p1022ds/diu.c +++ b/board/freescale/p1022ds/diu.c @@ -139,7 +139,7 @@ int platform_diu_init(unsigned int xres, unsigned int yres, const char *port) clrsetbits_be32(&gur->pmuxcr, PMUXCR_ELBCDIU_MASK, PMUXCR_ELBCDIU_DIU); pmuxcr = in_be32(&gur->pmuxcr); - return fsl_diu_init(xres, pixel_format, 0); + return fsl_diu_init(xres, yres, pixel_format, 0); } /* diff --git a/drivers/video/fsl_diu_fb.c b/drivers/video/fsl_diu_fb.c index 0709849..e1d6c26 100644 --- a/drivers/video/fsl_diu_fb.c +++ b/drivers/video/fsl_diu_fb.c @@ -78,13 +78,9 @@ struct fb_videomode { unsigned int flag; }; -#define FB_SYNC_VERT_HIGH_ACT 2 /* vertical sync high active */ -#define FB_SYNC_COMP_HIGH_ACT 8 /* composite sync high active */ -#define FB_VMODE_NONINTERLACED 0 /* non interlaced */ - /* This setting is used for the ifm pdm360ng with PRIMEVIEW PM070WL3 */ -static struct fb_videomode fsl_diu_mode_800 = { - .name = "800x600-60", +static struct fb_videomode fsl_diu_mode_800_480 = { + .name = "800x480-60", .refresh = 60, .xres = 800, .yres = 480, @@ -99,13 +95,30 @@ static struct fb_videomode fsl_diu_mode_800 = { .vmode = FB_VMODE_NONINTERLACED }; +/* For the SHARP LQ084S3LG01, used on the P1022DS board */ +static struct fb_videomode fsl_diu_mode_800_600 = { + .name = "800x600-60", + .refresh = 60, + .xres = 800, + .yres = 600, + .pixclock = 25000, + .left_margin = 88, + .right_margin = 40, + .upper_margin = 23, + .lower_margin = 1, + .hsync_len = 128, + .vsync_len = 4, + .sync = FB_SYNC_COMP_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, + .vmode = FB_VMODE_NONINTERLACED +}; + /* * These parameters give default parameters * for video output 1024x768, * FIXME - change timing to proper amounts * hsync 31.5kHz, vsync 60Hz */ -static struct fb_videomode fsl_diu_mode_1024 = { +static struct fb_videomode fsl_diu_mode_1024_768 = { .name = "1024x768-60", .refresh = 60, .xres = 1024, @@ -121,7 +134,7 @@ static struct fb_videomode fsl_diu_mode_1024 = { .vmode = FB_VMODE_NONINTERLACED }; -static struct fb_videomode fsl_diu_mode_1280 = { +static struct fb_videomode fsl_diu_mode_1280_1024 = { .name = "1280x1024-60", .refresh = 60, .xres = 1280, @@ -263,7 +276,7 @@ static struct diu_ad *allocate_fb(unsigned int xres, unsigned int yres, return ad; } -int fsl_diu_init(int xres, u32 pixel_format, int gamma_fix) +int fsl_diu_init(u16 xres, u16 yres, u32 pixel_format, int gamma_fix) { struct fb_videomode *fsl_diu_mode_db; struct diu_ad *ad; @@ -274,15 +287,23 @@ int fsl_diu_init(int xres, u32 pixel_format, int gamma_fix) struct diu_addr gamma; struct diu_addr cursor; - switch (xres) { - case 800: - fsl_diu_mode_db = &fsl_diu_mode_800; +/* Convert the X,Y resolution pair into a single number */ +#define RESOLUTION(x, y) (((u32)(x) << 16) | (y)) + + switch (RESOLUTION(xres, yres)) { + case RESOLUTION(800, 480): + fsl_diu_mode_db = &fsl_diu_mode_800_480; break; - case 1280: - fsl_diu_mode_db = &fsl_diu_mode_1280; + case RESOLUTION(800, 600): + fsl_diu_mode_db = &fsl_diu_mode_800_600; + case RESOLUTION(1024, 768): + fsl_diu_mode_db = &fsl_diu_mode_1024_768; + case RESOLUTION(1280, 1024): + fsl_diu_mode_db = &fsl_diu_mode_1280_1024; break; default: - fsl_diu_mode_db = &fsl_diu_mode_1024; + printf("DIU: Unsupported resolution %ux%u\n", xres, yres); + return -1; } /* The AD struct for the dummy framebuffer and the FB itself */ diff --git a/include/fsl_diu_fb.h b/include/fsl_diu_fb.h index 4c89f4b..a58e7e2 100644 --- a/include/fsl_diu_fb.h +++ b/include/fsl_diu_fb.h @@ -24,7 +24,7 @@ * MA 02111-1307 USA */ -int fsl_diu_init(int xres, u32 pixel_format, int gamma_fix); +int fsl_diu_init(u16 xres, u16 yres, u32 pixel_format, int gamma_fix); /* Prototypes for external board-specific functions */ int platform_diu_init(unsigned int xres, unsigned int yres, const char *port);