diff options
author | Jens Arnold <amiconn@rockbox.org> | 2008-04-04 17:33:39 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2008-04-04 17:33:39 +0000 |
commit | 8399749412ffd3487832f1eb3a16ea18fc8f5702 (patch) | |
tree | dee9dd02ea0f41af6600e5edcfbae92727e65ef3 | |
parent | aa9dbfef190d1789213ba51b9683cfddfd2c0417 (diff) | |
download | rockbox-8399749412ffd3487832f1eb3a16ea18fc8f5702.tar.gz rockbox-8399749412ffd3487832f1eb3a16ea18fc8f5702.zip |
1st/2nd Gen: Backlight inversion needs to be protected from interrupts, because it can happen any time, even while the greyscale lib or something else is writing to the LCD from an ISR. Also make backlight inversion only hit the LCD if necessary. * Use register definition in the 1st..3rd Gen backlight drivers.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16962 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/target/arm/ipod/1g2g/backlight-1g2g.c | 4 | ||||
-rw-r--r-- | firmware/target/arm/ipod/3g/backlight-3g.c | 4 | ||||
-rw-r--r-- | firmware/target/arm/ipod/lcd-gray.c | 22 |
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 | ||
24 | void _backlight_on(void) | 24 | void _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 | ||
30 | void _backlight_off(void) | 30 | void _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 | ||
23 | void _backlight_on(void) | 23 | void _backlight_on(void) |
24 | { | 24 | { |
25 | outl(inl(0xc0001000) | 0x02, 0xc0001000); | 25 | LCD1_CONTROL |= 0x02; |
26 | } | 26 | } |
27 | 27 | ||
28 | void _backlight_off(void) | 28 | void _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 |
163 | static void invert_display(void) | 162 | static 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 | ||
171 | void lcd_set_invert_display(bool yesno) | 176 | void lcd_set_invert_display(bool yesno) |
@@ -182,10 +187,7 @@ void lcd_set_backlight_inversion(bool yesno) | |||
182 | #else | 187 | #else |
183 | void lcd_set_invert_display(bool yesno) | 188 | void 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 | ||