forked from len0rd/rockbox
Turn backlight ON at boot unless bootloader has already done that.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11992 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
0ea4d3197e
commit
73cd9f3b63
9 changed files with 35 additions and 17 deletions
|
|
@ -306,6 +306,8 @@ static void init(void)
|
||||||
cpu_boost(true);
|
cpu_boost(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
backlight_init();
|
||||||
|
|
||||||
buffer_init();
|
buffer_init();
|
||||||
|
|
||||||
settings_reset();
|
settings_reset();
|
||||||
|
|
@ -347,8 +349,6 @@ static void init(void)
|
||||||
m5636_init();
|
m5636_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
backlight_init();
|
|
||||||
|
|
||||||
button_init();
|
button_init();
|
||||||
|
|
||||||
powermgmt_init();
|
powermgmt_init();
|
||||||
|
|
|
||||||
|
|
@ -152,8 +152,8 @@ static int fade_in_count = 1;
|
||||||
static int fade_out_count = 4;
|
static int fade_out_count = 4;
|
||||||
|
|
||||||
static bool bl_timer_active = false;
|
static bool bl_timer_active = false;
|
||||||
static int bl_dim_current = BL_PWM_COUNT;
|
static int bl_dim_current = 0;
|
||||||
static int bl_dim_target = BL_PWM_COUNT;
|
static int bl_dim_target = 0;
|
||||||
static int bl_pwm_counter = 0;
|
static int bl_pwm_counter = 0;
|
||||||
static volatile int bl_cycle_counter = 0;
|
static volatile int bl_cycle_counter = 0;
|
||||||
static enum {DIM_STATE_START, DIM_STATE_MAIN} bl_dim_state = DIM_STATE_START;
|
static enum {DIM_STATE_START, DIM_STATE_MAIN} bl_dim_state = DIM_STATE_START;
|
||||||
|
|
@ -556,17 +556,21 @@ static void backlight_tick(void)
|
||||||
void backlight_init(void)
|
void backlight_init(void)
|
||||||
{
|
{
|
||||||
queue_init(&backlight_queue, true);
|
queue_init(&backlight_queue, true);
|
||||||
create_thread(backlight_thread, backlight_stack,
|
|
||||||
sizeof(backlight_stack), backlight_thread_name
|
|
||||||
IF_PRIO(, PRIORITY_SYSTEM));
|
|
||||||
tick_add_task(backlight_tick);
|
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
/* do nothing */
|
/* do nothing */
|
||||||
#elif defined(__BACKLIGHT_INIT)
|
#elif defined(__BACKLIGHT_INIT)
|
||||||
/* Remove the __BACKLIGHT_INIT references when __backlight_init is
|
/* Remove the __BACKLIGHT_INIT references when __backlight_init is
|
||||||
available on all backlighted targets. Take them out of the
|
available on all backlighted targets. Take them out of the
|
||||||
backlight-target.h files as well */
|
backlight-target.h files as well */
|
||||||
__backlight_init();
|
if (__backlight_init())
|
||||||
|
{
|
||||||
|
# if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
|
||||||
|
/* If backlight is already on, don't fade in. */
|
||||||
|
bl_dim_current = BL_PWM_COUNT;
|
||||||
|
bl_dim_target = BL_PWM_COUNT;
|
||||||
|
# endif
|
||||||
|
}
|
||||||
#elif CONFIG_BACKLIGHT == BL_PA14_LO || CONFIG_BACKLIGHT == BL_PA14_HI
|
#elif CONFIG_BACKLIGHT == BL_PA14_LO || CONFIG_BACKLIGHT == BL_PA14_HI
|
||||||
PACR1 &= ~0x3000; /* Set PA14 (backlight control) to GPIO */
|
PACR1 &= ~0x3000; /* Set PA14 (backlight control) to GPIO */
|
||||||
or_b(0x40, &PAIORH); /* ..and output */
|
or_b(0x40, &PAIORH); /* ..and output */
|
||||||
|
|
@ -575,6 +579,11 @@ void backlight_init(void)
|
||||||
#ifdef HAVE_REMOTE_LCD
|
#ifdef HAVE_REMOTE_LCD
|
||||||
remote_backlight_on();
|
remote_backlight_on();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
create_thread(backlight_thread, backlight_stack,
|
||||||
|
sizeof(backlight_stack), backlight_thread_name
|
||||||
|
IF_PRIO(, PRIORITY_SYSTEM));
|
||||||
|
tick_add_task(backlight_tick);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef X5_BACKLIGHT_SHUTDOWN
|
#ifdef X5_BACKLIGHT_SHUTDOWN
|
||||||
|
|
@ -803,6 +812,7 @@ void backlight_init(void)
|
||||||
{
|
{
|
||||||
#ifdef __BACKLIGHT_INIT
|
#ifdef __BACKLIGHT_INIT
|
||||||
__backlight_init();
|
__backlight_init();
|
||||||
|
__backlight_on();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ unsigned char charging_leds[] = { 0x00, 0x20, 0x38, 0x3C };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void __backlight_init(void)
|
bool __backlight_init(void)
|
||||||
{
|
{
|
||||||
backlight_control = BACKLIGHT_CONTROL_IDLE;
|
backlight_control = BACKLIGHT_CONTROL_IDLE;
|
||||||
|
|
||||||
|
|
@ -127,6 +127,8 @@ void __backlight_init(void)
|
||||||
initial_tick_delay = 2000;
|
initial_tick_delay = 2000;
|
||||||
/* put the led control on the tick list */
|
/* put the led control on the tick list */
|
||||||
tick_add_task(led_control_service);
|
tick_add_task(led_control_service);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ void __buttonlight_mode(enum buttonlight_mode mode,
|
||||||
unsigned short brightness);
|
unsigned short brightness);
|
||||||
|
|
||||||
|
|
||||||
void __backlight_init(void);
|
bool __backlight_init(void);
|
||||||
void __backlight_on(void);
|
void __backlight_on(void);
|
||||||
void __backlight_off(void);
|
void __backlight_off(void);
|
||||||
void __backlight_set_brightness(int val);
|
void __backlight_set_brightness(int val);
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
#define BACKLIGHT_TARGET_H
|
#define BACKLIGHT_TARGET_H
|
||||||
|
|
||||||
#define __BACKLIGHT_INIT
|
#define __BACKLIGHT_INIT
|
||||||
void __backlight_init(void);
|
bool __backlight_init(void);
|
||||||
void __backlight_on(void);
|
void __backlight_on(void);
|
||||||
void __backlight_off(void);
|
void __backlight_off(void);
|
||||||
void __backlight_set_brightness(int val);
|
void __backlight_set_brightness(int val);
|
||||||
|
|
|
||||||
|
|
@ -24,10 +24,12 @@
|
||||||
#include "pcf50606.h"
|
#include "pcf50606.h"
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
|
|
||||||
void __backlight_init(void)
|
bool __backlight_init(void)
|
||||||
{
|
{
|
||||||
__backlight_set_brightness(DEFAULT_BRIGHTNESS_SETTING);
|
__backlight_set_brightness(DEFAULT_BRIGHTNESS_SETTING);
|
||||||
__backlight_on();
|
__backlight_on();
|
||||||
|
|
||||||
|
return true; /* Backlight always ON after boot. */
|
||||||
}
|
}
|
||||||
|
|
||||||
void __backlight_on(void)
|
void __backlight_on(void)
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
#define BACKLIGHT_TARGET_H
|
#define BACKLIGHT_TARGET_H
|
||||||
|
|
||||||
#define __BACKLIGHT_INIT
|
#define __BACKLIGHT_INIT
|
||||||
void __backlight_init(void);
|
bool __backlight_init(void); /* Returns backlight current state (true=ON). */
|
||||||
void __backlight_on(void);
|
void __backlight_on(void);
|
||||||
void __backlight_off(void);
|
void __backlight_off(void);
|
||||||
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,13 @@
|
||||||
#include "backlight.h"
|
#include "backlight.h"
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
|
|
||||||
void __backlight_init(void)
|
/* Returns the current state of the backlight (true=ON, false=OFF). */
|
||||||
|
bool __backlight_init(void)
|
||||||
{
|
{
|
||||||
or_l(0x00020000, &GPIO1_ENABLE);
|
or_l(0x00020000, &GPIO1_ENABLE);
|
||||||
or_l(0x00020000, &GPIO1_FUNCTION);
|
or_l(0x00020000, &GPIO1_FUNCTION);
|
||||||
and_l(~0x00020000, &GPIO1_OUT); /* Start with the backlight ON */
|
|
||||||
|
return (GPIO1_OUT & 0x00020000) ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __backlight_on(void)
|
void __backlight_on(void)
|
||||||
|
|
|
||||||
|
|
@ -25,11 +25,13 @@
|
||||||
#include "pcf50606.h"
|
#include "pcf50606.h"
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
|
|
||||||
void __backlight_init(void)
|
bool __backlight_init(void)
|
||||||
{
|
{
|
||||||
or_l(0x00020000, &GPIO1_ENABLE);
|
or_l(0x00020000, &GPIO1_ENABLE);
|
||||||
or_l(0x00020000, &GPIO1_FUNCTION);
|
or_l(0x00020000, &GPIO1_FUNCTION);
|
||||||
or_l(0x00020000, &GPIO1_OUT); /* Start with the backlight ON */
|
or_l(0x00020000, &GPIO1_OUT); /* Start with the backlight ON */
|
||||||
|
|
||||||
|
return true; /* Backlight always ON after boot. */
|
||||||
}
|
}
|
||||||
|
|
||||||
void __backlight_on(void)
|
void __backlight_on(void)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue