diff options
Diffstat (limited to 'firmware/target/arm/ipod/lcd-gray.c')
-rw-r--r-- | firmware/target/arm/ipod/lcd-gray.c | 54 |
1 files changed, 13 insertions, 41 deletions
diff --git a/firmware/target/arm/ipod/lcd-gray.c b/firmware/target/arm/ipod/lcd-gray.c index e36a7efc1d..9538d277af 100644 --- a/firmware/target/arm/ipod/lcd-gray.c +++ b/firmware/target/arm/ipod/lcd-gray.c | |||
@@ -57,18 +57,12 @@ static void invert_display(void); | |||
57 | #endif | 57 | #endif |
58 | 58 | ||
59 | #if defined(IPOD_1G2G) || defined(IPOD_3G) | 59 | #if defined(IPOD_1G2G) || defined(IPOD_3G) |
60 | static unsigned short power_reg_h; | 60 | #define POWER_REG_H 0x1120 /* 1/7 Bias, 5x step-up @ clk/8 */ |
61 | #define POWER_REG_H power_reg_h | ||
62 | #else | 61 | #else |
63 | #define POWER_REG_H 0x1200 | 62 | #define POWER_REG_H 0x1200 /* 1/7 Bias, 6x step-up @ clk/32 */ |
64 | #endif | 63 | #endif |
65 | 64 | ||
66 | #ifdef IPOD_1G2G | ||
67 | static unsigned short contrast_reg_h; | ||
68 | #define CONTRAST_REG_H contrast_reg_h | ||
69 | #else | ||
70 | #define CONTRAST_REG_H 0x400 | 65 | #define CONTRAST_REG_H 0x400 |
71 | #endif | ||
72 | 66 | ||
73 | /* needed for flip */ | 67 | /* needed for flip */ |
74 | static int addr_offset; | 68 | static int addr_offset; |
@@ -118,43 +112,19 @@ static void lcd_cmd_and_data(unsigned cmd, unsigned data) | |||
118 | /* LCD init */ | 112 | /* LCD init */ |
119 | void lcd_init_device(void) | 113 | void lcd_init_device(void) |
120 | { | 114 | { |
121 | #ifdef IPOD_1G2G | ||
122 | if ((IPOD_HW_REVISION >> 16) == 1) | ||
123 | { | ||
124 | power_reg_h = 0x1500; | ||
125 | contrast_reg_h = 0x700; | ||
126 | } | ||
127 | else /* 2nd gen */ | ||
128 | { | ||
129 | if (inl(0xcf00404c) & 0x01) /* check bit 0 */ | ||
130 | { | ||
131 | power_reg_h = 0x1520; /* Set step-up frequency to f/8 instead of | ||
132 | * f/32, for better blacklevel stability */ | ||
133 | contrast_reg_h = 0x400; | ||
134 | } | ||
135 | else | ||
136 | { | ||
137 | power_reg_h = 0x1100; | ||
138 | contrast_reg_h = 0x300; | ||
139 | } | ||
140 | } | ||
141 | #elif defined IPOD_3G | ||
142 | if (inl(0xcf00404c) & 0x01) /* check bit 0 */ | ||
143 | power_reg_h = 0x1520; /* Set step-up frequency to f/8 instead of | ||
144 | * f/32, for better blacklevel stability */ | ||
145 | else | ||
146 | power_reg_h = 0x1100; | ||
147 | #endif | ||
148 | 115 | ||
149 | #ifdef IPOD_MINI2G /* serial LCD hookup */ | 116 | #ifdef IPOD_MINI2G /* serial LCD hookup */ |
150 | lcd_wait_write(); | 117 | lcd_wait_write(); |
151 | LCD1_CONTROL = 0x01730084; /* fastest setting */ | 118 | LCD1_CONTROL = 0x01730084; /* fastest setting */ |
152 | #elif defined(IPOD_1G2G) || defined(IPOD_3G) | 119 | #elif defined(IPOD_1G2G) || defined(IPOD_3G) |
153 | LCD1_CONTROL = (LCD1_CONTROL & 0x0002) | 0x0084; /* fastest setting, keep backlight bit */ | 120 | LCD1_CONTROL = (LCD1_CONTROL & 0x0002) | 0x0084; |
121 | /* fastest setting, keep backlight bit */ | ||
154 | #else | 122 | #else |
155 | LCD1_CONTROL = 0x0084; /* fastest setting */ | 123 | LCD1_CONTROL = 0x0084; /* fastest setting */ |
156 | #endif | 124 | #endif |
157 | 125 | ||
126 | lcd_cmd_and_data(R_DRV_WAVEFORM_CONTROL, 0x48); | ||
127 | /* C waveform, no EOR, 9 lines inversion */ | ||
158 | lcd_cmd_and_data(R_POWER_CONTROL, POWER_REG_H | 0xc); | 128 | lcd_cmd_and_data(R_POWER_CONTROL, POWER_REG_H | 0xc); |
159 | #ifdef HAVE_BACKLIGHT_INVERSION | 129 | #ifdef HAVE_BACKLIGHT_INVERSION |
160 | invert_display(); | 130 | invert_display(); |
@@ -169,9 +139,11 @@ void lcd_init_device(void) | |||
169 | 139 | ||
170 | int lcd_default_contrast(void) | 140 | int lcd_default_contrast(void) |
171 | { | 141 | { |
172 | #ifdef IPOD_1G2G | 142 | #if defined(IPOD_1G2G) |
173 | return 28; | 143 | return 45; |
174 | #elif defined(IPOD_MINI) || defined(IPOD_MINI2G) || defined(IPOD_3G) | 144 | #elif defined(IPOD_3G) |
145 | return 55; | ||
146 | #elif defined(IPOD_MINI) || defined(IPOD_MINI2G) | ||
175 | return 42; | 147 | return 42; |
176 | #elif defined(IPOD_4G) | 148 | #elif defined(IPOD_4G) |
177 | return 35; | 149 | return 35; |
@@ -354,7 +326,7 @@ void lcd_update(void) | |||
354 | /* LCD powerdown */ | 326 | /* LCD powerdown */ |
355 | void lcd_shutdown(void) | 327 | void lcd_shutdown(void) |
356 | { | 328 | { |
357 | lcd_cmd_and_data(R_POWER_CONTROL, 0x1500); /* Turn off op amp power */ | 329 | lcd_cmd_and_data(R_POWER_CONTROL, POWER_REG_H | 0x00); /* Turn off op amp power */ |
358 | lcd_cmd_and_data(R_POWER_CONTROL, 0x1502); /* Put LCD driver in standby */ | 330 | lcd_cmd_and_data(R_POWER_CONTROL, POWER_REG_H | 0x02); /* Put LCD driver in standby */ |
359 | } | 331 | } |
360 | #endif | 332 | #endif |