Skip to content

Commit 77943d3

Browse files
Sudhakar Rajashekharagregkh
authored andcommitted
Staging: panel: Add support for TI CLCD interface
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 <sudhakar.raj@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent bcb903f commit 77943d3

1 file changed

Lines changed: 48 additions & 2 deletions

File tree

‎drivers/staging/panel/panel.c‎

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ static unsigned char lcd_bits[LCD_PORTS][LCD_BITS][BIT_STATES];
243243
*/
244244
#define LCD_PROTO_PARALLEL 0
245245
#define LCD_PROTO_SERIAL 1
246+
#define LCD_PROTO_TI_DA8XX_LCD 2
246247

247248
/*
248249
* LCD character sets
@@ -440,7 +441,8 @@ MODULE_PARM_DESC(lcd_type,
440441

441442
static int lcd_proto = -1;
442443
module_param(lcd_proto, int, 0000);
443-
MODULE_PARM_DESC(lcd_proto, "LCD communication: 0=parallel (//), 1=serial");
444+
MODULE_PARM_DESC(lcd_proto, "LCD communication: 0=parallel (//), 1=serial,"
445+
"2=TI LCD Interface");
444446

445447
static int lcd_charset = -1;
446448
module_param(lcd_charset, int, 0000);
@@ -797,6 +799,26 @@ static void lcd_write_data_p8(int data)
797799
spin_unlock(&pprt_lock);
798800
}
799801

802+
/* send a command to the TI LCD panel */
803+
static void lcd_write_cmd_tilcd(int cmd)
804+
{
805+
spin_lock(&pprt_lock);
806+
/* present the data to the control port */
807+
w_ctr(pprt, cmd);
808+
udelay(60);
809+
spin_unlock(&pprt_lock);
810+
}
811+
812+
/* send data to the TI LCD panel */
813+
static void lcd_write_data_tilcd(int data)
814+
{
815+
spin_lock(&pprt_lock);
816+
/* present the data to the data port */
817+
w_dtr(pprt, data);
818+
udelay(60);
819+
spin_unlock(&pprt_lock);
820+
}
821+
800822
static void lcd_gotoxy(void)
801823
{
802824
lcd_write_cmd(0x80 /* set DDRAM address */
@@ -870,6 +892,26 @@ static void lcd_clear_fast_p8(void)
870892
lcd_gotoxy();
871893
}
872894

895+
/* fills the display with spaces and resets X/Y */
896+
static void lcd_clear_fast_tilcd(void)
897+
{
898+
int pos;
899+
lcd_addr_x = lcd_addr_y = 0;
900+
lcd_gotoxy();
901+
902+
spin_lock(&pprt_lock);
903+
for (pos = 0; pos < lcd_height * lcd_hwidth; pos++) {
904+
/* present the data to the data port */
905+
w_dtr(pprt, ' ');
906+
udelay(60);
907+
}
908+
909+
spin_unlock(&pprt_lock);
910+
911+
lcd_addr_x = lcd_addr_y = 0;
912+
lcd_gotoxy();
913+
}
914+
873915
/* clears the display and resets X/Y */
874916
static void lcd_clear_display(void)
875917
{
@@ -1396,7 +1438,7 @@ void lcd_init(void)
13961438
if (lcd_da_pin == PIN_NOT_SET)
13971439
lcd_da_pin = DEFAULT_LCD_PIN_SDA;
13981440

1399-
} else { /* PARALLEL */
1441+
} else if (lcd_proto == LCD_PROTO_PARALLEL) { /* PARALLEL */
14001442
lcd_write_cmd = lcd_write_cmd_p8;
14011443
lcd_write_data = lcd_write_data_p8;
14021444
lcd_clear_fast = lcd_clear_fast_p8;
@@ -1407,6 +1449,10 @@ void lcd_init(void)
14071449
lcd_rs_pin = DEFAULT_LCD_PIN_RS;
14081450
if (lcd_rw_pin == PIN_NOT_SET)
14091451
lcd_rw_pin = DEFAULT_LCD_PIN_RW;
1452+
} else {
1453+
lcd_write_cmd = lcd_write_cmd_tilcd;
1454+
lcd_write_data = lcd_write_data_tilcd;
1455+
lcd_clear_fast = lcd_clear_fast_tilcd;
14101456
}
14111457

14121458
if (lcd_bl_pin == PIN_NOT_SET)

0 commit comments

Comments
 (0)