mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-08 20:55:17 -05:00
Remove the calls to backlight_lcd_sleep_countdown from target specific code and move it into backlight.c
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20793 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c40af94d12
commit
6abae1f124
11 changed files with 20 additions and 65 deletions
|
|
@ -210,7 +210,7 @@ static int lcd_sleep_timeout = 10*HZ;
|
||||||
|
|
||||||
static int lcd_sleep_timer SHAREDDATA_ATTR = 0;
|
static int lcd_sleep_timer SHAREDDATA_ATTR = 0;
|
||||||
|
|
||||||
void backlight_lcd_sleep_countdown(bool start)
|
static void backlight_lcd_sleep_countdown(bool start)
|
||||||
{
|
{
|
||||||
if (!start)
|
if (!start)
|
||||||
{
|
{
|
||||||
|
|
@ -223,8 +223,8 @@ void backlight_lcd_sleep_countdown(bool start)
|
||||||
if (lcd_sleep_timeout < 0)
|
if (lcd_sleep_timeout < 0)
|
||||||
{
|
{
|
||||||
lcd_sleep_timer = 0; /* Setting == Always */
|
lcd_sleep_timer = 0; /* Setting == Always */
|
||||||
#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_PWM)
|
|
||||||
/* Ensure lcd_sleep() is called from backlight_thread() */
|
/* Ensure lcd_sleep() is called from backlight_thread() */
|
||||||
|
#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_PWM)
|
||||||
queue_post(&backlight_queue, LCD_SLEEP, 0);
|
queue_post(&backlight_queue, LCD_SLEEP, 0);
|
||||||
#else
|
#else
|
||||||
lcd_sleep();
|
lcd_sleep();
|
||||||
|
|
@ -504,11 +504,19 @@ static void backlight_update_state(void)
|
||||||
queue_post(&backlight_queue, SYS_TIMEOUT, 0);
|
queue_post(&backlight_queue, SYS_TIMEOUT, 0);
|
||||||
#else
|
#else
|
||||||
_backlight_off();
|
_backlight_off();
|
||||||
|
#ifdef HAVE_LCD_SLEEP
|
||||||
|
backlight_lcd_sleep_countdown(true); /* start sleep countdown */
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
backlight_timer = timeout;
|
backlight_timer = timeout;
|
||||||
|
|
||||||
|
#ifdef HAVE_LCD_SLEEP
|
||||||
|
backlight_lcd_sleep_countdown(false); /* wake up lcd */
|
||||||
|
#endif
|
||||||
|
|
||||||
#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_SETTING) \
|
#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_SETTING) \
|
||||||
|| (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_HW_REG)
|
|| (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_HW_REG)
|
||||||
backlight_setup_fade_up();
|
backlight_setup_fade_up();
|
||||||
|
|
@ -670,7 +678,15 @@ void backlight_thread(void)
|
||||||
if (backlight_fading_state != NOT_FADING)
|
if (backlight_fading_state != NOT_FADING)
|
||||||
{
|
{
|
||||||
if ((_backlight_fade_step(backlight_fading_state)))
|
if ((_backlight_fade_step(backlight_fading_state)))
|
||||||
backlight_fading_state = NOT_FADING; /* finished fading */
|
{ /* finished fading */
|
||||||
|
#ifdef HAVE_LCD_SLEEP
|
||||||
|
if (backlight_fading_state == FADING_DOWN)
|
||||||
|
{ /* start sleep countdown */
|
||||||
|
backlight_lcd_sleep_countdown(true);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
backlight_fading_state = NOT_FADING;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif /* CONFIG_BACKLIGHT_FADING */
|
#endif /* CONFIG_BACKLIGHT_FADING */
|
||||||
|
|
|
||||||
|
|
@ -56,12 +56,9 @@ void backlight_hold_changed(bool hold_button);
|
||||||
void backlight_set_on_button_hold(int index);
|
void backlight_set_on_button_hold(int index);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LCD_SLEEP
|
#if defined(HAVE_LCD_SLEEP) && defined(HAVE_LCD_SLEEP_SETTING)
|
||||||
void backlight_lcd_sleep_countdown(bool start);
|
|
||||||
#ifdef HAVE_LCD_SLEEP_SETTING
|
|
||||||
void lcd_set_sleep_after_backlight_off(int index);
|
void lcd_set_sleep_after_backlight_off(int index);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#else /* !HAVE_BACKLIGHT */
|
#else /* !HAVE_BACKLIGHT */
|
||||||
#define backlight_init()
|
#define backlight_init()
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,6 @@ void _backlight_set_brightness(int brightness)
|
||||||
|
|
||||||
void _backlight_on(void)
|
void _backlight_on(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LCD_SLEEP
|
|
||||||
backlight_lcd_sleep_countdown(false); /* stop counter */
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_LCD_ENABLE
|
#ifdef HAVE_LCD_ENABLE
|
||||||
lcd_enable(true); /* power on lcd + visible display */
|
lcd_enable(true); /* power on lcd + visible display */
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -52,9 +49,6 @@ void _backlight_off(void)
|
||||||
#ifdef HAVE_LCD_ENABLE
|
#ifdef HAVE_LCD_ENABLE
|
||||||
lcd_enable(false); /* power off visible display */
|
lcd_enable(false); /* power off visible display */
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LCD_SLEEP
|
|
||||||
backlight_lcd_sleep_countdown(true); /* start countdown */
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _buttonlight_on(void)
|
void _buttonlight_on(void)
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,6 @@ void _backlight_set_brightness(int brightness)
|
||||||
|
|
||||||
void _backlight_on(void)
|
void _backlight_on(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LCD_SLEEP
|
|
||||||
backlight_lcd_sleep_countdown(false); /* stop counter */
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_LCD_ENABLE
|
#ifdef HAVE_LCD_ENABLE
|
||||||
lcd_enable(true); /* power on lcd + visible display */
|
lcd_enable(true); /* power on lcd + visible display */
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -53,9 +50,6 @@ void _backlight_off(void)
|
||||||
#ifdef HAVE_LCD_ENABLE
|
#ifdef HAVE_LCD_ENABLE
|
||||||
lcd_enable(false); /* power off visible display */
|
lcd_enable(false); /* power off visible display */
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LCD_SLEEP
|
|
||||||
backlight_lcd_sleep_countdown(true); /* start countdown */
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _buttonlight_on(void)
|
void _buttonlight_on(void)
|
||||||
|
|
|
||||||
|
|
@ -127,9 +127,6 @@ void _backlight_on(void)
|
||||||
|
|
||||||
mutex_lock(&backlight_mutex);
|
mutex_lock(&backlight_mutex);
|
||||||
|
|
||||||
#ifdef HAVE_LCD_SLEEP
|
|
||||||
backlight_lcd_sleep_countdown(false); /* stop counter */
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_LCD_ENABLE
|
#ifdef HAVE_LCD_ENABLE
|
||||||
lcd_enable(true);
|
lcd_enable(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -180,11 +177,6 @@ void _backlight_off(void)
|
||||||
0 << MC13783_LEDMDDC_POS,
|
0 << MC13783_LEDMDDC_POS,
|
||||||
MC13783_LEDMDDC);
|
MC13783_LEDMDDC);
|
||||||
|
|
||||||
#ifdef HAVE_LCD_SLEEP
|
|
||||||
/* Disable lcd after fade completes (when lcd_sleep timeout expires) */
|
|
||||||
backlight_lcd_sleep_countdown(true); /* start countdown */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
mutex_unlock(&backlight_mutex);
|
mutex_unlock(&backlight_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,6 @@
|
||||||
|
|
||||||
void _backlight_on(void)
|
void _backlight_on(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LCD_SLEEP
|
|
||||||
backlight_lcd_sleep_countdown(false); /* stop counter */
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_LCD_ENABLE
|
#ifdef HAVE_LCD_ENABLE
|
||||||
lcd_enable(true); /* power on lcd + visible display */
|
lcd_enable(true); /* power on lcd + visible display */
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -41,7 +38,4 @@ void _backlight_off(void)
|
||||||
#ifdef HAVE_LCD_ENABLE
|
#ifdef HAVE_LCD_ENABLE
|
||||||
lcd_enable(false); /* power off visible display */
|
lcd_enable(false); /* power off visible display */
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LCD_SLEEP
|
|
||||||
backlight_lcd_sleep_countdown(true); /* start countdown */
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,6 @@ void _backlight_set_brightness(int brightness)
|
||||||
|
|
||||||
void _backlight_on(void)
|
void _backlight_on(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LCD_SLEEP
|
|
||||||
backlight_lcd_sleep_countdown(false); /* stop counter */
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_LCD_ENABLE
|
#ifdef HAVE_LCD_ENABLE
|
||||||
lcd_enable(true); /* power on lcd + visible display */
|
lcd_enable(true); /* power on lcd + visible display */
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -52,9 +49,6 @@ void _backlight_off(void)
|
||||||
#ifdef HAVE_LCD_ENABLE
|
#ifdef HAVE_LCD_ENABLE
|
||||||
lcd_enable(false); /* power off visible display */
|
lcd_enable(false); /* power off visible display */
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LCD_SLEEP
|
|
||||||
backlight_lcd_sleep_countdown(true); /* start countdown */
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _buttonlight_on(void)
|
void _buttonlight_on(void)
|
||||||
|
|
|
||||||
|
|
@ -337,9 +337,6 @@ static void __backlight_dim(bool dim_now)
|
||||||
|
|
||||||
void _backlight_on(void)
|
void _backlight_on(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LCD_SLEEP
|
|
||||||
backlight_lcd_sleep_countdown(false); /* stop counter */
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_LCD_ENABLE
|
#ifdef HAVE_LCD_ENABLE
|
||||||
lcd_enable(true); /* power on lcd + visible display */
|
lcd_enable(true); /* power on lcd + visible display */
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -349,10 +346,6 @@ void _backlight_on(void)
|
||||||
void _backlight_off(void)
|
void _backlight_off(void)
|
||||||
{
|
{
|
||||||
__backlight_dim(true);
|
__backlight_dim(true);
|
||||||
#ifdef HAVE_LCD_SLEEP
|
|
||||||
/* Disable lcd after fade completes (when lcd_sleep timeout expires) */
|
|
||||||
backlight_lcd_sleep_countdown(true); /* start countdown */
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void __buttonlight_on(void)
|
static inline void __buttonlight_on(void)
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,6 @@ void _backlight_set_brightness(int brightness)
|
||||||
|
|
||||||
void _backlight_on(void)
|
void _backlight_on(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LCD_SLEEP
|
|
||||||
backlight_lcd_sleep_countdown(false); /* stop counter */
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_LCD_ENABLE
|
#ifdef HAVE_LCD_ENABLE
|
||||||
lcd_enable(true); /* power on lcd + visible display */
|
lcd_enable(true); /* power on lcd + visible display */
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -52,9 +49,6 @@ void _backlight_off(void)
|
||||||
#ifdef HAVE_LCD_ENABLE
|
#ifdef HAVE_LCD_ENABLE
|
||||||
lcd_enable(false); /* power off visible display */
|
lcd_enable(false); /* power off visible display */
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LCD_SLEEP
|
|
||||||
backlight_lcd_sleep_countdown(true); /* start countdown */
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _buttonlight_on(void)
|
void _buttonlight_on(void)
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,6 @@ static void _backlight_write_brightness(int brightness)
|
||||||
|
|
||||||
void _backlight_on(void)
|
void _backlight_on(void)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_LCD_SLEEP) && !defined(BOOTLOADER)
|
|
||||||
backlight_lcd_sleep_countdown(false); /* stop counter */
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_LCD_ENABLE
|
#ifdef HAVE_LCD_ENABLE
|
||||||
lcd_enable(true); /* power on lcd + visible display */
|
lcd_enable(true); /* power on lcd + visible display */
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -50,10 +47,6 @@ void _backlight_on(void)
|
||||||
void _backlight_off(void)
|
void _backlight_off(void)
|
||||||
{
|
{
|
||||||
_backlight_write_brightness(0);
|
_backlight_write_brightness(0);
|
||||||
#if defined(HAVE_LCD_SLEEP) && !defined(BOOTLOADER)
|
|
||||||
/* Disable lcd after fade completes (when lcd_sleep timeout expires) */
|
|
||||||
backlight_lcd_sleep_countdown(true); /* start countdown */
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Assumes that the backlight has been initialized */
|
/* Assumes that the backlight has been initialized */
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,6 @@ bool _backlight_init(void)
|
||||||
void _backlight_on(void)
|
void _backlight_on(void)
|
||||||
{
|
{
|
||||||
int level;
|
int level;
|
||||||
#ifdef HAVE_LCD_SLEEP
|
|
||||||
backlight_lcd_sleep_countdown(false); /* stop counter */
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_LCD_ENABLE
|
#ifdef HAVE_LCD_ENABLE
|
||||||
lcd_enable(true); /* power on lcd + visible display */
|
lcd_enable(true); /* power on lcd + visible display */
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -56,9 +53,6 @@ void _backlight_off(void)
|
||||||
#ifdef HAVE_LCD_ENABLE
|
#ifdef HAVE_LCD_ENABLE
|
||||||
lcd_enable(false); /* power off visible display */
|
lcd_enable(false); /* power off visible display */
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LCD_SLEEP
|
|
||||||
backlight_lcd_sleep_countdown(true); /* start countdown */
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set brightness by changing the PWM */
|
/* set brightness by changing the PWM */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue