diff options
author | Jens Arnold <amiconn@rockbox.org> | 2007-08-12 11:18:52 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2007-08-12 11:18:52 +0000 |
commit | 671f5d4412333f4ee101a5eb9a984dd21b5028e0 (patch) | |
tree | 57ab7a51ea7b17421e2c78f9f084ecb4f1ade694 /firmware/backlight.c | |
parent | 07a7d47cc1889a476418dc791599625d4e38a100 (diff) |
Removed special X5 backlight handling, and replaced it with a generic system that makes the backlight light up on shutdown and not time out unless it's completely disabled in the current player state.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14292 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/backlight.c')
-rw-r--r-- | firmware/backlight.c | 96 |
1 files changed, 42 insertions, 54 deletions
diff --git a/firmware/backlight.c b/firmware/backlight.c index 21d3ce945e..2ba4d6ed1d 100644 --- a/firmware/backlight.c +++ b/firmware/backlight.c @@ -90,9 +90,6 @@ const signed char backlight_timeout_value[19] = static void backlight_thread(void); static long backlight_stack[DEFAULT_STACK_SIZE/sizeof(long)]; -#ifdef X5_BACKLIGHT_SHUTDOWN -#define BACKLIGHT_QUIT 256 -#endif static const char backlight_thread_name[] = "backlight"; static struct event_queue backlight_queue; @@ -465,12 +462,47 @@ static void remote_backlight_update_state(void) void backlight_thread(void) { struct event ev; + bool locked = false; while(1) { queue_wait(&backlight_queue, &ev); switch(ev.id) - { + { /* These events must always be processed */ +#if defined(HAVE_BACKLIGHT_PWM_FADING) && defined(CPU_COLDFIRE) \ + && !defined(SIMULATOR) + case BACKLIGHT_UNBOOST_CPU: + cpu_boost(false); + break; +#endif + +#if defined(HAVE_REMOTE_LCD) && !defined(SIMULATOR) + /* Here for now or else the aggressive init messes up scrolling */ + case SYS_REMOTE_PLUGGED: + lcd_remote_on(); + lcd_remote_update(); + break; + + case SYS_REMOTE_UNPLUGGED: + lcd_remote_off(); + break; +#endif /* defined(HAVE_REMOTE_LCD) && !defined(SIMULATOR) */ + + case SYS_USB_CONNECTED: + /* Tell the USB thread that we are safe */ + DEBUGF("backlight_thread got SYS_USB_CONNECTED\n"); + usb_acknowledge(SYS_USB_CONNECTED_ACK); + break; + + case SYS_USB_DISCONNECTED: + usb_acknowledge(SYS_USB_DISCONNECTED_ACK); + break; + } + if (locked) + continue; + + switch(ev.id) + { /* These events are only processed if backlight isn't locked */ #ifdef HAVE_REMOTE_LCD case REMOTE_BACKLIGHT_ON: remote_backlight_update_state(); @@ -500,57 +532,26 @@ void backlight_thread(void) case BUTTON_LIGHT_ON: buttonlight_update_state(); break; + case BUTTON_LIGHT_OFF: button_backlight_timer = 0; _button_backlight_off(); break; #endif -#ifdef X5_BACKLIGHT_SHUTDOWN - case BACKLIGHT_QUIT: - remove_thread(NULL); - break; -#endif - -#if defined(HAVE_BACKLIGHT_PWM_FADING) && defined(CPU_COLDFIRE) \ - && !defined(SIMULATOR) - case BACKLIGHT_UNBOOST_CPU: - cpu_boost(false); - break; -#endif - -#if defined(HAVE_REMOTE_LCD) && !defined(SIMULATOR) - /* Here for now or else the aggressive init messes up scrolling */ - case SYS_REMOTE_PLUGGED: - lcd_remote_on(); - lcd_remote_update(); - break; - - case SYS_REMOTE_UNPLUGGED: - lcd_remote_off(); - break; -#endif /* defined(HAVE_REMOTE_LCD) && !defined(SIMULATOR) */ - + case SYS_POWEROFF: /* Lock backlight on poweroff so it doesn't */ + locked = true; /* go off before power is actually cut. */ + /* fall through */ #if CONFIG_CHARGING case SYS_CHARGER_CONNECTED: case SYS_CHARGER_DISCONNECTED: +#endif backlight_update_state(); #ifdef HAVE_REMOTE_LCD remote_backlight_update_state(); #endif break; -#endif /* CONFIG_CHARGING */ - - case SYS_USB_CONNECTED: - /* Tell the USB thread that we are safe */ - DEBUGF("backlight_thread got SYS_USB_CONNECTED\n"); - usb_acknowledge(SYS_USB_CONNECTED_ACK); - break; - - case SYS_USB_DISCONNECTED: - usb_acknowledge(SYS_USB_DISCONNECTED_ACK); - break; - } /* end switch */ + } } /* end while */ } @@ -628,19 +629,6 @@ void backlight_init(void) tick_add_task(backlight_tick); } -#ifdef X5_BACKLIGHT_SHUTDOWN -void x5_backlight_shutdown(void) -{ - /* Turn on the screen and don't let anyone else mess with it. Called - from clean_shutdown in misc.c. */ - queue_empty(&backlight_queue); - tick_remove_task(backlight_tick); - /* Next time the thread runs, if at all, it will just remove itself. */ - queue_post(&backlight_queue, BACKLIGHT_QUIT, 0); - __backlight_on(); -} -#endif /* X5_BACKLIGHT_SHUTDOWN */ - void backlight_on(void) { queue_remove_from_head(&backlight_queue, BACKLIGHT_ON); |