summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
authorBarry Wardell <rockbox@barrywardell.net>2006-09-28 12:06:56 +0000
committerBarry Wardell <rockbox@barrywardell.net>2006-09-28 12:06:56 +0000
commit03aa9c9feac4b74ae4cc82835d6c0cb92decb997 (patch)
tree5a963bbdbbc39eb20816a2f8bcf15502021a0b93 /firmware/target
parentb2269cce949c217453facfbc3eecadd7ea5ef9bc (diff)
downloadrockbox-03aa9c9feac4b74ae4cc82835d6c0cb92decb997.tar.gz
rockbox-03aa9c9feac4b74ae4cc82835d6c0cb92decb997.zip
Apply Mike Sevakis' recent sleep/contrast fixes for the X5 LCD driver to the H10 20GB LCD driver. With this fix, sleeping the LCD on the H10 20GB now works as it should so enable it as an option to save extra battery.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11085 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/arm/iriver/h10/lcd-h10_20gb.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/firmware/target/arm/iriver/h10/lcd-h10_20gb.c b/firmware/target/arm/iriver/h10/lcd-h10_20gb.c
index 834149d2a5..0eaa172c40 100644
--- a/firmware/target/arm/iriver/h10/lcd-h10_20gb.c
+++ b/firmware/target/arm/iriver/h10/lcd-h10_20gb.c
@@ -37,6 +37,8 @@ static bool display_on;
37static int y_offset; 37static int y_offset;
38/* Reverse flag. Must be remembered when display is turned off. */ 38/* Reverse flag. Must be remembered when display is turned off. */
39static unsigned short disp_control_rev; 39static unsigned short disp_control_rev;
40/* Contrast setting << 8 */
41static int lcd_contrast;
40 42
41/* Forward declarations */ 43/* Forward declarations */
42static void lcd_display_off(void); 44static void lcd_display_off(void);
@@ -138,7 +140,13 @@ void lcd_set_contrast(int val)
138 else if (val > 30) 140 else if (val > 30)
139 val = 30; 141 val = 30;
140 142
141 lcd_write_reg(R_POWER_CONTROL5, 0x2018 + (val<<8)); 143 lcd_contrast = val << 8;
144
145 if (!power_on)
146 return;
147
148 /* VCOMG=1, VDV4-0=xxxxx, VCM4-0=11000 */
149 lcd_write_reg(R_POWER_CONTROL5, 0x2018 | lcd_contrast);
142} 150}
143 151
144void lcd_set_invert_display(bool yesno) 152void lcd_set_invert_display(bool yesno)
@@ -184,6 +192,7 @@ void lcd_init_device(void)
184 display_on = true; 192 display_on = true;
185 y_offset = 0; 193 y_offset = 0;
186 disp_control_rev = 0x0004; 194 disp_control_rev = 0x0004;
195 lcd_contrast = DEFAULT_CONTRAST_SETTING << 8;
187} 196}
188 197
189static void lcd_power_on(void) 198static void lcd_power_on(void)
@@ -206,14 +215,14 @@ static void lcd_power_on(void)
206 lcd_write_reg(R_POWER_CONTROL4, 0x0401); 215 lcd_write_reg(R_POWER_CONTROL4, 0x0401);
207 /* CAD=1 */ 216 /* CAD=1 */
208 lcd_write_reg(R_POWER_CONTROL2, 0x8000); 217 lcd_write_reg(R_POWER_CONTROL2, 0x8000);
209 /* VCOMG=0, VDV4-0=10011 (19), VCM4-0=11000 */ 218 /* VCOMG=0, VDV4-0=xxxxx (19), VCM4-0=11000 */
210 lcd_write_reg(R_POWER_CONTROL5, 0x1318); 219 lcd_write_reg(R_POWER_CONTROL5, 0x0018 | lcd_contrast);
211 /* Instruction (2) for power setting; BT2-0, DC2-0, AP2-0 */ 220 /* Instruction (2) for power setting; BT2-0, DC2-0, AP2-0 */
212 /* BT2-0=000, DC2-0=001, AP2-0=011, SLP=0, STB=0 */ 221 /* BT2-0=000, DC2-0=001, AP2-0=011, SLP=0, STB=0 */
213 lcd_write_reg(R_POWER_CONTROL1, 0x002c); 222 lcd_write_reg(R_POWER_CONTROL1, 0x002c);
214 /* Instruction (3) for power setting; VCOMG = "1" */ 223 /* Instruction (3) for power setting; VCOMG = "1" */
215 /* VCOMG=1, VDV4-0=10011 (19), VCM4-0=11000 */ 224 /* VCOMG=1, VDV4-0=xxxxx (19), VCM4-0=11000 */
216 lcd_write_reg(R_POWER_CONTROL5, 0x3318); 225 lcd_write_reg(R_POWER_CONTROL5, 0x2018 | lcd_contrast);
217 226
218 /* 40ms or more; time for step-up circuits 1,2 to stabilize */ 227 /* 40ms or more; time for step-up circuits 1,2 to stabilize */
219 sleep(HZ/25); 228 sleep(HZ/25);
@@ -291,7 +300,7 @@ static void lcd_power_off(void)
291 /* VRL3-0=0100, PON=0, VRH3-0=0001 */ 300 /* VRL3-0=0100, PON=0, VRH3-0=0001 */
292 lcd_write_reg(R_POWER_CONTROL4, 0x0401); 301 lcd_write_reg(R_POWER_CONTROL4, 0x0401);
293 /* VCOMG=0, VDV4-0=10011, VCM4-0=11000 */ 302 /* VCOMG=0, VDV4-0=10011, VCM4-0=11000 */
294 lcd_write_reg(R_POWER_CONTROL5, 0x1318); 303 lcd_write_reg(R_POWER_CONTROL5, 0x0018 | lcd_contrast);
295 304
296 /* Wait 100ms or more */ 305 /* Wait 100ms or more */
297 sleep(HZ/10); 306 sleep(HZ/10);