summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2009-07-16 18:03:09 +0000
committerDave Chapman <dave@dchapman.com>2009-07-16 18:03:09 +0000
commit715d8c63d9a051b2ab7ab6ac27639d090a1823f1 (patch)
tree4ea5cfb387d17dc0745b7fca413ca027e1db07e1 /firmware/target/arm
parentf8ec7e4ad457a7a3a428f18eaf35f50a28d752b4 (diff)
downloadrockbox-715d8c63d9a051b2ab7ab6ac27639d090a1823f1.tar.gz
rockbox-715d8c63d9a051b2ab7ab6ac27639d090a1823f1.tar.bz2
rockbox-715d8c63d9a051b2ab7ab6ac27639d090a1823f1.zip
Add auto-detection of Nano 2G LCD type, and an initial attempt at lcd_update() for the second lcd type. This lcd_update works, but not reliably.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21905 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c95
1 files changed, 66 insertions, 29 deletions
diff --git a/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c b/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c
index 74f2fca383..ad2e356b5e 100644
--- a/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c
+++ b/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c
@@ -40,9 +40,9 @@ static void s5l_lcd_write_data(int data)
while (LCD_STATUS&0x10);
}
-
/** globals **/
+static int lcd_type;
static int xoffset; /* needed for flip */
/*** hardware configuration ***/
@@ -89,6 +89,15 @@ void lcd_on(void)
/* LCD init */
void lcd_init_device(void)
{
+ /* Detect lcd type */
+
+ PCON13 &= ~0xf; /* Set pin 0 to input */
+ PCON14 &= ~0xf0; /* Set pin 1 to input */
+
+ if (((PDAT13 & 1) == 0) && ((PDAT14 & 2) == 2))
+ lcd_type = 0;
+ else
+ lcd_type = 1;
}
@@ -127,36 +136,64 @@ void lcd_update(void) ICODE_ATTR;
void lcd_update(void)
{
int x,y;
- fb_data* p;
+ fb_data* p = &lcd_framebuffer[0][0];
fb_data pixel;
- s5l_lcd_write_cmd(0x3a);
- s5l_lcd_write_data(0x65);
-
- s5l_lcd_write_cmd(0x2a);
- s5l_lcd_write_data(0);
- s5l_lcd_write_data(0);
- s5l_lcd_write_data(0);
- s5l_lcd_write_data(LCD_WIDTH-1);
-
- s5l_lcd_write_cmd(0x2b);
- s5l_lcd_write_data(0);
- s5l_lcd_write_data(0);
- s5l_lcd_write_data(0);
- s5l_lcd_write_data(LCD_HEIGHT-1);
-
- s5l_lcd_write_cmd(0x2c);
-
- /* Copy display bitmap to hardware */
-
- p = &lcd_framebuffer[0][0];
- for (y = 0; y < LCD_HEIGHT; y++) {
- for (x = 0; x < LCD_WIDTH; x++) {
- pixel = *(p++);
-
- while (LCD_STATUS&0x10);
- LCD_WDATA = (pixel & 0xff00) >> 8;
- LCD_WDATA = pixel & 0xff;
+ if (lcd_type==0) {
+ s5l_lcd_write_cmd(0x50);
+ s5l_lcd_write_data(0); /* Start column */
+ s5l_lcd_write_cmd(0x51);
+ s5l_lcd_write_data(LCD_WIDTH-1); /* End column */
+ s5l_lcd_write_cmd(0x52);
+ s5l_lcd_write_data(0); /* Start row */
+ s5l_lcd_write_cmd(0x53);
+ s5l_lcd_write_data(LCD_HEIGHT-1); /* End row */
+
+ s5l_lcd_write_cmd(0x20);
+ s5l_lcd_write_data(0);
+ s5l_lcd_write_cmd(0x21);
+ s5l_lcd_write_data(0);
+ s5l_lcd_write_cmd(0x22);
+
+ /* Copy display bitmap to hardware */
+ for (y = 0; y < LCD_HEIGHT; y++) {
+ for (x = 0; x < LCD_WIDTH; x++) {
+ pixel = *(p++);
+
+ while (LCD_STATUS&0x10);
+
+ LCD_WDATA = pixel & 0xff;
+ LCD_WDATA = (pixel & 0xff00) >> 8;
+ }
+ }
+ } else {
+ s5l_lcd_write_cmd(0x3a);
+ s5l_lcd_write_data(0x65);
+
+ s5l_lcd_write_cmd(0x2a);
+ s5l_lcd_write_data(0); /* Start column, high byte */
+ s5l_lcd_write_data(0); /* Start column. low byte */
+ s5l_lcd_write_data(0); /* End column, high byte */
+ s5l_lcd_write_data(LCD_WIDTH-1); /* End column, low byte */
+
+ s5l_lcd_write_cmd(0x2b);
+ s5l_lcd_write_data(0); /* Start row, high byte */
+ s5l_lcd_write_data(0); /* Start row, low byte */
+ s5l_lcd_write_data(0); /* End row, high byte */
+ s5l_lcd_write_data(LCD_HEIGHT-1); /* End row, low byte */
+
+ s5l_lcd_write_cmd(0x2c);
+
+ /* Copy display bitmap to hardware */
+ for (y = 0; y < LCD_HEIGHT; y++) {
+ for (x = 0; x < LCD_WIDTH; x++) {
+ pixel = *(p++);
+
+ while (LCD_STATUS&0x10);
+
+ LCD_WDATA = (pixel & 0xff00) >> 8;
+ LCD_WDATA = pixel & 0xff;
+ }
}
}