diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2008-05-14 19:29:25 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2008-05-14 19:29:25 +0000 |
commit | 009cebeab263085d142c413386f1fc7760792b6d (patch) | |
tree | b78e716cd627ad53bad8a51cad007b3a2a1fa421 /firmware/target/arm/s3c2440 | |
parent | bdc6e624bc7dd9c798a024a951b3da0dabf1ddc4 (diff) | |
download | rockbox-009cebeab263085d142c413386f1fc7760792b6d.tar.gz rockbox-009cebeab263085d142c413386f1fc7760792b6d.zip |
Straigten-out lcd sleeping on Gigabeat F/X. Add a service function to backlight.c to handle lcd sleep timer. Make HAVE_LCD_SLEEP useable without a setting and use HAVE_LCD_SLEEP_SETTING when a setting is available in addition to HCD_HAVE_SLEEP. If a setting isn't used, the target must define the timeout to be used in the config.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17505 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/s3c2440')
-rw-r--r-- | firmware/target/arm/s3c2440/gigabeat-fx/backlight-meg-fx.c | 16 | ||||
-rw-r--r-- | firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c | 38 |
2 files changed, 40 insertions, 14 deletions
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/backlight-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/backlight-meg-fx.c index 076c06b0d8..4fb66549cc 100644 --- a/firmware/target/arm/s3c2440/gigabeat-fx/backlight-meg-fx.c +++ b/firmware/target/arm/s3c2440/gigabeat-fx/backlight-meg-fx.c | |||
@@ -314,11 +314,6 @@ static void led_control_service(void) | |||
314 | sc606_control=SC606_CONTROL_IDLE; | 314 | sc606_control=SC606_CONTROL_IDLE; |
315 | break; | 315 | break; |
316 | } | 316 | } |
317 | |||
318 | if(sc606regCONFval&0x03) | ||
319 | lcd_enable(true); | ||
320 | else | ||
321 | lcd_enable(false); | ||
322 | } | 317 | } |
323 | #endif /* BOOTLOADER */ | 318 | #endif /* BOOTLOADER */ |
324 | 319 | ||
@@ -340,13 +335,22 @@ static void __backlight_dim(bool dim_now) | |||
340 | 335 | ||
341 | void _backlight_on(void) | 336 | void _backlight_on(void) |
342 | { | 337 | { |
343 | lcd_enable(true); | 338 | #ifdef HAVE_LCD_SLEEP |
339 | backlight_lcd_sleep_countdown(false); /* stop counter */ | ||
340 | #endif | ||
341 | #ifdef HAVE_LCD_ENABLE | ||
342 | lcd_enable(true); /* power on lcd + visible display */ | ||
343 | #endif | ||
344 | __backlight_dim(false); | 344 | __backlight_dim(false); |
345 | } | 345 | } |
346 | 346 | ||
347 | void _backlight_off(void) | 347 | void _backlight_off(void) |
348 | { | 348 | { |
349 | __backlight_dim(true); | 349 | __backlight_dim(true); |
350 | #ifdef HAVE_LCD_SLEEP | ||
351 | /* Disable lcd after fade completes (when lcd_sleep timeout expires) */ | ||
352 | backlight_lcd_sleep_countdown(true); /* start countdown */ | ||
353 | #endif | ||
350 | } | 354 | } |
351 | 355 | ||
352 | static inline void __buttonlight_on(void) | 356 | static inline void __buttonlight_on(void) |
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c index 37ac903418..5c268f42b8 100644 --- a/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c +++ b/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c | |||
@@ -26,7 +26,8 @@ | |||
26 | 26 | ||
27 | #define LCDADDR(x, y) (&lcd_framebuffer[(y)][(x)]) | 27 | #define LCDADDR(x, y) (&lcd_framebuffer[(y)][(x)]) |
28 | 28 | ||
29 | static volatile bool lcd_on = true; | 29 | static bool lcd_on = true; |
30 | static bool lcd_powered = true; | ||
30 | static unsigned lcd_yuv_options = 0; | 31 | static unsigned lcd_yuv_options = 0; |
31 | /* | 32 | /* |
32 | ** This is imported from lcd-16bit.c | 33 | ** This is imported from lcd-16bit.c |
@@ -174,6 +175,8 @@ void LCD_SPI_powerdown(void) | |||
174 | 0,0x04,1,0x00 | 175 | 0,0x04,1,0x00 |
175 | }; | 176 | }; |
176 | 177 | ||
178 | lcd_powered = false; | ||
179 | |||
177 | LCD_SPI_start(); | 180 | LCD_SPI_start(); |
178 | 181 | ||
179 | LCD_SPI_send(powerdncmd, sizeof(powerdncmd)); | 182 | LCD_SPI_send(powerdncmd, sizeof(powerdncmd)); |
@@ -198,6 +201,8 @@ void LCD_SPI_powerup(void) | |||
198 | LCD_SPI_send(powerupcmd, sizeof(powerupcmd)); | 201 | LCD_SPI_send(powerupcmd, sizeof(powerupcmd)); |
199 | 202 | ||
200 | LCD_SPI_stop(); | 203 | LCD_SPI_stop(); |
204 | |||
205 | lcd_powered = true; | ||
201 | } | 206 | } |
202 | 207 | ||
203 | void LCD_SPI_init(void) | 208 | void LCD_SPI_init(void) |
@@ -266,23 +271,40 @@ void lcd_init_device(void) | |||
266 | LCD_SPI_init(); | 271 | LCD_SPI_init(); |
267 | } | 272 | } |
268 | 273 | ||
274 | void lcd_sleep(void) | ||
275 | { | ||
276 | if (lcd_powered) | ||
277 | { | ||
278 | /* "not powered" implies "disabled" */ | ||
279 | if (lcd_on) | ||
280 | lcd_enable(false); | ||
281 | |||
282 | LCD_SPI_powerdown(); | ||
283 | } | ||
284 | } | ||
285 | |||
269 | void lcd_enable(bool state) | 286 | void lcd_enable(bool state) |
270 | { | 287 | { |
288 | if (state == lcd_on) | ||
289 | return; | ||
290 | |||
271 | if(state) | 291 | if(state) |
272 | { | 292 | { |
273 | if(!lcd_on) | 293 | /* "enabled" implies "powered" */ |
294 | if (!lcd_powered) | ||
274 | { | 295 | { |
275 | lcd_on = true; | ||
276 | lcd_update(); | ||
277 | LCD_SPI_powerup(); | 296 | LCD_SPI_powerup(); |
297 | /* Wait long enough for a frame to be written - yes, it | ||
298 | * takes awhile. */ | ||
299 | sleep(HZ/5); | ||
278 | } | 300 | } |
301 | |||
302 | lcd_on = true; | ||
303 | lcd_update(); | ||
279 | } | 304 | } |
280 | else | 305 | else |
281 | { | 306 | { |
282 | if(lcd_on) { | 307 | lcd_on = false; |
283 | lcd_on = false; | ||
284 | LCD_SPI_powerdown(); | ||
285 | } | ||
286 | } | 308 | } |
287 | } | 309 | } |
288 | 310 | ||