summaryrefslogtreecommitdiff
path: root/firmware/target/arm
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/ipod/1g2g/backlight-1g2g.c4
-rw-r--r--firmware/target/arm/ipod/3g/backlight-3g.c4
-rw-r--r--firmware/target/arm/ipod/lcd-gray.c22
3 files changed, 16 insertions, 14 deletions
diff --git a/firmware/target/arm/ipod/1g2g/backlight-1g2g.c b/firmware/target/arm/ipod/1g2g/backlight-1g2g.c
index 688fc2a213..0f4ae2f939 100644
--- a/firmware/target/arm/ipod/1g2g/backlight-1g2g.c
+++ b/firmware/target/arm/ipod/1g2g/backlight-1g2g.c
@@ -23,12 +23,12 @@
23 23
24void _backlight_on(void) 24void _backlight_on(void)
25{ 25{
26 outl(inl(0xc0001000) | 0x02, 0xc0001000); 26 LCD1_CONTROL |= 0x02;
27 lcd_set_backlight_inversion(true); 27 lcd_set_backlight_inversion(true);
28} 28}
29 29
30void _backlight_off(void) 30void _backlight_off(void)
31{ 31{
32 outl(inl(0xc0001000) & ~0x02, 0xc0001000); 32 LCD1_CONTROL &= ~0x02;
33 lcd_set_backlight_inversion(false); 33 lcd_set_backlight_inversion(false);
34} 34}
diff --git a/firmware/target/arm/ipod/3g/backlight-3g.c b/firmware/target/arm/ipod/3g/backlight-3g.c
index 41f8ba37cb..573b6c67c0 100644
--- a/firmware/target/arm/ipod/3g/backlight-3g.c
+++ b/firmware/target/arm/ipod/3g/backlight-3g.c
@@ -22,10 +22,10 @@
22 22
23void _backlight_on(void) 23void _backlight_on(void)
24{ 24{
25 outl(inl(0xc0001000) | 0x02, 0xc0001000); 25 LCD1_CONTROL |= 0x02;
26} 26}
27 27
28void _backlight_off(void) 28void _backlight_off(void)
29{ 29{
30 outl(inl(0xc0001000) & ~0x02, 0xc0001000); 30 LCD1_CONTROL &= ~0x02;
31} 31}
diff --git a/firmware/target/arm/ipod/lcd-gray.c b/firmware/target/arm/ipod/lcd-gray.c
index 9538d277af..131b52da96 100644
--- a/firmware/target/arm/ipod/lcd-gray.c
+++ b/firmware/target/arm/ipod/lcd-gray.c
@@ -126,10 +126,9 @@ void lcd_init_device(void)
126 lcd_cmd_and_data(R_DRV_WAVEFORM_CONTROL, 0x48); 126 lcd_cmd_and_data(R_DRV_WAVEFORM_CONTROL, 0x48);
127 /* C waveform, no EOR, 9 lines inversion */ 127 /* C waveform, no EOR, 9 lines inversion */
128 lcd_cmd_and_data(R_POWER_CONTROL, POWER_REG_H | 0xc); 128 lcd_cmd_and_data(R_POWER_CONTROL, POWER_REG_H | 0xc);
129 lcd_cmd_and_data(R_DISPLAY_CONTROL, 0x0015);
129#ifdef HAVE_BACKLIGHT_INVERSION 130#ifdef HAVE_BACKLIGHT_INVERSION
130 invert_display(); 131 invert_display();
131#else
132 lcd_cmd_and_data(R_DISPLAY_CONTROL, 0x0015);
133#endif 132#endif
134 lcd_set_flip(false); 133 lcd_set_flip(false);
135 lcd_cmd_and_data(R_ENTRY_MODE, 0x0000); 134 lcd_cmd_and_data(R_ENTRY_MODE, 0x0000);
@@ -162,10 +161,16 @@ void lcd_set_contrast(int val)
162#ifdef HAVE_BACKLIGHT_INVERSION 161#ifdef HAVE_BACKLIGHT_INVERSION
163static void invert_display(void) 162static void invert_display(void)
164{ 163{
165 if (lcd_inverted ^ lcd_backlit) 164 static bool last_invert = false;
166 lcd_cmd_and_data(R_DISPLAY_CONTROL, 0x0017); 165 bool new_invert = lcd_inverted ^ lcd_backlit;
167 else 166
168 lcd_cmd_and_data(R_DISPLAY_CONTROL, 0x0015); 167 if (new_invert != last_invert)
168 {
169 int oldlevel = disable_irq_save();
170 lcd_cmd_and_data(R_DISPLAY_CONTROL, new_invert? 0x0017 : 0x0015);
171 restore_irq(oldlevel);
172 last_invert = new_invert;
173 }
169} 174}
170 175
171void lcd_set_invert_display(bool yesno) 176void lcd_set_invert_display(bool yesno)
@@ -182,10 +187,7 @@ void lcd_set_backlight_inversion(bool yesno)
182#else 187#else
183void lcd_set_invert_display(bool yesno) 188void lcd_set_invert_display(bool yesno)
184{ 189{
185 if (yesno) 190 lcd_cmd_and_data(R_DISPLAY_CONTROL, yesno ? 0x0017 : 0x0015);
186 lcd_cmd_and_data(R_DISPLAY_CONTROL, 0x0017);
187 else
188 lcd_cmd_and_data(R_DISPLAY_CONTROL, 0x0015);
189} 191}
190#endif 192#endif
191 193