diff options
| author | Michael Sevakis <jethead71@rockbox.org> | 2006-11-10 18:47:41 +0000 |
|---|---|---|
| committer | Michael Sevakis <jethead71@rockbox.org> | 2006-11-10 18:47:41 +0000 |
| commit | 58825f6e7391a237be85e63bee08f7a0bb66dc38 (patch) | |
| tree | 1324b528137ce35623eb3332f32d422331f80777 /firmware | |
| parent | f669797d077d081078407dd6dabf4e7389acf68f (diff) | |
| download | rockbox-58825f6e7391a237be85e63bee08f7a0bb66dc38.zip rockbox-58825f6e7391a237be85e63bee08f7a0bb66dc38.tar.gz rockbox-58825f6e7391a237be85e63bee08f7a0bb66dc38.tar.bz2 rockbox-58825f6e7391a237be85e63bee08f7a0bb66dc38.tar.xz | |
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
Diffstat (limited to 'firmware')
| -rw-r--r-- | firmware/backlight.c | 61 | ||||
| -rw-r--r-- | firmware/export/config-h100.h | 19 | ||||
| -rw-r--r-- | firmware/export/config-h120.h | 19 | ||||
| -rw-r--r-- | firmware/export/config-h300.h | 13 | ||||
| -rw-r--r-- | firmware/export/config-iaudiox5.h | 34 | ||||
| -rwxr-xr-x | firmware/target/coldfire/iaudio/x5/backlight-target.h | 2 | ||||
| -rwxr-xr-x | firmware/target/coldfire/iaudio/x5/backlight-x5.c | 7 | ||||
| -rw-r--r-- | firmware/target/coldfire/iaudio/x5/pcf50606-x5.c | 9 | ||||
| -rw-r--r-- | firmware/target/coldfire/iriver/backlight-target.h | 2 | ||||
| -rw-r--r-- | firmware/target/coldfire/iriver/h100/backlight-h100.c | 7 | ||||
| -rw-r--r-- | firmware/target/coldfire/iriver/h300/backlight-h300.c | 7 |
11 files changed, 98 insertions, 82 deletions
diff --git a/firmware/backlight.c b/firmware/backlight.c index e1d9258..bc692b1 100644 --- a/firmware/backlight.c +++ b/firmware/backlight.c @@ -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 -#endif /* defined(CONFIG_BACKLIGHT) && !defined(BOOTLOADER) */ - +#endif /* HAVE_REMOTE_LCD */ #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; +void backlight_set_brightness(int val) { (void)val; } #endif -} -#endif /* HAVE_BACKLIGHT_BRIGHTNESS */ +#endif /* defined(CONFIG_BACKLIGHT) && !defined(BOOTLOADER) */ diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h index 8ef2276..fd84f37 100644 --- a/firmware/export/config-h100.h +++ b/firmware/export/config-h100.h @@ -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 diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h index e4c5cfe..4a8a3c9 100644 --- a/firmware/export/config-h120.h +++ b/firmware/export/config-h120.h @@ -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 diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h index 14034c6..b44a2c5 100644 --- a/firmware/export/config-h300.h +++ b/firmware/export/config-h300.h @@ -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 diff --git a/firmware/export/config-iaudiox5.h b/firmware/export/config-iaudiox5.h index d45f58f..82c3643 100644 --- a/firmware/export/config-iaudiox5.h +++ b/firmware/export/config-iaudiox5.h @@ -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 */ diff --git a/firmware/target/coldfire/iaudio/x5/backlight-target.h b/firmware/target/coldfire/iaudio/x5/backlight-target.h index e982e65..e6feb8b 100755 --- a/firmware/target/coldfire/iaudio/x5/backlight-target.h +++ b/firmware/target/coldfire/iaudio/x5/backlight-target.h @@ -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); diff --git a/firmware/target/coldfire/iaudio/x5/backlight-x5.c b/firmware/target/coldfire/iaudio/x5/backlight-x5.c index 9d02c35..9b50993 100755 --- a/firmware/target/coldfire/iaudio/x5/backlight-x5.c +++ b/firmware/target/coldfire/iaudio/x5/backlight-x5.c @@ -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; diff --git a/firmware/target/coldfire/iaudio/x5/pcf50606-x5.c b/firmware/target/coldfire/iaudio/x5/pcf50606-x5.c index 5914066..b812861 100644 --- a/firmware/target/coldfire/iaudio/x5/pcf50606-x5.c +++ b/firmware/target/coldfire/iaudio/x5/pcf50606-x5.c @@ -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 */ diff --git a/firmware/target/coldfire/iriver/backlight-target.h b/firmware/target/coldfire/iriver/backlight-target.h index 086ab02..ac146ea 100644 --- a/firmware/target/coldfire/iriver/backlight-target.h +++ b/firmware/target/coldfire/iriver/backlight-target.h @@ -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 diff --git a/firmware/target/coldfire/iriver/h100/backlight-h100.c b/firmware/target/coldfire/iriver/h100/backlight-h100.c index 8ceac8a..62c24dc 100644 --- a/firmware/target/coldfire/iriver/h100/backlight-h100.c +++ b/firmware/target/coldfire/iriver/h100/backlight-h100.c @@ -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); diff --git a/firmware/target/coldfire/iriver/h300/backlight-h300.c b/firmware/target/coldfire/iriver/h300/backlight-h300.c index 50bd757..ef1d6d3 100644 --- a/firmware/target/coldfire/iriver/h300/backlight-h300.c +++ b/firmware/target/coldfire/iriver/h300/backlight-h300.c @@ -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); |