diff options
-rw-r--r-- | firmware/export/config-h10.h | 2 | ||||
-rw-r--r-- | firmware/target/arm/iriver/h10/lcd-h10_20gb.c | 21 |
2 files changed, 16 insertions, 7 deletions
diff --git a/firmware/export/config-h10.h b/firmware/export/config-h10.h index 921e31cf08..86d7cddca1 100644 --- a/firmware/export/config-h10.h +++ b/firmware/export/config-h10.h | |||
@@ -114,7 +114,7 @@ | |||
114 | /* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE | 114 | /* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE |
115 | * should be defined as well. | 115 | * should be defined as well. |
116 | * We can currently put the lcd to sleep but it won't wake up properly */ | 116 | * We can currently put the lcd to sleep but it won't wake up properly */ |
117 | /*#define HAVE_LCD_SLEEP*/ | 117 | #define HAVE_LCD_SLEEP |
118 | 118 | ||
119 | /* Offset ( in the firmware file's header ) to the file length */ | 119 | /* Offset ( in the firmware file's header ) to the file length */ |
120 | #define FIRMWARE_OFFSET_FILE_LENGTH 0 | 120 | #define FIRMWARE_OFFSET_FILE_LENGTH 0 |
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; | |||
37 | static int y_offset; | 37 | static 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. */ |
39 | static unsigned short disp_control_rev; | 39 | static unsigned short disp_control_rev; |
40 | /* Contrast setting << 8 */ | ||
41 | static int lcd_contrast; | ||
40 | 42 | ||
41 | /* Forward declarations */ | 43 | /* Forward declarations */ |
42 | static void lcd_display_off(void); | 44 | static 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 | ||
144 | void lcd_set_invert_display(bool yesno) | 152 | void 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 | ||
189 | static void lcd_power_on(void) | 198 | static 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); |