1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
Index: firmware/target/arm/ipod/lcd-color_nano.c
===================================================================
--- firmware/target/arm/ipod/lcd-color_nano.c  (revision 28992)
+++ firmware/target/arm/ipod/lcd-color_nano.c  (working copy)
@@ -39,7 +39,7 @@
 #define LCD_CNTL_VERT_RAM_ADDR_POS      0x45

 /*** globals ***/
-int lcd_type = 1; /* 0 = "old" Color/Photo, 1 = "new" Color & Nano */
+int lcd_type = 1; /* 0,2 = "old" Color/Photo; 1,3 = similar to HD66789R */

 static inline void lcd_wait_write(void)
 {
@@ -48,7 +48,7 @@

 static void lcd_cmd_data(unsigned cmd, unsigned data)
 {
-    if (lcd_type == 0) {  /* 16 bit transfers */
+    if (lcd_type&1 == 0) {  /* 16 bit transfers */
         lcd_wait_write();
         LCD2_PORT = LCD2_CMD_MASK | cmd;
         lcd_wait_write();
@@ -91,22 +91,11 @@
     if (IPOD_HW_REVISION == 0x60000) {
         lcd_type = 0;
     } else {
-        int gpio_a01, gpio_a04;
-
-        /* A01 */
-        gpio_a01 = (GPIOA_INPUT_VAL & 0x2) >> 1;
-        /* A04 */
-        gpio_a04 = (GPIOA_INPUT_VAL & 0x10) >> 4;
-
-        if (((gpio_a01 << 1) | gpio_a04) == 0 || ((gpio_a01 << 1) | gpio_a04) == 2) {
-            lcd_type = 0;
-        } else {
-            lcd_type = 1;
-        }
+        lcd_type = (GPIOA_INPUT_VAL & 0x2) | ((GPIOA_INPUT_VAL & 0x10) >> 4);
     }
-    if (lcd_type == 0) {
+    if (lcd_type&1 == 0) {
         lcd_cmd_data(0xef, 0x0);
-        lcd_cmd_data(0x1, 0x0);
+        lcd_cmd_data(0x1 , 0x0);
         lcd_cmd_data(0x80, 0x1);
         lcd_cmd_data(0x10, 0xc);
         lcd_cmd_data(0x18, 0x6);
@@ -114,7 +103,6 @@
         lcd_cmd_data(0x7e, 0x5);
         lcd_cmd_data(0x7f, 0x1);
     }
-
 #elif CONFIG_LCD == LCD_IPODNANO
     /* iPodLinux doesn't appear have any LCD init code for the Nano */
 #endif
@@ -139,7 +127,7 @@
 #endif

     /* setup the drawing region */
-    if (lcd_type == 0) {
+    if (lcd_type&1 == 0) {
         lcd_cmd_data(0x12, y0);      /* start vert */
         lcd_cmd_data(0x13, x0);      /* start horiz */
         lcd_cmd_data(0x15, y1);      /* end vert */