From d50d1df81797954d6970714ef97d63dc6c184e67 Mon Sep 17 00:00:00 2001 From: Boris Gjenero Date: Tue, 21 Apr 2009 21:49:29 +0000 Subject: [PATCH] FS#10129 - Start LCD sleep timer after PWM fadeout is complete git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20774 a1c6a512-1295-4272-9138-f99709370657 --- firmware/backlight.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/firmware/backlight.c b/firmware/backlight.c index 588867f1a5..05bf007210 100644 --- a/firmware/backlight.c +++ b/firmware/backlight.c @@ -205,7 +205,7 @@ static int lcd_sleep_timeout = 10*HZ; static const int lcd_sleep_timeout = LCD_SLEEP_TIMEOUT; #endif -static int lcd_sleep_timer = 0; +static int lcd_sleep_timer SHAREDDATA_ATTR = 0; void backlight_lcd_sleep_countdown(bool start) { @@ -220,7 +220,12 @@ void backlight_lcd_sleep_countdown(bool start) if (lcd_sleep_timeout < 0) { lcd_sleep_timer = 0; /* Setting == Always */ +#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_PWM) + /* Ensure lcd_sleep() is called from backlight_thread() */ + queue_post(&backlight_queue, LCD_SLEEP, 0); +#else lcd_sleep(); +#endif } else { @@ -304,6 +309,11 @@ static void backlight_isr(void) #endif timer_unregister(); bl_timer_active = false; + +#ifdef HAVE_LCD_SLEEP + if (bl_dim_current == 0) + backlight_lcd_sleep_countdown(true); +#endif } else timer_set_period(timer_period); @@ -320,6 +330,10 @@ static void backlight_switch(void) { _backlight_off_normal(); bl_dim_fraction = 0; + +#ifdef HAVE_LCD_SLEEP + backlight_lcd_sleep_countdown(true); +#endif } } @@ -388,11 +402,11 @@ static void _backlight_off(void) { bl_dim_target = bl_dim_fraction = 0; _backlight_off_normal(); - } #ifdef HAVE_LCD_SLEEP - backlight_lcd_sleep_countdown(true); + backlight_lcd_sleep_countdown(true); #endif + } } void backlight_set_fade_in(int value)