From patchwork Thu Aug 20 22:13:18 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rajashekhara, Sudhakar" X-Patchwork-Id: 42884 Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7KCn03V016123 for ; Thu, 20 Aug 2009 12:49:00 GMT Received: from dlep35.itg.ti.com ([157.170.170.118]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id n7KCkhMN031246; Thu, 20 Aug 2009 07:46:48 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep35.itg.ti.com (8.13.7/8.13.7) with ESMTP id n7KCkgGc005072; Thu, 20 Aug 2009 07:46:42 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id D1CE180627; Thu, 20 Aug 2009 07:46:42 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp53.itg.ti.com (dflp53.itg.ti.com [128.247.5.6]) by linux.omap.com (Postfix) with ESMTP id 822FE80626 for ; Thu, 20 Aug 2009 07:46:40 -0500 (CDT) Received: from tidmzi-ftp.india.ext.ti.com (localhost [127.0.0.1]) by dflp53.itg.ti.com (8.13.8/8.13.8) with SMTP id n7KCkbIL004843; Thu, 20 Aug 2009 07:46:38 -0500 (CDT) Received: from symphonyindia.ti.com (symphony-ftp [192.168.247.11]) by tidmzi-ftp.india.ext.ti.com (Postfix) with SMTP id 9271D38870; Thu, 20 Aug 2009 18:13:43 +0530 (IST) Received: from localhost.localdomain ([192.168.247.76]) by symphonyindia.ti.com (8.13.1/8.12.10) with ESMTP id n7KCddIq014400; Thu, 20 Aug 2009 18:09:39 +0530 From: Sudhakar Rajashekhara To: linux-kernel@vger.kernel.org Date: Thu, 20 Aug 2009 18:13:18 -0400 Message-Id: <1250806398-30620-1-git-send-email-sudhakar.raj@ti.com> X-Mailer: git-send-email 1.5.6 Cc: davinci-linux-open-source@linux.davincidsp.com, gregkh@suse.de, w@1wt.eu Subject: [PATCH] staging/panel/panel.c: Add support for TI CLCD interface X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.4 Precedence: list List-Id: davinci-linux-open-source.linux.davincidsp.com List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com On TI DA850/OMAP-L138 EVM, HD44780 (24x2) LCD panel is being used[1], but it is interfaced through the SoC specific LCD interface and not through parallel port. A parallel port driver has been developed which interfaces to the panel driver through the SoC specific LCD interface. Basically, both the serial and parallel interfaces supported by the panel driver do not suit the specific interface SoC is supporting so, a new interface type has been introduced. Ideally the panel driver should be de-coupled from parallel and serial port related items but this patch is something that can be merged in the meantime. [1]Specification of the character LCD interface on TI DA850/OMAP-L138: http://www.ti.com/litv/pdf/sprufm0a. Signed-off-by: Sudhakar Rajashekhara --- drivers/staging/panel/panel.c | 50 +++++++++++++++++++++++++++++++++++++++- 1 files changed, 48 insertions(+), 2 deletions(-) diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c index c2747bc..dd7d3fd 100644 --- a/drivers/staging/panel/panel.c +++ b/drivers/staging/panel/panel.c @@ -243,6 +243,7 @@ static unsigned char lcd_bits[LCD_PORTS][LCD_BITS][BIT_STATES]; */ #define LCD_PROTO_PARALLEL 0 #define LCD_PROTO_SERIAL 1 +#define LCD_PROTO_TI_DA8XX_LCD 2 /* * LCD character sets @@ -440,7 +441,8 @@ MODULE_PARM_DESC(lcd_type, static int lcd_proto = -1; module_param(lcd_proto, int, 0000); -MODULE_PARM_DESC(lcd_proto, "LCD communication: 0=parallel (//), 1=serial"); +MODULE_PARM_DESC(lcd_proto, "LCD communication: 0=parallel (//), 1=serial," + "2=TI LCD Interface"); static int lcd_charset = -1; module_param(lcd_charset, int, 0000); @@ -797,6 +799,26 @@ static void lcd_write_data_p8(int data) spin_unlock(&pprt_lock); } +/* send a command to the TI LCD panel */ +static void lcd_write_cmd_tilcd(int cmd) +{ + spin_lock(&pprt_lock); + /* present the data to the control port */ + w_ctr(pprt, cmd); + udelay(60); + spin_unlock(&pprt_lock); +} + +/* send data to the TI LCD panel */ +static void lcd_write_data_tilcd(int data) +{ + spin_lock(&pprt_lock); + /* present the data to the data port */ + w_dtr(pprt, data); + udelay(60); + spin_unlock(&pprt_lock); +} + static void lcd_gotoxy(void) { lcd_write_cmd(0x80 /* set DDRAM address */ @@ -870,6 +892,26 @@ static void lcd_clear_fast_p8(void) lcd_gotoxy(); } +/* fills the display with spaces and resets X/Y */ +static void lcd_clear_fast_tilcd(void) +{ + int pos; + lcd_addr_x = lcd_addr_y = 0; + lcd_gotoxy(); + + spin_lock(&pprt_lock); + for (pos = 0; pos < lcd_height * lcd_hwidth; pos++) { + /* present the data to the data port */ + w_dtr(pprt, ' '); + udelay(60); + } + + spin_unlock(&pprt_lock); + + lcd_addr_x = lcd_addr_y = 0; + lcd_gotoxy(); +} + /* clears the display and resets X/Y */ static void lcd_clear_display(void) { @@ -1396,7 +1438,7 @@ void lcd_init(void) if (lcd_da_pin == PIN_NOT_SET) lcd_da_pin = DEFAULT_LCD_PIN_SDA; - } else { /* PARALLEL */ + } else if (lcd_proto == LCD_PROTO_PARALLEL) { /* PARALLEL */ lcd_write_cmd = lcd_write_cmd_p8; lcd_write_data = lcd_write_data_p8; lcd_clear_fast = lcd_clear_fast_p8; @@ -1407,6 +1449,10 @@ void lcd_init(void) lcd_rs_pin = DEFAULT_LCD_PIN_RS; if (lcd_rw_pin == PIN_NOT_SET) lcd_rw_pin = DEFAULT_LCD_PIN_RW; + } else { + lcd_write_cmd = lcd_write_cmd_tilcd; + lcd_write_data = lcd_write_data_tilcd; + lcd_clear_fast = lcd_clear_fast_tilcd; } if (lcd_bl_pin == PIN_NOT_SET)