summaryrefslogtreecommitdiff
path: root/firmware/target/coldfire
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2006-09-26 22:24:56 +0000
committerMichael Sevakis <jethead71@rockbox.org>2006-09-26 22:24:56 +0000
commit167c754b4785a175b4c26ecaaacef7d1e1647d1a (patch)
tree967dc55a196cbcdbd0bf683edc3e44e6e5b880fa /firmware/target/coldfire
parentaf401c2a4ef258146e55f1ace1e4d5e42029a790 (diff)
downloadrockbox-167c754b4785a175b4c26ecaaacef7d1e1647d1a.tar.gz
rockbox-167c754b4785a175b4c26ecaaacef7d1e1647d1a.zip
Fixed FS#5800 - 'LCD-sleep awake bug' on x5. Contrast setting is now preserved after LCD sleeps.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11075 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/coldfire')
-rwxr-xr-xfirmware/target/coldfire/iaudio/x5/lcd-x5.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/firmware/target/coldfire/iaudio/x5/lcd-x5.c b/firmware/target/coldfire/iaudio/x5/lcd-x5.c
index 9e905d8531..ca341928aa 100755
--- a/firmware/target/coldfire/iaudio/x5/lcd-x5.c
+++ b/firmware/target/coldfire/iaudio/x5/lcd-x5.c
@@ -41,6 +41,8 @@ static int y_offset;
41static int roll_offset; 41static int roll_offset;
42/* Reverse flag. Must be remembered when display is turned off. */ 42/* Reverse flag. Must be remembered when display is turned off. */
43static unsigned short disp_control_rev; 43static unsigned short disp_control_rev;
44/* Contrast setting << 8 */
45static int lcd_contrast;
44 46
45/* Forward declarations */ 47/* Forward declarations */
46static void lcd_display_off(void); 48static void lcd_display_off(void);
@@ -117,7 +119,10 @@ void lcd_set_contrast(int val)
117 else if (val > 30) 119 else if (val > 30)
118 val = 30; 120 val = 30;
119 121
120 lcd_write_reg(R_POWER_CONTROL5, 0x2018 + (val << 8)); 122 lcd_contrast = val << 8;
123
124 /* VCOMG=1, VDV4-0=xxxxx, VCM4-0=11000 */
125 lcd_write_reg(R_POWER_CONTROL5, 0x2018 | lcd_contrast);
121} 126}
122 127
123void lcd_set_invert_display(bool yesno) 128void lcd_set_invert_display(bool yesno)
@@ -192,14 +197,14 @@ static void lcd_power_on(void)
192 lcd_write_reg(R_POWER_CONTROL4, 0x0401); 197 lcd_write_reg(R_POWER_CONTROL4, 0x0401);
193 /* CAD=1 */ 198 /* CAD=1 */
194 lcd_write_reg(R_POWER_CONTROL2, 0x8000); 199 lcd_write_reg(R_POWER_CONTROL2, 0x8000);
195 /* VCOMG=0, VDV4-0=10011 (19), VCM4-0=11000 */ 200 /* VCOMG=0, VDV4-0=xxxxx, VCM4-0=11000 */
196 lcd_write_reg(R_POWER_CONTROL5, 0x1318); 201 lcd_write_reg(R_POWER_CONTROL5, 0x0018 | lcd_contrast);
197 /* Instruction (2) for power setting; BT2-0, DC2-0, AP2-0 */ 202 /* Instruction (2) for power setting; BT2-0, DC2-0, AP2-0 */
198 /* BT2-0=000, DC2-0=001, AP2-0=011, SLP=0, STB=0 */ 203 /* BT2-0=000, DC2-0=001, AP2-0=011, SLP=0, STB=0 */
199 lcd_write_reg(R_POWER_CONTROL1, 0x002c); 204 lcd_write_reg(R_POWER_CONTROL1, 0x002c);
200 /* Instruction (3) for power setting; VCOMG = "1" */ 205 /* Instruction (3) for power setting; VCOMG = "1" */
201 /* VCOMG=1, VDV4-0=10011 (19), VCM4-0=11000 */ 206 /* VCOMG=1, VDV4-0=xxxxx, VCM4-0=11000 */
202 lcd_write_reg(R_POWER_CONTROL5, 0x3318); 207 lcd_write_reg(R_POWER_CONTROL5, 0x2018 | lcd_contrast);
203 208
204 /* 40ms or more; time for step-up circuits 1,2 to stabilize */ 209 /* 40ms or more; time for step-up circuits 1,2 to stabilize */
205 sleep(HZ/25); 210 sleep(HZ/25);
@@ -276,8 +281,8 @@ static void lcd_power_off(void)
276 /* Step-up3,4 halt setting bit */ 281 /* Step-up3,4 halt setting bit */
277 /* VRL3-0=0100, PON=0, VRH3-0=0001 */ 282 /* VRL3-0=0100, PON=0, VRH3-0=0001 */
278 lcd_write_reg(R_POWER_CONTROL4, 0x0401); 283 lcd_write_reg(R_POWER_CONTROL4, 0x0401);
279 /* VCOMG=0, VDV4-0=10011, VCM4-0=11000 */ 284 /* VCOMG=0, VDV4-0=xxxxx, VCM4-0=11000 */
280 lcd_write_reg(R_POWER_CONTROL5, 0x1318); 285 lcd_write_reg(R_POWER_CONTROL5, 0x0018 | lcd_contrast);
281 286
282 /* Wait 100ms or more */ 287 /* Wait 100ms or more */
283 sleep(HZ/10); 288 sleep(HZ/10);
@@ -341,13 +346,15 @@ static void lcd_display_off(void)
341void lcd_init_device(void) 346void lcd_init_device(void)
342{ 347{
343 /* Reset settings */ 348 /* Reset settings */
344 y_offset = 0;
345 roll_offset = 0;
346 disp_control_rev = 0x0004;
347 349
348#ifdef BOOTLOADER 350#ifdef BOOTLOADER
349 /* Initial boot requires setting up chip registers but a full reset is 351 /* Initial boot requires setting up chip registers but a full reset is
350 not needed again. */ 352 not needed again. */
353 y_offset = 0;
354 roll_offset = 0;
355 disp_control_rev = 0x0004;
356 lcd_contrast = DEFAULT_CONTRAST_SETTING << 8;
357
351 power_on = false; 358 power_on = false;
352 display_on = false; 359 display_on = false;
353 360
@@ -365,6 +372,9 @@ void lcd_init_device(void)
365 /* Power and display already ON */ 372 /* Power and display already ON */
366 power_on = true; 373 power_on = true;
367 display_on = true; 374 display_on = true;
375 lcd_roll(0);
376 lcd_set_flip(false);
377 lcd_set_contrast(DEFAULT_CONTRAST_SETTING);
368#endif 378#endif
369} 379}
370 380