summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2007-04-12 22:12:13 +0000
committerJens Arnold <amiconn@rockbox.org>2007-04-12 22:12:13 +0000
commit47bf6c5a5ad1fd9143ab87328793b285230f74a3 (patch)
tree5199f2225a3dfc438bb1c4c5e9906f14664dfa43 /firmware
parent734278b7d1fde5e177c6842f49c16b9df8c353fa (diff)
downloadrockbox-47bf6c5a5ad1fd9143ab87328793b285230f74a3.tar.gz
rockbox-47bf6c5a5ad1fd9143ab87328793b285230f74a3.tar.bz2
rockbox-47bf6c5a5ad1fd9143ab87328793b285230f74a3.zip
Moved archos backlight code to target tree. Changed old mutlivalue CONFIG_BACKLIGHT to a simple HAVE_BACKLIGHT.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13136 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/backlight.c54
-rw-r--r--firmware/drivers/button.c16
-rw-r--r--firmware/export/backlight.h6
-rw-r--r--firmware/export/button.h2
-rw-r--r--firmware/export/config-e200.h3
-rw-r--r--firmware/export/config-fmrecorder.h2
-rw-r--r--firmware/export/config-gigabeat.h2
-rw-r--r--firmware/export/config-h10.h3
-rw-r--r--firmware/export/config-h100.h2
-rw-r--r--firmware/export/config-h10_5gb.h3
-rw-r--r--firmware/export/config-h120.h2
-rw-r--r--firmware/export/config-h300.h2
-rw-r--r--firmware/export/config-iaudiom5.h2
-rw-r--r--firmware/export/config-iaudiox5.h2
-rw-r--r--firmware/export/config-ifp7xx.h2
-rw-r--r--firmware/export/config-ipod3g.h2
-rw-r--r--firmware/export/config-ipod4g.h2
-rw-r--r--firmware/export/config-ipodcolor.h2
-rw-r--r--firmware/export/config-ipodmini.h2
-rw-r--r--firmware/export/config-ipodmini2g.h2
-rw-r--r--firmware/export/config-ipodnano.h2
-rw-r--r--firmware/export/config-ipodvideo.h2
-rw-r--r--firmware/export/config-ondiofm.h2
-rw-r--r--firmware/export/config-ondiosp.h2
-rw-r--r--firmware/export/config-player.h2
-rw-r--r--firmware/export/config-recorder.h2
-rw-r--r--firmware/export/config-recorderv2.h2
-rw-r--r--firmware/export/config-tpj1022.h3
-rw-r--r--firmware/export/config.h22
-rw-r--r--firmware/powermgmt.c2
-rw-r--r--firmware/target/arm/ipod/backlight-target.h1
-rw-r--r--firmware/target/arm/iriver/backlight-target.h1
-rw-r--r--firmware/target/arm/sandisk/sansa-e200/backlight-target.h1
-rw-r--r--firmware/target/arm/tatung/tpj1022/backlight-target.h1
-rw-r--r--firmware/target/coldfire/iaudio/m5/backlight-target.h1
-rw-r--r--firmware/target/coldfire/iaudio/x5/backlight-target.h1
-rw-r--r--firmware/target/coldfire/iriver/backlight-target.h1
-rw-r--r--firmware/target/sh/archos/fm_v2/backlight-target.h39
-rw-r--r--firmware/target/sh/archos/ondio/backlight-target.h47
-rw-r--r--firmware/target/sh/archos/player/backlight-target.h44
-rw-r--r--firmware/target/sh/archos/recorder/backlight-target.h39
41 files changed, 217 insertions, 113 deletions
diff --git a/firmware/backlight.c b/firmware/backlight.c
index 1ec8bf0933..8f5116b769 100644
--- a/firmware/backlight.c
+++ b/firmware/backlight.c
@@ -37,7 +37,7 @@
#ifdef HAVE_REMOTE_LCD
#include "lcd-remote.h"
#endif
-#if defined(TARGET_TREE) && !defined(SIMULATOR)
+#ifndef SIMULATOR
#include "backlight-target.h"
#endif
@@ -58,39 +58,9 @@ static inline void __backlight_set_brightness(int val)
(void)val;
}
#endif
-
-#else
-/* Basic low-level code that simply switches backlight on or off. Probably
- * a nice candidate for inclusion in the target/ dir. */
-#ifndef TARGET_TREE
-static inline void __backlight_on(void)
-{
-#if CONFIG_BACKLIGHT == BL_RTC
- /* Enable square wave */
- rtc_write(0x0a, rtc_read(0x0a) | 0x40);
-#elif CONFIG_BACKLIGHT == BL_PA14_LO /* Player */
- and_b(~0x40, &PADRH); /* drive and set low */
- or_b(0x40, &PAIORH);
-#elif CONFIG_BACKLIGHT == BL_PA14_HI /* Ondio */
- or_b(0x40, &PADRH); /* drive it high */
-#endif
-}
-
-static inline void __backlight_off(void)
-{
-#if CONFIG_BACKLIGHT == BL_RTC
- /* Disable square wave */
- rtc_write(0x0a, rtc_read(0x0a) & ~0x40);
-#elif CONFIG_BACKLIGHT == BL_PA14_LO /* Player */
- and_b(~0x40, &PAIORH); /* let it float (up) */
-#elif CONFIG_BACKLIGHT == BL_PA14_HI /* Ondio */
- and_b(~0x40, &PADRH); /* drive it low */
-#endif
-}
-#endif
#endif /* SIMULATOR */
-#if CONFIG_BACKLIGHT && !defined(BOOTLOADER)
+#if defined(HAVE_BACKLIGHT) && !defined(BOOTLOADER)
const signed char backlight_timeout_value[19] =
{
@@ -558,23 +528,15 @@ void backlight_init(void)
queue_init(&backlight_queue, true);
queue_set_irq_safe(&backlight_queue, true);
-#ifdef SIMULATOR
- /* do nothing */
-#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 */
+#ifndef SIMULATOR
if (__backlight_init())
{
-# if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
+# ifdef HAVE_BACKLIGHT_PWM_FADING
/* 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
- PACR1 &= ~0x3000; /* Set PA14 (backlight control) to GPIO */
- or_b(0x40, &PAIORH); /* ..and output */
#endif
backlight_on();
#ifdef HAVE_REMOTE_LCD
@@ -806,16 +768,14 @@ void backlight_set_brightness(int val)
}
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
-#else /* (CONFIG_BACKLIGHT == 0) || defined(BOOTLOADER)
+#else /* !defined(HAVE_BACKLIGHT) || defined(BOOTLOADER)
-- no backlight, empty dummy functions */
-#if defined(BOOTLOADER) && CONFIG_BACKLIGHT
+#if defined(BOOTLOADER) && defined(HAVE_BACKLIGHT)
void backlight_init(void)
{
-#ifdef __BACKLIGHT_INIT
__backlight_init();
__backlight_on();
-#endif
}
#endif
@@ -832,4 +792,4 @@ bool is_remote_backlight_on(void) {return true;}
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
void backlight_set_brightness(int val) { (void)val; }
#endif
-#endif /* CONFIG_BACKLIGHT && !defined(BOOTLOADER) */
+#endif /* defined(HAVE_BACKLIGHT) && !defined(BOOTLOADER) */
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index 889c7a688d..b20afe13f6 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -52,12 +52,12 @@ static long last_read; /* Last button status, for debouncing/filtering */
#ifdef HAVE_LCD_BITMAP
static bool flipped; /* buttons can be flipped to match the LCD flip */
#endif
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
static bool filter_first_keypress;
#ifdef HAVE_REMOTE_LCD
static bool remote_filter_first_keypress;
#endif
-#endif /* CONFIG_BACKLIGHT */
+#endif /* HAVE_BACKLIGHT */
#ifdef HAVE_HEADPHONE_DETECTION
bool phones_present = false;
#endif
@@ -80,7 +80,7 @@ static void button_tick(void)
static int repeat_count = 0;
static bool repeat = false;
static bool post = false;
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
static bool skip_release = false;
#ifdef HAVE_REMOTE_LCD
static bool skip_remote_release = false;
@@ -121,7 +121,7 @@ static void button_tick(void)
diff = btn ^ lastbtn;
if(diff && (btn & diff) == 0)
{
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
#ifdef HAVE_REMOTE_LCD
if(diff & BUTTON_REMOTE)
if(!skip_remote_release)
@@ -211,7 +211,7 @@ static void button_tick(void)
if (queue_empty(&button_queue))
{
queue_post(&button_queue, BUTTON_REPEAT | btn, 0);
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
#ifdef HAVE_REMOTE_LCD
skip_remote_release = false;
#endif
@@ -222,7 +222,7 @@ static void button_tick(void)
}
else
{
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
#ifdef HAVE_REMOTE_LCD
if (btn & BUTTON_REMOTE) {
if (!remote_filter_first_keypress || is_remote_backlight_on()
@@ -347,7 +347,7 @@ void button_init(void)
#ifdef HAVE_LCD_BITMAP
flipped = false;
#endif
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
filter_first_keypress = false;
#ifdef HAVE_REMOTE_LCD
remote_filter_first_keypress = false;
@@ -419,7 +419,7 @@ void button_set_flip(bool flip)
}
#endif /* HAVE_LCD_BITMAP */
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
void set_backlight_filter_keypress(bool value)
{
filter_first_keypress = value;
diff --git a/firmware/export/backlight.h b/firmware/export/backlight.h
index 2873666dd8..4b164c63d2 100644
--- a/firmware/export/backlight.h
+++ b/firmware/export/backlight.h
@@ -26,7 +26,7 @@ void backlight_on(void);
void backlight_off(void);
void backlight_set_timeout(int index);
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
void backlight_init(void);
#if defined(IAUDIO_X5) && !defined(SIMULATOR)
@@ -54,9 +54,9 @@ void lcd_set_sleep_after_backlight_off(int index);
extern const signed char lcd_sleep_timeout_value[];
#endif
-#else /* CONFIG_BACKLIGHT == 0 */
+#else /* !HAVE_BACKLIGHT */
#define backlight_init()
-#endif /* CONFIG_BACKLIGHT */
+#endif /* !HAVE_BACKLIGHT */
#ifdef HAVE_REMOTE_LCD
void remote_backlight_on(void);
diff --git a/firmware/export/button.h b/firmware/export/button.h
index ea3effcaba..f675824c3d 100644
--- a/firmware/export/button.h
+++ b/firmware/export/button.h
@@ -33,7 +33,7 @@ void button_clear_queue(void);
#ifdef HAVE_LCD_BITMAP
void button_set_flip(bool flip); /* turn 180 degrees */
#endif
-#if CONFIG_BACKLIGHT
+#ifdef HAVE_BACKLIGHT
void set_backlight_filter_keypress(bool value);
#ifdef HAVE_REMOTE_LCD
void set_remote_backlight_filter_keypress(bool value);
diff --git a/firmware/export/config-e200.h b/firmware/export/config-e200.h
index efcb7ebfd5..ccff38dbf2 100644
--- a/firmware/export/config-e200.h
+++ b/firmware/export/config-e200.h
@@ -69,8 +69,7 @@
#define CONFIG_TUNER_XTAL 32768 *//* TODO: what is this? */
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_H10 /* TODO: figure this out, probably not necessary
- because of 'target' stuff */
+#define HAVE_BACKLIGHT
#define BATTERY_CAPACITY_DEFAULT 750 /* default battery capacity */
diff --git a/firmware/export/config-fmrecorder.h b/firmware/export/config-fmrecorder.h
index e753808897..211dccb183 100644
--- a/firmware/export/config-fmrecorder.h
+++ b/firmware/export/config-fmrecorder.h
@@ -52,7 +52,7 @@
#define HAVE_SPDIF_IN
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */
+#define HAVE_BACKLIGHT
#define CONFIG_I2C I2C_PLAYREC
diff --git a/firmware/export/config-gigabeat.h b/firmware/export/config-gigabeat.h
index 9b56a1a616..ef6d8243b8 100644
--- a/firmware/export/config-gigabeat.h
+++ b/firmware/export/config-gigabeat.h
@@ -42,7 +42,7 @@
#define CONFIG_RTC RTC_S3C2440
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_GIGABEAT /* port controlled PWM */
+#define HAVE_BACKLIGHT
#define HAVE_LCD_ENABLE
diff --git a/firmware/export/config-h10.h b/firmware/export/config-h10.h
index 2b7f965294..4d372143f8 100644
--- a/firmware/export/config-h10.h
+++ b/firmware/export/config-h10.h
@@ -78,8 +78,7 @@
#define CONFIG_TUNER_XTAL 32768 *//* TODO: what is this? */
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_H10 /* TODO: figure this out, probably not necessary
- because of 'target' stuff */
+#define HAVE_BACKLIGHT
#define BATTERY_CAPACITY_DEFAULT 1550 /* default battery capacity */
diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h
index dbb499f3af..cc2bfd7178 100644
--- a/firmware/export/config-h100.h
+++ b/firmware/export/config-h100.h
@@ -56,7 +56,7 @@
#define CONFIG_LCD LCD_S1D15E06
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_IRIVER_H100 /* port controlled */
+#define HAVE_BACKLIGHT
/* We can fade the backlight by using PWM */
#define HAVE_BACKLIGHT_PWM_FADING
diff --git a/firmware/export/config-h10_5gb.h b/firmware/export/config-h10_5gb.h
index bbf3f2ffe6..3b3cebb8fb 100644
--- a/firmware/export/config-h10_5gb.h
+++ b/firmware/export/config-h10_5gb.h
@@ -72,8 +72,7 @@
#define CONFIG_TUNER_XTAL 32768 *//* TODO: what is this? */
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_H10 /* TODO: figure this out, probably not necessary
- because of target tree stuff */
+#define HAVE_BACKLIGHT
#define BATTERY_CAPACITY_DEFAULT 820 /* default battery capacity */
diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h
index f957f450d0..a0ad638fa2 100644
--- a/firmware/export/config-h120.h
+++ b/firmware/export/config-h120.h
@@ -51,7 +51,7 @@
#define CONFIG_LCD LCD_S1D15E06
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_IRIVER_H100 /* port controlled */
+#define HAVE_BACKLIGHT
/* We can fade the backlight by using PWM */
#define HAVE_BACKLIGHT_PWM_FADING
diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h
index ad80191885..0b2406bee7 100644
--- a/firmware/export/config-h300.h
+++ b/firmware/export/config-h300.h
@@ -51,7 +51,7 @@
#define HAVE_REMOTE_LCD
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_IRIVER_H300 /* port controlled PWM */
+#define HAVE_BACKLIGHT
/* Define this if you have a software controlled poweroff */
#define HAVE_SW_POWEROFF
diff --git a/firmware/export/config-iaudiom5.h b/firmware/export/config-iaudiom5.h
index bce3c47e5c..bcc843f125 100644
--- a/firmware/export/config-iaudiom5.h
+++ b/firmware/export/config-iaudiom5.h
@@ -64,7 +64,7 @@
#define CONFIG_LCD LCD_S1D15E06
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_M5 /* PCF50606 I2C */
+#define HAVE_BACKLIGHT
/* Define this if you have a software controlled poweroff */
#define HAVE_SW_POWEROFF
diff --git a/firmware/export/config-iaudiox5.h b/firmware/export/config-iaudiox5.h
index 57f8a68134..43c02a0ee5 100644
--- a/firmware/export/config-iaudiox5.h
+++ b/firmware/export/config-iaudiox5.h
@@ -66,7 +66,7 @@
#define CONFIG_LCD LCD_X5
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_X5 /* PCF50606 I2C */
+#define HAVE_BACKLIGHT
#define HAVE_BACKLIGHT_BRIGHTNESS
/* Define this if you have a software controlled poweroff */
diff --git a/firmware/export/config-ifp7xx.h b/firmware/export/config-ifp7xx.h
index 1b0ea17984..435b6ef984 100644
--- a/firmware/export/config-ifp7xx.h
+++ b/firmware/export/config-ifp7xx.h
@@ -77,7 +77,7 @@
#define ROM_START 0x00000000
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_IRIVER_IFP7XX /* port controlled */
+#define HAVE_BACKLIGHT
/* Define this to the CPU frequency */
#define CPU_FREQ 48000000
diff --git a/firmware/export/config-ipod3g.h b/firmware/export/config-ipod3g.h
index f3877cfdbc..ff91bcff49 100644
--- a/firmware/export/config-ipod3g.h
+++ b/firmware/export/config-ipod3g.h
@@ -64,7 +64,7 @@
#define HAVE_SW_TONE_CONTROLS
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_IPOD3G /* port controlled */
+#define HAVE_BACKLIGHT
#define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */
diff --git a/firmware/export/config-ipod4g.h b/firmware/export/config-ipod4g.h
index ab172afd2e..4a8d4f1bf2 100644
--- a/firmware/export/config-ipod4g.h
+++ b/firmware/export/config-ipod4g.h
@@ -70,7 +70,7 @@
#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_IPOD4G /* port controlled */
+#define HAVE_BACKLIGHT
#define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */
diff --git a/firmware/export/config-ipodcolor.h b/firmware/export/config-ipodcolor.h
index 5e3e5c3d62..41277041f1 100644
--- a/firmware/export/config-ipodcolor.h
+++ b/firmware/export/config-ipodcolor.h
@@ -61,7 +61,7 @@
#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_IPOD4G /* port controlled */
+#define HAVE_BACKLIGHT
#define BATTERY_CAPACITY_DEFAULT 700 /* default battery capacity */
diff --git a/firmware/export/config-ipodmini.h b/firmware/export/config-ipodmini.h
index 40987d6b2c..7fba883c9c 100644
--- a/firmware/export/config-ipodmini.h
+++ b/firmware/export/config-ipodmini.h
@@ -67,7 +67,7 @@
#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_IPODMINI /* port controlled */
+#define HAVE_BACKLIGHT
#define BATTERY_CAPACITY_DEFAULT 400 /* default battery capacity */
diff --git a/firmware/export/config-ipodmini2g.h b/firmware/export/config-ipodmini2g.h
index 80e2820339..55831c4cb3 100644
--- a/firmware/export/config-ipodmini2g.h
+++ b/firmware/export/config-ipodmini2g.h
@@ -67,7 +67,7 @@
#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_IPODMINI /* port controlled */
+#define HAVE_BACKLIGHT
/* We can fade the backlight by using PWM */
#define HAVE_BACKLIGHT_PWM_FADING
diff --git a/firmware/export/config-ipodnano.h b/firmware/export/config-ipodnano.h
index d32e45d17f..74bfe34d0f 100644
--- a/firmware/export/config-ipodnano.h
+++ b/firmware/export/config-ipodnano.h
@@ -61,7 +61,7 @@
#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_IPODNANO /* port controlled */
+#define HAVE_BACKLIGHT
/* We can fade the backlight by using PWM */
#define HAVE_BACKLIGHT_PWM_FADING
diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h
index f9cc50d520..e10a7f9e55 100644
--- a/firmware/export/config-ipodvideo.h
+++ b/firmware/export/config-ipodvideo.h
@@ -61,7 +61,7 @@
#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_IPODNANO /* port controlled */
+#define HAVE_BACKLIGHT
/* We can fade the backlight by using PWM */
#define HAVE_BACKLIGHT_PWM_FADING
diff --git a/firmware/export/config-ondiofm.h b/firmware/export/config-ondiofm.h
index 0e691b70e3..c168ecf588 100644
--- a/firmware/export/config-ondiofm.h
+++ b/firmware/export/config-ondiofm.h
@@ -40,7 +40,7 @@
#define CONFIG_CODEC MAS3587F
/* Enable this if you have done the backlight mod */
-//#define CONFIG_BACKLIGHT BL_PA14_HI
+//#define HAVE_BACKLIGHT
#define BATTERY_CAPACITY_DEFAULT 1000 /* default battery capacity */
diff --git a/firmware/export/config-ondiosp.h b/firmware/export/config-ondiosp.h
index da723413ec..1d3e98ac0a 100644
--- a/firmware/export/config-ondiosp.h
+++ b/firmware/export/config-ondiosp.h
@@ -33,7 +33,7 @@
#define CONFIG_CODEC MAS3539F
/* Enable this if you have done the backlight mod */
-//#define CONFIG_BACKLIGHT BL_PA14_HI
+//#define HAVE_BACKLIGHT
#define BATTERY_CAPACITY_DEFAULT 1000 /* default battery capacity */
diff --git a/firmware/export/config-player.h b/firmware/export/config-player.h
index 580831c861..0256db137f 100644
--- a/firmware/export/config-player.h
+++ b/firmware/export/config-player.h
@@ -25,7 +25,7 @@
#define HAVE_DAC3550A
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_PA14_LO /* port PA14, low active */
+#define HAVE_BACKLIGHT
#define BATTERY_CAPACITY_DEFAULT 1500 /* default battery capacity */
diff --git a/firmware/export/config-recorder.h b/firmware/export/config-recorder.h
index d8bd0bed2f..3fe7365d3c 100644
--- a/firmware/export/config-recorder.h
+++ b/firmware/export/config-recorder.h
@@ -46,7 +46,7 @@
#define HAVE_SPDIF_IN
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */
+#define HAVE_BACKLIGHT
#define CONFIG_I2C I2C_PLAYREC
diff --git a/firmware/export/config-recorderv2.h b/firmware/export/config-recorderv2.h
index 0e6e00c167..8211994275 100644
--- a/firmware/export/config-recorderv2.h
+++ b/firmware/export/config-recorderv2.h
@@ -49,7 +49,7 @@
#define HAVE_SPDIF_IN
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_RTC /* on I2C controlled RTC port */
+#define HAVE_BACKLIGHT
#define CONFIG_I2C I2C_PLAYREC
diff --git a/firmware/export/config-tpj1022.h b/firmware/export/config-tpj1022.h
index 5837b0f01f..02e7319cfe 100644
--- a/firmware/export/config-tpj1022.h
+++ b/firmware/export/config-tpj1022.h
@@ -55,8 +55,7 @@
#define AB_REPEAT_ENABLE 1
/* Define this for LCD backlight available */
-#define CONFIG_BACKLIGHT BL_TPJ1022 /* TODO: figure this out, probably not necessary
- because of 'target' stuff */
+#define HAVE_BACKLIGHT
#define BATTERY_CAPACITY_DEFAULT 1550 /* default battery capacity
TODO: check this, probably different
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 2d7b3e131a..0ad94e06b1 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -113,24 +113,6 @@
#define RGB565 565
#define RGB565SWAPPED 3553
-/* CONFIG_BACKLIGHT */
-#define BL_PA14_LO 1 /* Player, PA14 low active */
-#define BL_RTC 2 /* Recorder, RTC square wave output */
-#define BL_PA14_HI 3 /* Ondio, PA14 high active */
-#define BL_IRIVER_H100 4 /* IRiver GPIO */
-#define BL_IPOD4G 5 /* Apple iPod 4G */
-#define BL_IPODNANO 6 /* Apple iPod Nano and iPod Video*/
-#define BL_IPOD3G 7 /* Apple iPod 3g with dock */
-#define BL_IRIVER_H300 8 /* IRiver PWM */
-#define BL_IRIVER_IFP7XX 9 /* IRiver GPIO */
-#define BL_IPODMINI 10 /* Apple iPod Mini */
-#define BL_GIGABEAT 11 /* Toshiba Gigabeat */
-#define BL_H10 12 /* iriver H10 */
-#define BL_X5 13 /* iAudio X5 PCF50606 I2C */
-#define BL_H10_5GB 14 /* iriver H10 5/6GB */
-#define BL_TPJ1022 15 /* Tatung Elio TPJ-1022 */
-#define BL_M5 16 /* iAudio M5 PCF50606 I2C */
-
/* CONFIG_I2C */
#define I2C_PLAYREC 1 /* Archos Player/Recorder style */
#define I2C_ONDIO 2 /* Ondio style */
@@ -235,10 +217,6 @@
#define CONFIG_LED 0
#endif
-#ifndef CONFIG_BACKLIGHT
-#define CONFIG_BACKLIGHT 0
-#endif
-
#ifndef CONFIG_CHARGING
#define CONFIG_CHARGING 0
#endif
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index e1ec1a6017..3d87773394 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -708,7 +708,7 @@ static int runcurrent(void)
current = CURRENT_USB;
}
-#if CONFIG_BACKLIGHT && !defined(BOOTLOADER)
+#if defined(HAVE_BACKLIGHT) && !defined(BOOTLOADER)
if (backlight_get_current_timeout() == 0) /* LED always on */
current += CURRENT_BACKLIGHT;
#endif
diff --git a/firmware/target/arm/ipod/backlight-target.h b/firmware/target/arm/ipod/backlight-target.h
index d35dccdc4a..f4e34cb53a 100644
--- a/firmware/target/arm/ipod/backlight-target.h
+++ b/firmware/target/arm/ipod/backlight-target.h
@@ -19,6 +19,7 @@
#ifndef BACKLIGHT_TARGET_H
#define BACKLIGHT_TARGET_H
+#define __backlight_init() true
void __backlight_on(void);
void __backlight_off(void);
diff --git a/firmware/target/arm/iriver/backlight-target.h b/firmware/target/arm/iriver/backlight-target.h
index d35dccdc4a..f4e34cb53a 100644
--- a/firmware/target/arm/iriver/backlight-target.h
+++ b/firmware/target/arm/iriver/backlight-target.h
@@ -19,6 +19,7 @@
#ifndef BACKLIGHT_TARGET_H
#define BACKLIGHT_TARGET_H
+#define __backlight_init() true
void __backlight_on(void);
void __backlight_off(void);
diff --git a/firmware/target/arm/sandisk/sansa-e200/backlight-target.h b/firmware/target/arm/sandisk/sansa-e200/backlight-target.h
index 5b96ae5e7e..16a02a4d11 100644
--- a/firmware/target/arm/sandisk/sansa-e200/backlight-target.h
+++ b/firmware/target/arm/sandisk/sansa-e200/backlight-target.h
@@ -19,6 +19,7 @@
#ifndef BACKLIGHT_TARGET_H
#define BACKLIGHT_TARGET_H
+#define __backlight_init() true
void __backlight_on(void);
void __backlight_off(void);
void __backlight_set_brightness(int brightness);
diff --git a/firmware/target/arm/tatung/tpj1022/backlight-target.h b/firmware/target/arm/tatung/tpj1022/backlight-target.h
index b5fe2f7c5d..079a8ce8aa 100644
--- a/firmware/target/arm/tatung/tpj1022/backlight-target.h
+++ b/firmware/target/arm/tatung/tpj1022/backlight-target.h
@@ -22,6 +22,7 @@
#ifndef BACKLIGHT_TARGET_H
#define BACKLIGHT_TARGET_H
+#define __backlight_init() true
void __backlight_on(void);
void __backlight_off(void);
diff --git a/firmware/target/coldfire/iaudio/m5/backlight-target.h b/firmware/target/coldfire/iaudio/m5/backlight-target.h
index d9c116803e..824810baa1 100644
--- a/firmware/target/coldfire/iaudio/m5/backlight-target.h
+++ b/firmware/target/coldfire/iaudio/m5/backlight-target.h
@@ -19,7 +19,6 @@
#ifndef BACKLIGHT_TARGET_H
#define BACKLIGHT_TARGET_H
-#define __BACKLIGHT_INIT
bool __backlight_init(void);
void __backlight_on(void);
void __backlight_off(void);
diff --git a/firmware/target/coldfire/iaudio/x5/backlight-target.h b/firmware/target/coldfire/iaudio/x5/backlight-target.h
index e70bea08e4..6e03aaa76f 100644
--- a/firmware/target/coldfire/iaudio/x5/backlight-target.h
+++ b/firmware/target/coldfire/iaudio/x5/backlight-target.h
@@ -19,7 +19,6 @@
#ifndef BACKLIGHT_TARGET_H
#define BACKLIGHT_TARGET_H
-#define __BACKLIGHT_INIT
bool __backlight_init(void);
void __backlight_on(void);
void __backlight_off(void);
diff --git a/firmware/target/coldfire/iriver/backlight-target.h b/firmware/target/coldfire/iriver/backlight-target.h
index e653fa1ffb..30a57e4fbc 100644
--- a/firmware/target/coldfire/iriver/backlight-target.h
+++ b/firmware/target/coldfire/iriver/backlight-target.h
@@ -19,7 +19,6 @@
#ifndef BACKLIGHT_TARGET_H
#define BACKLIGHT_TARGET_H
-#define __BACKLIGHT_INIT
bool __backlight_init(void); /* Returns backlight current state (true=ON). */
void __backlight_on(void);
void __backlight_off(void);
diff --git a/firmware/target/sh/archos/fm_v2/backlight-target.h b/firmware/target/sh/archos/fm_v2/backlight-target.h
new file mode 100644
index 0000000000..834d10bdc6
--- /dev/null
+++ b/firmware/target/sh/archos/fm_v2/backlight-target.h
@@ -0,0 +1,39 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2007 by Jens Arnold
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#ifndef BACKLIGHT_TARGET_H
+#define BACKLIGHT_TARGET_H
+
+#include "config.h"
+#include "rtc.h"
+
+#define __backlight_init() true
+
+static inline void __backlight_on(void)
+{
+ /* Enable square wave */
+ rtc_write(0x0a, rtc_read(0x0a) | 0x40);
+}
+
+static inline void __backlight_off(void)
+{
+ /* Disable square wave */
+ rtc_write(0x0a, rtc_read(0x0a) & ~0x40);
+}
+
+#endif
diff --git a/firmware/target/sh/archos/ondio/backlight-target.h b/firmware/target/sh/archos/ondio/backlight-target.h
new file mode 100644
index 0000000000..9be66bd6a0
--- /dev/null
+++ b/firmware/target/sh/archos/ondio/backlight-target.h
@@ -0,0 +1,47 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2007 by Jens Arnold
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#ifndef BACKLIGHT_TARGET_H
+#define BACKLIGHT_TARGET_H
+
+#include "config.h"
+#include "cpu.h"
+
+#ifdef HAVE_BACKLIGHT
+/* A stock Ondio has no backlight, it needs a hardware mod. */
+
+static inline bool __backlight_init(void)
+{
+ PACR1 &= ~0x3000; /* Set PA14 (backlight control) to GPIO */
+ or_b(0x40, &PADRH); /* drive it high */
+ or_b(0x40, &PAIORH); /* ..and output */
+ return true;
+}
+
+static inline void __backlight_on(void)
+{
+ or_b(0x40, &PADRH); /* drive it high */
+}
+
+static inline void __backlight_off(void)
+{
+ and_b(~0x40, &PADRH); /* drive it low */
+}
+#endif /* HAVE_BACKLIGHT */
+
+#endif
diff --git a/firmware/target/sh/archos/player/backlight-target.h b/firmware/target/sh/archos/player/backlight-target.h
new file mode 100644
index 0000000000..d3bb7f39ed
--- /dev/null
+++ b/firmware/target/sh/archos/player/backlight-target.h
@@ -0,0 +1,44 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2007 by Jens Arnold
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#ifndef BACKLIGHT_TARGET_H
+#define BACKLIGHT_TARGET_H
+
+#include "config.h"
+#include "cpu.h"
+
+static inline bool __backlight_init(void)
+{
+ PACR1 &= ~0x3000; /* Set PA14 (backlight control) to GPIO */
+ and_b(~0x40, &PADRH); /* drive and set low */
+ or_b(0x40, &PAIORH); /* ..and output */
+ return true;
+}
+
+static inline void __backlight_on(void)
+{
+ and_b(~0x40, &PADRH); /* drive and set low */
+ or_b(0x40, &PAIORH);
+}
+
+static inline void __backlight_off(void)
+{
+ and_b(~0x40, &PAIORH); /* let it float (up) */
+}
+
+#endif
diff --git a/firmware/target/sh/archos/recorder/backlight-target.h b/firmware/target/sh/archos/recorder/backlight-target.h
new file mode 100644
index 0000000000..834d10bdc6
--- /dev/null
+++ b/firmware/target/sh/archos/recorder/backlight-target.h
@@ -0,0 +1,39 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2007 by Jens Arnold
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#ifndef BACKLIGHT_TARGET_H
+#define BACKLIGHT_TARGET_H
+
+#include "config.h"
+#include "rtc.h"
+
+#define __backlight_init() true
+
+static inline void __backlight_on(void)
+{
+ /* Enable square wave */
+ rtc_write(0x0a, rtc_read(0x0a) | 0x40);
+}
+
+static inline void __backlight_off(void)
+{
+ /* Disable square wave */
+ rtc_write(0x0a, rtc_read(0x0a) & ~0x40);
+}
+
+#endif