From patchwork Tue Sep 14 08:20:29 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Donghwa Lee X-Patchwork-Id: 71849 X-Patchwork-Delegate: agust@denx.de Return-Path: X-Original-To: wd@gemini.denx.de Delivered-To: wd@gemini.denx.de Received: from diddl.denx.de (diddl.denx.de [10.0.0.6]) by gemini.denx.de (Postfix) with ESMTP id 74CCB15242D for ; Tue, 14 Sep 2010 10:22:35 +0200 (CEST) Received: from diddl.denx.de (localhost.localdomain [127.0.0.1]) by diddl.denx.de (Postfix) with ESMTP id 592DE31463C0 for ; Tue, 14 Sep 2010 10:22:35 +0200 (MEST) Received: from pop.mnet-online.de by diddl.denx.de with POP3 (fetchmail-6.3.17) for (single-drop); Tue, 14 Sep 2010 10:22:35 +0200 (MEST) Received: from murder ([192.168.8.180]) by backend2 (Cyrus v2.2.12) with LMTPA; Tue, 14 Sep 2010 10:20:01 +0200 X-Sieve: CMU Sieve 2.2 Received: from mail.m-online.net (localhost [127.0.0.1]) by frontend1.mail.m-online.net (Cyrus v2.2.12) with LMTPA; Tue, 14 Sep 2010 10:20:00 +0200 Received: from scanner-1.m-online.net (scanner-1.mail.m-online.net [192.168.8.165]) by mail.m-online.net (Postfix) with ESMTP id A16641C001F7; Tue, 14 Sep 2010 10:20:00 +0200 (CEST) Received: from mxin-2.m-online.net ([192.168.1.21]) by scanner-1.m-online.net (scanner-1.m-online.net [192.168.8.165]) (amavisd-new, port 10026) with ESMTP id 10933-02-3; Tue, 14 Sep 2010 10:19:51 +0200 (CEST) Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by mxin-2.m-online.net (Postfix) with ESMTP id 4D4BC46AF1E; Tue, 14 Sep 2010 10:19:51 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EEF4528084; Tue, 14 Sep 2010 10:19:43 +0200 (CEST) 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 rxJUHmTdE5-P; Tue, 14 Sep 2010 10:19:43 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 72BEA28085; Tue, 14 Sep 2010 10:19:38 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 10C2D28081 for ; Tue, 14 Sep 2010 10:19:36 +0200 (CEST) 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 UdUlaMpYjdc3 for ; Tue, 14 Sep 2010 10:19:34 +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 mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by theia.denx.de (Postfix) with ESMTP id 0514128080 for ; Tue, 14 Sep 2010 10:19:32 +0200 (CEST) Received: from epmmp2 (mailout1.samsung.com [203.254.224.24]) by mailout1.samsung.com (Sun Java(tm) System Messaging Server 7u3-15.01 64bit (built Feb 12 2010)) with ESMTP id <0L8Q00BUW9RWDQD0@mailout1.samsung.com> for u-boot@lists.denx.de; Tue, 14 Sep 2010 17:19:08 +0900 (KST) Received: from TNRNDGASPAPP1.tn.corp.samsungelectronics.net ([165.213.149.150]) by mmp2.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0L8Q0074B9RWZ5@mmp2.samsung.com> for u-boot@lists.denx.de; Tue, 14 Sep 2010 17:19:08 +0900 (KST) Received: from localhost.localdomain ([10.89.53.118]) by TNRNDGASPAPP1.tn.corp.samsungelectronics.net with Microsoft SMTPSVC(6.0.3790.4675); Tue, 14 Sep 2010 17:19:08 +0900 Date: Tue, 14 Sep 2010 17:20:29 +0900 From: Donghwa Lee To: u-boot@lists.denx.de, dh09.lee@samsung.com Message-id: <1284452429-10616-1-git-send-email-dh09.lee@samsung.com> X-Mailer: git-send-email 1.6.0.4 X-OriginalArrivalTime: 14 Sep 2010 08:19:08.0603 (UTC) FILETIME=[80F028B0:01CB53E5] Subject: [U-Boot] [PATCH] S5P: adds s6e63m0 amoled display driver 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: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de X-Virus-Scanned: by amavisd-new at m-online.net This patch can support s6e63m0 amoled panel. It uses s5p-spi interface using spi bitbang emulation. please refer to patch, "S5P: new spi gpio bitbang driver". Signed-off-by: Donghwa Lee --- drivers/video/Makefile | 1 + drivers/video/s6e63m0.c | 384 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 385 insertions(+), 0 deletions(-) create mode 100644 drivers/video/s6e63m0.c diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 4be82e7..15d7483 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -36,6 +36,7 @@ COBJS-$(CONFIG_VIDEO_MB86R0xGDC) += mb86r0xgdc.o videomodes.o COBJS-$(CONFIG_VIDEO_MX3) += mx3fb.o COBJS-$(CONFIG_VIDEO_SED13806) += sed13806.o COBJS-$(CONFIG_SED156X) += sed156x.o +COBJS-$(CONFIG_S6E63M0) += s6e63m0.o COBJS-$(CONFIG_VIDEO_SM501) += sm501.o COBJS-$(CONFIG_VIDEO_SMI_LYNXEM) += smiLynxEM.o videomodes.o COBJS-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o diff --git a/drivers/video/s6e63m0.c b/drivers/video/s6e63m0.c new file mode 100644 index 0000000..72b2022 --- /dev/null +++ b/drivers/video/s6e63m0.c @@ -0,0 +1,384 @@ +/* + * LCD panel driver for Board based on S5PC100 and S5PC110. + * + * Author: InKi Dae + * + * Derived from drivers/video/omap/lcd-apollon.c + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include +#include +#include +#include +#include +#include + + +/* these machine specific platform data would be setting at universal.c */ +struct s5p_spi_platdata *s6e63m0; + +static const unsigned char SEQ_PANEL_CONDITION_SET[] = { + 0xF8, 0x01, + DATA_ONLY, 0x27, + DATA_ONLY, 0x27, + DATA_ONLY, 0x07, + DATA_ONLY, 0x07, + DATA_ONLY, 0x54, + DATA_ONLY, 0x9f, + DATA_ONLY, 0x63, + DATA_ONLY, 0x86, + DATA_ONLY, 0x1a, + DATA_ONLY, 0x33, + DATA_ONLY, 0x0d, + DATA_ONLY, 0x00, + DATA_ONLY, 0x00, +}; + +static const unsigned char SEQ_DISPLAY_CONDITION_SET[] = { + 0xf2, 0x02, + DATA_ONLY, 0x03, + DATA_ONLY, 0x1c, + DATA_ONLY, 0x10, + DATA_ONLY, 0x10, + + 0xf7, 0x03, + DATA_ONLY, 0x00, + DATA_ONLY, 0x00, +}; + +static const unsigned char SEQ_DISPLAY_CONDITION_SET_REV[] = { + 0xf2, 0x02, + DATA_ONLY, 0x03, + DATA_ONLY, 0x1c, + DATA_ONLY, 0x10, + DATA_ONLY, 0x10, + + 0xf7, 0x00, + DATA_ONLY, 0x00, + DATA_ONLY, 0x00, +}; + +static const unsigned char SEQ_GAMMA_SETTING[] = { + 0xfa, 0x00, + DATA_ONLY, 0x18, + DATA_ONLY, 0x08, + DATA_ONLY, 0x24, + DATA_ONLY, 0x64, + DATA_ONLY, 0x56, + DATA_ONLY, 0x33, + DATA_ONLY, 0xb6, + DATA_ONLY, 0xba, + DATA_ONLY, 0xa8, + DATA_ONLY, 0xac, + DATA_ONLY, 0xb1, + DATA_ONLY, 0x9d, + DATA_ONLY, 0xc1, + DATA_ONLY, 0xc1, + DATA_ONLY, 0xb7, + DATA_ONLY, 0x9c, + DATA_ONLY, 0xa0, + DATA_ONLY, 0x00, + DATA_ONLY, 0x9f, + DATA_ONLY, 0x00, + DATA_ONLY, 0xd6, + 0xfa, 0x01, +}; + +static const unsigned char SEQ_ETC_CONDITION_SET[] = { + 0xf6, 0x00, + DATA_ONLY, 0x8c, + DATA_ONLY, 0x07, + + /* added for panel rev 0.1*/ + 0xb3, 0xc, + + 0xb5, 0x2c, + DATA_ONLY, 0x12, + DATA_ONLY, 0x0c, + DATA_ONLY, 0x0a, + DATA_ONLY, 0x10, + DATA_ONLY, 0x0e, + DATA_ONLY, 0x17, + DATA_ONLY, 0x13, + DATA_ONLY, 0x1f, + DATA_ONLY, 0x1a, + DATA_ONLY, 0x2a, + DATA_ONLY, 0x24, + DATA_ONLY, 0x1f, + DATA_ONLY, 0x1b, + DATA_ONLY, 0x1a, + DATA_ONLY, 0x17, + + DATA_ONLY, 0x2b, + DATA_ONLY, 0x26, + DATA_ONLY, 0x22, + DATA_ONLY, 0x20, + DATA_ONLY, 0x3a, + DATA_ONLY, 0x34, + DATA_ONLY, 0x30, + DATA_ONLY, 0x2c, + DATA_ONLY, 0x29, + DATA_ONLY, 0x26, + DATA_ONLY, 0x25, + DATA_ONLY, 0x23, + DATA_ONLY, 0x21, + DATA_ONLY, 0x20, + DATA_ONLY, 0x1e, + DATA_ONLY, 0x1e, + + 0xb6, 0x00, + DATA_ONLY, 0x00, + DATA_ONLY, 0x11, + DATA_ONLY, 0x22, + DATA_ONLY, 0x33, + DATA_ONLY, 0x44, + DATA_ONLY, 0x44, + DATA_ONLY, 0x44, + + DATA_ONLY, 0x55, + DATA_ONLY, 0x55, + DATA_ONLY, 0x66, + DATA_ONLY, 0x66, + DATA_ONLY, 0x66, + DATA_ONLY, 0x66, + DATA_ONLY, 0x66, + DATA_ONLY, 0x66, + + 0xb7, 0x2c, + DATA_ONLY, 0x12, + DATA_ONLY, 0x0c, + DATA_ONLY, 0x0a, + DATA_ONLY, 0x10, + DATA_ONLY, 0x0e, + DATA_ONLY, 0x17, + DATA_ONLY, 0x13, + DATA_ONLY, 0x1f, + DATA_ONLY, 0x1a, + DATA_ONLY, 0x2a, + DATA_ONLY, 0x24, + DATA_ONLY, 0x1f, + DATA_ONLY, 0x1b, + DATA_ONLY, 0x1a, + DATA_ONLY, 0x17, + + DATA_ONLY, 0x2b, + DATA_ONLY, 0x26, + DATA_ONLY, 0x22, + DATA_ONLY, 0x20, + DATA_ONLY, 0x3a, + DATA_ONLY, 0x34, + DATA_ONLY, 0x30, + DATA_ONLY, 0x2c, + DATA_ONLY, 0x29, + DATA_ONLY, 0x26, + DATA_ONLY, 0x25, + DATA_ONLY, 0x23, + DATA_ONLY, 0x21, + DATA_ONLY, 0x20, + DATA_ONLY, 0x1e, + DATA_ONLY, 0x1e, + + 0xb8, 0x00, + DATA_ONLY, 0x00, + DATA_ONLY, 0x11, + DATA_ONLY, 0x22, + DATA_ONLY, 0x33, + DATA_ONLY, 0x44, + DATA_ONLY, 0x44, + DATA_ONLY, 0x44, + + DATA_ONLY, 0x55, + DATA_ONLY, 0x55, + DATA_ONLY, 0x66, + DATA_ONLY, 0x66, + DATA_ONLY, 0x66, + DATA_ONLY, 0x66, + DATA_ONLY, 0x66, + DATA_ONLY, 0x66, + + 0xb9, 0x2c, + DATA_ONLY, 0x12, + DATA_ONLY, 0x0c, + DATA_ONLY, 0x0a, + DATA_ONLY, 0x10, + DATA_ONLY, 0x0e, + DATA_ONLY, 0x17, + DATA_ONLY, 0x13, + DATA_ONLY, 0x1f, + DATA_ONLY, 0x1a, + DATA_ONLY, 0x2a, + DATA_ONLY, 0x24, + DATA_ONLY, 0x1f, + DATA_ONLY, 0x1b, + DATA_ONLY, 0x1a, + DATA_ONLY, 0x17, + + DATA_ONLY, 0x2b, + DATA_ONLY, 0x26, + DATA_ONLY, 0x22, + DATA_ONLY, 0x20, + DATA_ONLY, 0x3a, + DATA_ONLY, 0x34, + DATA_ONLY, 0x30, + DATA_ONLY, 0x2c, + DATA_ONLY, 0x29, + DATA_ONLY, 0x26, + DATA_ONLY, 0x25, + DATA_ONLY, 0x23, + DATA_ONLY, 0x21, + DATA_ONLY, 0x20, + DATA_ONLY, 0x1e, + DATA_ONLY, 0x1e, + + 0xba, 0x00, + DATA_ONLY, 0x00, + DATA_ONLY, 0x11, + DATA_ONLY, 0x22, + DATA_ONLY, 0x33, + DATA_ONLY, 0x44, + DATA_ONLY, 0x44, + DATA_ONLY, 0x44, + + DATA_ONLY, 0x55, + DATA_ONLY, 0x55, + DATA_ONLY, 0x66, + DATA_ONLY, 0x66, + DATA_ONLY, 0x66, + DATA_ONLY, 0x66, + DATA_ONLY, 0x66, + DATA_ONLY, 0x66, + + 0xc1, 0x4d, + DATA_ONLY, 0x96, + DATA_ONLY, 0x1d, + DATA_ONLY, 0x00, + DATA_ONLY, 0x00, + DATA_ONLY, 0x01, + DATA_ONLY, 0xdf, + DATA_ONLY, 0x00, + DATA_ONLY, 0x00, + DATA_ONLY, 0x03, + DATA_ONLY, 0x1f, + DATA_ONLY, 0x00, + DATA_ONLY, 0x00, + DATA_ONLY, 0x00, + DATA_ONLY, 0x00, + DATA_ONLY, 0x00, + DATA_ONLY, 0x00, + DATA_ONLY, 0x00, + DATA_ONLY, 0x00, + DATA_ONLY, 0x03, + DATA_ONLY, 0x06, + DATA_ONLY, 0x09, + DATA_ONLY, 0x0d, + DATA_ONLY, 0x0f, + DATA_ONLY, 0x12, + DATA_ONLY, 0x15, + DATA_ONLY, 0x18, + + 0xb2, 0x10, + DATA_ONLY, 0x10, + DATA_ONLY, 0x0b, + DATA_ONLY, 0x05, +}; + +static const unsigned char SEQ_ACL_ON[] = { + /* ACL on */ + 0xc0, 0x01, +}; + +static const unsigned char SEQ_ACL_OFF[] = { + /* ACL off */ + 0xc0, 0x00, +}; + +static const unsigned char SEQ_ELVSS_ON[] = { + /* ELVSS on */ + 0xb1, 0x0b, +}; + +static const unsigned char SEQ_ELVSS_OFF[] = { + /* ELVSS off */ + 0xb1, 0x0a, +}; + +static const unsigned char SEQ_STAND_BY_OFF[] = { + 0x11, COMMAND_ONLY, +}; + +static const unsigned char SEQ_STAND_BY_ON[] = { + 0x10, COMMAND_ONLY, +}; + +/* added for panel rev 0.1*/ +static const unsigned char SEQ_DISPLAY_ON[] = { + 0x29, COMMAND_ONLY, +}; + +static void s6e63m0_spi_write(unsigned char address, unsigned char command) +{ + if (address != DATA_ONLY) + s5p_spi_write(s6e63m0, (unsigned int) 0x0, (unsigned int) address); + + if (command != COMMAND_ONLY) + s5p_spi_write(s6e63m0, (unsigned int) 0x1, (unsigned int) command); +} + +static void s6e63m0_panel_send_sequence(const unsigned char *wbuf, unsigned size_cmd) +{ + int i = 0; + while (i < size_cmd) { + s6e63m0_spi_write(wbuf[i], wbuf[i+1]); + i += 2; + } +} + +void s6e63m0_cfg_ldo(void) +{ + /* + data = s6e63m0_c110_spi_read_byte(0x0, 0xdd); + printf("data = %d, %x\n", data, &data); + */ + s6e63m0_panel_send_sequence(SEQ_PANEL_CONDITION_SET, ARRAY_SIZE(SEQ_PANEL_CONDITION_SET)); + s6e63m0_panel_send_sequence(SEQ_DISPLAY_CONDITION_SET, ARRAY_SIZE(SEQ_DISPLAY_CONDITION_SET)); + s6e63m0_panel_send_sequence(SEQ_GAMMA_SETTING, ARRAY_SIZE(SEQ_GAMMA_SETTING)); + s6e63m0_panel_send_sequence(SEQ_ETC_CONDITION_SET, ARRAY_SIZE(SEQ_ETC_CONDITION_SET)); + s6e63m0_panel_send_sequence(SEQ_ACL_ON, ARRAY_SIZE(SEQ_ACL_ON)); + s6e63m0_panel_send_sequence(SEQ_ELVSS_OFF, ARRAY_SIZE(SEQ_ELVSS_OFF)); +} + +void s6e63m0_enable_ldo(unsigned int onoff) +{ + if (onoff) { + s6e63m0_panel_send_sequence(SEQ_STAND_BY_OFF, ARRAY_SIZE(SEQ_STAND_BY_OFF)); + s6e63m0_panel_send_sequence(SEQ_DISPLAY_ON, ARRAY_SIZE(SEQ_DISPLAY_ON)); + } else { + s6e63m0_panel_send_sequence(SEQ_STAND_BY_ON, ARRAY_SIZE(SEQ_STAND_BY_ON)); + } +} + +/* this function would be called at universal.c */ +void s6e63m0_set_platform_data(struct s5p_spi_platdata *pd) +{ + if (pd == NULL) { + printf("pd is NULL.\n"); + return; + } + + s6e63m0 = pd; +}