Coldfire targets: Got the rest of the coldfire code out of backlight.c. Straightened up related items in configs and split backlight_set_brightness between the normal and boot/sim builds like the other functions. Should really have done all that in the first place.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11502 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
f669797d07
commit
58825f6e73
12 changed files with 99 additions and 86 deletions
|
@ -33,9 +33,6 @@
|
|||
#include "font.h"
|
||||
#include "adc.h"
|
||||
#include "backlight.h"
|
||||
#ifdef IAUDIO_X5
|
||||
#include "backlight-target.h"
|
||||
#endif
|
||||
#include "button.h"
|
||||
#include "panic.h"
|
||||
#include "power.h"
|
||||
|
@ -208,7 +205,7 @@ void main(void)
|
|||
|
||||
set_irq_level(0);
|
||||
lcd_init();
|
||||
__backlight_on();
|
||||
backlight_init();
|
||||
font_init();
|
||||
adc_init();
|
||||
button_init();
|
||||
|
|
|
@ -31,10 +31,6 @@
|
|||
#include "timer.h"
|
||||
#include "backlight.h"
|
||||
|
||||
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
||||
#include "pcf50606.h" /* iRiver, iAudio X5 brightness */
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
|
||||
#include "lcd.h" /* for lcd_enable() and lcd_sleep() */
|
||||
#endif
|
||||
|
@ -110,8 +106,6 @@ static void backlight_thread(void);
|
|||
static long backlight_stack[DEFAULT_STACK_SIZE/sizeof(long)];
|
||||
#ifdef X5_BACKLIGHT_SHUTDOWN
|
||||
#define BACKLIGHT_QUIT 256
|
||||
/* Need to save this for x5 shutdown */
|
||||
struct thread_entry* backlight_thread_id;
|
||||
#endif
|
||||
static const char backlight_thread_name[] = "backlight";
|
||||
static struct event_queue backlight_queue;
|
||||
|
@ -473,7 +467,7 @@ void backlight_thread(void)
|
|||
|
||||
#ifdef X5_BACKLIGHT_SHUTDOWN
|
||||
case BACKLIGHT_QUIT:
|
||||
remove_thread(backlight_thread_id);
|
||||
remove_thread(NULL);
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
@ -552,23 +546,17 @@ static void backlight_tick(void)
|
|||
void backlight_init(void)
|
||||
{
|
||||
queue_init(&backlight_queue, true);
|
||||
#ifdef X5_BACKLIGHT_SHUTDOWN
|
||||
backlight_thread_id =
|
||||
#endif
|
||||
create_thread(backlight_thread, backlight_stack,
|
||||
sizeof(backlight_stack), backlight_thread_name
|
||||
IF_PRIO(, PRIORITY_SYSTEM));
|
||||
tick_add_task(backlight_tick);
|
||||
#ifdef SIMULATOR
|
||||
/* do nothing */
|
||||
#elif CONFIG_BACKLIGHT == BL_IRIVER_H100
|
||||
or_l(0x00020000, &GPIO1_ENABLE);
|
||||
or_l(0x00020000, &GPIO1_FUNCTION);
|
||||
and_l(~0x00020000, &GPIO1_OUT); /* Start with the backlight ON */
|
||||
#elif CONFIG_BACKLIGHT == BL_IRIVER_H300
|
||||
or_l(0x00020000, &GPIO1_ENABLE);
|
||||
or_l(0x00020000, &GPIO1_FUNCTION);
|
||||
or_l(0x00020000, &GPIO1_OUT); /* Start with the backlight ON */
|
||||
#elif defined(__BACKLIGHT_INIT)
|
||||
/* Remove the __BACKLIGHT_INIT references when __backlight_init is
|
||||
available on all backlighted targets. Take them out of the
|
||||
backlight-target.h files as well */
|
||||
__backlight_init();
|
||||
#elif CONFIG_BACKLIGHT == BL_PA14_LO || CONFIG_BACKLIGHT == BL_PA14_HI
|
||||
PACR1 &= ~0x3000; /* Set PA14 (backlight control) to GPIO */
|
||||
or_b(0x40, &PAIORH); /* ..and output */
|
||||
|
@ -787,16 +775,26 @@ bool is_remote_backlight_on(void)
|
|||
|
||||
#endif /* HAVE_REMOTE_LCD */
|
||||
|
||||
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
||||
void backlight_set_brightness(int val)
|
||||
{
|
||||
if (val < MIN_BRIGHTNESS_SETTING)
|
||||
val = MIN_BRIGHTNESS_SETTING;
|
||||
else if (val > MAX_BRIGHTNESS_SETTING)
|
||||
val = MAX_BRIGHTNESS_SETTING;
|
||||
|
||||
__backlight_set_brightness(val);
|
||||
}
|
||||
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
|
||||
|
||||
#else /* !defined(CONFIG_BACKLIGHT) || defined(BOOTLOADER)
|
||||
-- no backlight, empty dummy functions */
|
||||
|
||||
#if defined(BOOTLOADER) && defined(CONFIG_BACKLIGHT)
|
||||
void backlight_init(void)
|
||||
{
|
||||
#ifdef IRIVER_H300_SERIES
|
||||
or_l(0x00020000, &GPIO1_OUT);
|
||||
or_l(0x00020000, &GPIO1_ENABLE);
|
||||
or_l(0x00020000, &GPIO1_FUNCTION);
|
||||
#ifdef __BACKLIGHT_INIT
|
||||
__backlight_init();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@ -810,21 +808,8 @@ void remote_backlight_on(void) {}
|
|||
void remote_backlight_off(void) {}
|
||||
void remote_backlight_set_timeout(int index) {(void)index;}
|
||||
bool is_remote_backlight_on(void) {return true;}
|
||||
#endif /* HAVE_REMOTE_LCD */
|
||||
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
||||
void backlight_set_brightness(int val) { (void)val; }
|
||||
#endif
|
||||
#endif /* defined(CONFIG_BACKLIGHT) && !defined(BOOTLOADER) */
|
||||
|
||||
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
||||
void backlight_set_brightness(int val)
|
||||
{
|
||||
#ifndef SIMULATOR
|
||||
if (val < MIN_BRIGHTNESS_SETTING)
|
||||
val = MIN_BRIGHTNESS_SETTING;
|
||||
else if (val > MAX_BRIGHTNESS_SETTING)
|
||||
val = MAX_BRIGHTNESS_SETTING;
|
||||
|
||||
__backlight_set_brightness(val);
|
||||
#else
|
||||
(void)val;
|
||||
#endif
|
||||
}
|
||||
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
|
||||
|
|
|
@ -154,13 +154,6 @@
|
|||
|
||||
#endif /* !SIMULATOR */
|
||||
|
||||
#define DEFAULT_CONTRAST_SETTING 28
|
||||
#define MIN_CONTRAST_SETTING 14 /* White screen a bit higher than this */
|
||||
#define MAX_CONTRAST_SETTING 63 /* Black screen a bit lower than this*/
|
||||
#define DEFAULT_REMOTE_CONTRAST_SETTING 42
|
||||
#define MIN_REMOTE_CONTRAST_SETTING MIN_CONTRAST_SETTING
|
||||
#define MAX_REMOTE_CONTRAST_SETTING MAX_CONTRAST_SETTING
|
||||
|
||||
/* Define this for S/PDIF input available */
|
||||
#define HAVE_SPDIF_IN
|
||||
|
||||
|
@ -173,3 +166,15 @@
|
|||
|
||||
/* Define this for FM radio input available */
|
||||
#define HAVE_FMRADIO_IN
|
||||
|
||||
/** Port-specific settings **/
|
||||
|
||||
/* Main LCD backlight brightness range and defaults */
|
||||
#define MIN_CONTRAST_SETTING 14 /* White screen a bit higher than this */
|
||||
#define MAX_CONTRAST_SETTING 63 /* Black screen a bit lower than this */
|
||||
#define DEFAULT_CONTRAST_SETTING 28
|
||||
|
||||
/* Remote LCD contrast range and defaults */
|
||||
#define MIN_REMOTE_CONTRAST_SETTING 5
|
||||
#define MAX_REMOTE_CONTRAST_SETTING 63
|
||||
#define DEFAULT_REMOTE_CONTRAST_SETTING 42
|
||||
|
|
|
@ -150,13 +150,6 @@
|
|||
|
||||
#endif /* !SIMULATOR */
|
||||
|
||||
#define DEFAULT_CONTRAST_SETTING 28
|
||||
#define MIN_CONTRAST_SETTING 14 /* White screen a bit higher than this */
|
||||
#define MAX_CONTRAST_SETTING 63 /* Black screen a bit lower than this*/
|
||||
#define DEFAULT_REMOTE_CONTRAST_SETTING 42
|
||||
#define MIN_REMOTE_CONTRAST_SETTING MIN_CONTRAST_SETTING
|
||||
#define MAX_REMOTE_CONTRAST_SETTING MAX_CONTRAST_SETTING
|
||||
|
||||
/* Define this for S/PDIF input available */
|
||||
#define HAVE_SPDIF_IN
|
||||
|
||||
|
@ -171,3 +164,15 @@
|
|||
|
||||
/* Define this if you have a serial port */
|
||||
/*#define HAVE_SERIAL*/
|
||||
|
||||
/** Port-specific settings **/
|
||||
|
||||
/* Main LCD backlight brightness range and defaults */
|
||||
#define DEFAULT_CONTRAST_SETTING 28
|
||||
#define MIN_CONTRAST_SETTING 14 /* White screen a bit higher than this */
|
||||
#define MAX_CONTRAST_SETTING 63 /* Black screen a bit lower than this */
|
||||
|
||||
/* Remote LCD contrast range and defaults */
|
||||
#define MIN_REMOTE_CONTRAST_SETTING 5
|
||||
#define MAX_REMOTE_CONTRAST_SETTING 63
|
||||
#define DEFAULT_REMOTE_CONTRAST_SETTING 42
|
||||
|
|
|
@ -151,6 +151,12 @@
|
|||
#define HAVE_EEPROM
|
||||
|
||||
#endif /* SIMULATOR */
|
||||
|
||||
/* Define this for FM radio input available */
|
||||
#define HAVE_FMRADIO_IN
|
||||
|
||||
/** Port-specific settings **/
|
||||
|
||||
/* Main LCD contrast range and defaults */
|
||||
#define MIN_CONTRAST_SETTING 5
|
||||
#define MAX_CONTRAST_SETTING 63
|
||||
|
@ -163,9 +169,6 @@
|
|||
#define DEFAULT_BRIGHTNESS_SETTING 9 /* 9/16 (56.25%) */
|
||||
|
||||
/* Remote LCD contrast range and defaults */
|
||||
#define MIN_REMOTE_CONTRAST_SETTING MIN_CONTRAST_SETTING
|
||||
#define MAX_REMOTE_CONTRAST_SETTING MAX_CONTRAST_SETTING
|
||||
#define MIN_REMOTE_CONTRAST_SETTING 5
|
||||
#define MAX_REMOTE_CONTRAST_SETTING 63
|
||||
#define DEFAULT_REMOTE_CONTRAST_SETTING 42
|
||||
|
||||
/* Define this for FM radio input available */
|
||||
#define HAVE_FMRADIO_IN
|
||||
|
|
|
@ -62,22 +62,6 @@
|
|||
|
||||
#define CONFIG_LCD LCD_X5
|
||||
|
||||
/* Main LCD contrast range and defaults */
|
||||
#define MIN_CONTRAST_SETTING 1
|
||||
#define MAX_CONTRAST_SETTING 30
|
||||
#define DEFAULT_CONTRAST_SETTING 19 /* Match boot contrast */
|
||||
|
||||
/* Remote LCD contrast range and defaults */
|
||||
#define MIN_REMOTE_CONTRAST_SETTING 10
|
||||
#define MAX_REMOTE_CONTRAST_SETTING 35
|
||||
#define DEFAULT_REMOTE_CONTRAST_SETTING 24 /* Match boot contrast */
|
||||
|
||||
/* Main LCD backlight brightness range and defaults */
|
||||
/* PCF50506 can output 0%-100% duty cycle but D305A expects %15-100%. */
|
||||
#define MIN_BRIGHTNESS_SETTING 1 /* 15/16 (93.75%) */
|
||||
#define MAX_BRIGHTNESS_SETTING 13 /* 3/16 (18.75%) */
|
||||
#define DEFAULT_BRIGHTNESS_SETTING 8 /* 8/16 (50.00%) = x5 boot default */
|
||||
|
||||
/* Define this for LCD backlight available */
|
||||
#define CONFIG_BACKLIGHT BL_X5 /* PCF50606 I2C */
|
||||
#define HAVE_BACKLIGHT_BRIGHTNESS
|
||||
|
@ -170,3 +154,21 @@
|
|||
|
||||
/* Define this for FM radio input available */
|
||||
#define HAVE_FMRADIO_IN
|
||||
|
||||
/** Port-specific settings **/
|
||||
|
||||
/* Main LCD contrast range and defaults */
|
||||
#define MIN_CONTRAST_SETTING 1
|
||||
#define MAX_CONTRAST_SETTING 30
|
||||
#define DEFAULT_CONTRAST_SETTING 19 /* Match boot contrast */
|
||||
|
||||
/* Main LCD backlight brightness range and defaults */
|
||||
/* PCF50506 can output 0%-100% duty cycle but D305A expects %15-100%. */
|
||||
#define MIN_BRIGHTNESS_SETTING 1 /* 15/16 (93.75%) */
|
||||
#define MAX_BRIGHTNESS_SETTING 13 /* 3/16 (18.75%) */
|
||||
#define DEFAULT_BRIGHTNESS_SETTING 8 /* 8/16 (50.00%) = x5 boot default */
|
||||
|
||||
/* Remote LCD contrast range and defaults */
|
||||
#define MIN_REMOTE_CONTRAST_SETTING 10
|
||||
#define MAX_REMOTE_CONTRAST_SETTING 35
|
||||
#define DEFAULT_REMOTE_CONTRAST_SETTING 24 /* Match boot contrast */
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#ifndef BACKLIGHT_TARGET_H
|
||||
#define BACKLIGHT_TARGET_H
|
||||
|
||||
#define __BACKLIGHT_INIT
|
||||
void __backlight_init(void);
|
||||
void __backlight_on(void);
|
||||
void __backlight_off(void);
|
||||
void __backlight_set_brightness(int val);
|
||||
|
|
|
@ -20,9 +20,16 @@
|
|||
#include "cpu.h"
|
||||
#include "system.h"
|
||||
#include "backlight.h"
|
||||
#include "backlight-target.h"
|
||||
#include "pcf50606.h"
|
||||
#include "lcd.h"
|
||||
|
||||
void __backlight_init(void)
|
||||
{
|
||||
__backlight_set_brightness(DEFAULT_BRIGHTNESS_SETTING);
|
||||
__backlight_on();
|
||||
}
|
||||
|
||||
void __backlight_on(void)
|
||||
{
|
||||
int level;
|
||||
|
|
|
@ -81,15 +81,6 @@ void pcf50606_init(void)
|
|||
pcf50606_write(0x39, 0x00); /* GPOOD0 = green led OFF */
|
||||
pcf50606_write(0x3a, 0x00); /* GPOOD1 = red led OFF */
|
||||
|
||||
pcf50606_write(0x35, 0x11); /* Backlight PWM = 512Hz, 8/16, Active */
|
||||
#ifdef BOOTLOADER
|
||||
/* Backlight starts OFF in bootloader */
|
||||
pcf50606_write(0x38, 0x80); /* Backlight OFF, GPO1INV=1, GPO1ACT=011 */
|
||||
#else
|
||||
/* Keep backlight on when changing to firmware */
|
||||
pcf50606_write(0x38, 0xb0); /* Backlight ON, GPO1INV=1, GPO1ACT=011 */
|
||||
#endif
|
||||
|
||||
/* Accessory detect */
|
||||
pcf50606_write(0x33, 0x8e); /* ACDAPE=1, THRSHLD=2.40V */
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#ifndef BACKLIGHT_TARGET_H
|
||||
#define BACKLIGHT_TARGET_H
|
||||
|
||||
#define __BACKLIGHT_INIT
|
||||
void __backlight_init(void);
|
||||
void __backlight_on(void);
|
||||
void __backlight_off(void);
|
||||
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
||||
|
|
|
@ -24,6 +24,13 @@
|
|||
#include "backlight.h"
|
||||
#include "lcd.h"
|
||||
|
||||
void __backlight_init(void)
|
||||
{
|
||||
or_l(0x00020000, &GPIO1_ENABLE);
|
||||
or_l(0x00020000, &GPIO1_FUNCTION);
|
||||
and_l(~0x00020000, &GPIO1_OUT); /* Start with the backlight ON */
|
||||
}
|
||||
|
||||
void __backlight_on(void)
|
||||
{
|
||||
and_l(~0x00020000, &GPIO1_OUT);
|
||||
|
|
|
@ -25,6 +25,13 @@
|
|||
#include "pcf50606.h"
|
||||
#include "lcd.h"
|
||||
|
||||
void __backlight_init(void)
|
||||
{
|
||||
or_l(0x00020000, &GPIO1_ENABLE);
|
||||
or_l(0x00020000, &GPIO1_FUNCTION);
|
||||
or_l(0x00020000, &GPIO1_OUT); /* Start with the backlight ON */
|
||||
}
|
||||
|
||||
void __backlight_on(void)
|
||||
{
|
||||
lcd_enable(true);
|
||||
|
|
Loading…
Reference in a new issue