summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-01-26 23:21:49 +0000
committerThomas Martitz <kugel@rockbox.org>2009-01-26 23:21:49 +0000
commit12a0ed3b8dd5d8996abf827115f526e21e838872 (patch)
tree00ec62e04cf0e4bc4ea9c7bc0f5b8893e198c7cd
parent4e1b7bf7286c3994e34ca11f740a2165d9b5a001 (diff)
downloadrockbox-12a0ed3b8dd5d8996abf827115f526e21e838872.tar.gz
rockbox-12a0ed3b8dd5d8996abf827115f526e21e838872.tar.bz2
rockbox-12a0ed3b8dd5d8996abf827115f526e21e838872.zip
Commit FS#9724, which reworks the preprocessor defines related to backlight fading to a CONFIG_BACKLIGHT_FADING style. The apps/ code will only see which setting is supposed to be used, specific backlight fading handling is kept in firmware, slightly reword the manual text about software fading too with regards to the Gigabeat S
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19860 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/features.txt10
-rw-r--r--apps/menus/display_menu.c10
-rw-r--r--apps/settings.c5
-rw-r--r--apps/settings.h5
-rw-r--r--apps/settings_list.c7
-rw-r--r--firmware/SOURCES5
-rw-r--r--firmware/backlight-sw-fading.c2
-rw-r--r--firmware/backlight.c63
-rw-r--r--firmware/export/backlight-sw-fading.h5
-rw-r--r--firmware/export/backlight.h6
-rw-r--r--firmware/export/config-c200.h21
-rw-r--r--firmware/export/config-c200v2.h6
-rw-r--r--firmware/export/config-cowond2.h10
-rw-r--r--firmware/export/config-e200.h9
-rw-r--r--firmware/export/config-e200v2.h21
-rw-r--r--firmware/export/config-fuze.h21
-rw-r--r--firmware/export/config-gigabeat-s.h5
-rw-r--r--firmware/export/config-h100.h2
-rw-r--r--firmware/export/config-h120.h2
-rw-r--r--firmware/export/config-h300.h8
-rw-r--r--firmware/export/config-iaudiox5.h8
-rw-r--r--firmware/export/config-ipodmini.h2
-rw-r--r--firmware/export/config-ipodmini2g.h2
-rw-r--r--firmware/export/config-ipodnano.h5
-rw-r--r--firmware/export/config-ipodvideo.h5
-rw-r--r--firmware/export/config-mrobe100.h2
-rwxr-xr-xfirmware/export/config-sa9200.h3
-rw-r--r--firmware/export/config.h51
-rw-r--r--firmware/target/arm/as3525/backlight-e200v2-fuze.c4
-rw-r--r--firmware/target/arm/ipod/backlight-target.h3
-rw-r--r--firmware/target/arm/philips/sa9200/backlight-sa9200.c7
-rw-r--r--firmware/target/arm/sandisk/backlight-c200_e200.c7
-rw-r--r--manual/configure_rockbox/display_options.tex8
33 files changed, 169 insertions, 161 deletions
diff --git a/apps/features.txt b/apps/features.txt
index 4fbf427a23..4980944605 100644
--- a/apps/features.txt
+++ b/apps/features.txt
@@ -20,12 +20,10 @@ albumart
backlight_brightness
#endif
-#if defined(HAVE_BACKLIGHT_PWM_FADING)
-backlight_fade_pwm
-#elif defined(USE_BACKLIGHT_SW_FADING)
-backlight_fade_sw
-#elif defined(USE_BACKLIGHT_CUSTOM_FADING_BOOL)
-backlight_fade_custom_bool
+#if defined(HAVE_BACKLIGHT_FADING_INT_SETTING)
+backlight_fade_int
+#elif defined(HAVE_BACKLIGHT_FADING_BOOL_SETTING)
+backlight_fade_bool
#endif
#if BATTERY_TYPES_COUNT > 1
diff --git a/apps/menus/display_menu.c b/apps/menus/display_menu.c
index 488b0ff570..dbc7206b91 100644
--- a/apps/menus/display_menu.c
+++ b/apps/menus/display_menu.c
@@ -91,9 +91,8 @@ MENUITEM_SETTING(backlight_on_button_hold,
&global_settings.backlight_on_button_hold, NULL);
#endif
MENUITEM_SETTING(caption_backlight, &global_settings.caption_backlight, NULL);
-#if (defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)) || \
- defined(USE_BACKLIGHT_SW_FADING) || \
- defined(USE_BACKLIGHT_CUSTOM_FADING_BOOL)
+#if defined(HAVE_BACKLIGHT_FADING_INT_SETTING) \
+ || defined(HAVE_BACKLIGHT_FADING_BOOL_SETTING)
MENUITEM_SETTING(backlight_fade_in, &global_settings.backlight_fade_in, NULL);
MENUITEM_SETTING(backlight_fade_out, &global_settings.backlight_fade_out, NULL);
#endif
@@ -132,9 +131,8 @@ MAKE_MENU(lcd_settings,ID2P(LANG_LCD_MENU),
,&backlight_on_button_hold
# endif
,&caption_backlight
-#if (defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)) || \
- defined(USE_BACKLIGHT_SW_FADING) || \
- defined(USE_BACKLIGHT_CUSTOM_FADING_BOOL)
+#if defined(HAVE_BACKLIGHT_FADING_INT_SETTING) \
+ || defined(HAVE_BACKLIGHT_FADING_BOOL_SETTING)
,&backlight_fade_in, &backlight_fade_out
#endif
,&bl_filter_first_keypress
diff --git a/apps/settings.c b/apps/settings.c
index 42fb4dad5d..7bbbe92a9b 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -773,9 +773,8 @@ void settings_apply(bool read_disk)
#if CONFIG_CHARGING
backlight_set_timeout_plugged(global_settings.backlight_timeout_plugged);
#endif
-#if (defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)) \
- || defined(USE_BACKLIGHT_SW_FADING) \
- || defined(USE_BACKLIGHT_CUSTOM_FADING_BOOL)
+#if defined(HAVE_BACKLIGHT_FADING_INT_SETTING) \
+ || defined(HAVE_BACKLIGHT_FADING_BOOL_SETTING)
backlight_set_fade_in(global_settings.backlight_fade_in);
backlight_set_fade_out(global_settings.backlight_fade_out);
#endif
diff --git a/apps/settings.h b/apps/settings.h
index efa50f78dd..50c53718f7 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -681,11 +681,10 @@ struct user_settings
int lcd_sleep_after_backlight_off; /* when to put lcd to sleep after backlight
has turned off */
#endif
-#if defined(HAVE_BACKLIGHT_PWM_FADING)
+#if defined(HAVE_BACKLIGHT_FADING_INT_SETTING)
int backlight_fade_in; /* backlight fade in timing: 0..3 */
int backlight_fade_out; /* backlight fade in timing: 0..7 */
-#elif defined(USE_BACKLIGHT_SW_FADING) \
- || defined(USE_BACKLIGHT_CUSTOM_FADING_BOOL)
+#elif defined(HAVE_BACKLIGHT_FADING_BOOL_SETTING)
bool backlight_fade_in;
bool backlight_fade_out;
#endif
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 3618c16aa2..c855c70e10 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -671,15 +671,14 @@ const struct settings_list settings[] = {
OFFON_SETTING(0, remote_caption_backlight, LANG_CAPTION_BACKLIGHT,
false, "remote caption backlight", NULL),
#endif
-#endif /* HAVE_BACKLIGHT */
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
INT_SETTING(F_NO_WRAP, brightness, LANG_BRIGHTNESS,
DEFAULT_BRIGHTNESS_SETTING, "brightness",UNIT_INT,
MIN_BRIGHTNESS_SETTING, MAX_BRIGHTNESS_SETTING, 1,
NULL, NULL, backlight_set_brightness),
#endif
-#if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
/* backlight fading */
+#if defined(HAVE_BACKLIGHT_FADING_INT_SETTING)
TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, backlight_fade_in,
LANG_BACKLIGHT_FADE_IN, 300, "backlight fade in", "off",
UNIT_MS, formatter_unit_0_is_off, getlang_unit_0_is_off,
@@ -689,13 +688,13 @@ const struct settings_list settings[] = {
UNIT_MS, formatter_unit_0_is_off, getlang_unit_0_is_off,
backlight_set_fade_out, 10,
0,100,200,300,500,1000,2000,3000,5000,10000),
-#elif defined(USE_BACKLIGHT_SW_FADING) \
- || defined(USE_BACKLIGHT_CUSTOM_FADING_BOOL)
+#elif defined(HAVE_BACKLIGHT_FADING_BOOL_SETTING)
OFFON_SETTING(0, backlight_fade_in, LANG_BACKLIGHT_FADE_IN,
true, "backlight fade in", backlight_set_fade_in),
OFFON_SETTING(0, backlight_fade_out, LANG_BACKLIGHT_FADE_OUT,
true, "backlight fade out", backlight_set_fade_out),
#endif
+#endif /* HAVE_BACKLIGHT */
INT_SETTING(F_PADTITLE, scroll_speed, LANG_SCROLL_SPEED, 9,"scroll speed",
UNIT_INT, 0, 15, 1, NULL, NULL, lcd_scroll_speed),
INT_SETTING(F_PADTITLE, scroll_delay, LANG_SCROLL_DELAY, 1000,
diff --git a/firmware/SOURCES b/firmware/SOURCES
index c8c38ceee2..8783c3a080 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -96,9 +96,10 @@ drivers/lcd-remote-2bit-vi.c
#endif /* LCD_REMOTE_DEPTH */
#endif /* HAVE_REMOTE_LCD */
-#ifdef USE_BACKLIGHT_SW_FADING
+#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_SETTING) \
+ || (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_HW_REG)
backlight-sw-fading.c
-#endif /* USE_BACKLIGHT_SW_FADING */
+#endif /* CONFIG_BACKLIGHT_FADING */
/* Misc. */
drivers/led.c
diff --git a/firmware/backlight-sw-fading.c b/firmware/backlight-sw-fading.c
index d7987567ce..b9c9587cf4 100644
--- a/firmware/backlight-sw-fading.c
+++ b/firmware/backlight-sw-fading.c
@@ -30,7 +30,7 @@
/* To adapt a target do:
* - make sure _backlight_on doesn't set the brightness to something other than
* the previous value (lowest brightness in most cases)
- * - #define USE_BACKLIGHT_SW_FADING in config-<target>.h
+ * add proper #defines for software fading
*/
/* can be MIN_BRIGHTNESS_SETTING-1 */
diff --git a/firmware/backlight.c b/firmware/backlight.c
index c598a9528f..9c153e885a 100644
--- a/firmware/backlight.c
+++ b/firmware/backlight.c
@@ -52,7 +52,8 @@
int backlight_brightness = DEFAULT_BRIGHTNESS_SETTING;
#endif
-#ifdef USE_BACKLIGHT_SW_FADING
+#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_SETTING) \
+ || (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_HW_REG)
#include "backlight-sw-fading.h"
#endif
#ifdef SIMULATOR
@@ -230,14 +231,15 @@ void backlight_lcd_sleep_countdown(bool start)
}
#endif /* HAVE_LCD_SLEEP */
-#ifdef USE_BACKLIGHT_SW_FADING
+#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_SETTING) \
+ || (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_HW_REG)
static int backlight_fading_type = (FADING_UP|FADING_DOWN);
static int backlight_fading_state = NOT_FADING;
#endif
-#if defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR)
/* backlight fading */
+#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_PWM)
#define BL_PWM_INTERVAL 5 /* Cycle interval in ms */
#define BL_PWM_BITS 8
#define BL_PWM_COUNT (1<<BL_PWM_BITS)
@@ -410,9 +412,9 @@ void backlight_set_fade_out(int value)
else
bl_fade_out_step = 0;
}
-#endif /* defined(HAVE_BACKLIGHT_PWM_FADING) && !defined(SIMULATOR) */
-#ifdef USE_BACKLIGHT_SW_FADING
+#elif (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_SETTING) \
+ || (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_HW_REG)
void backlight_set_fade_out(bool value)
{
@@ -430,7 +432,7 @@ void backlight_set_fade_in(bool value)
backlight_fading_type &= FADING_DOWN;
}
-static void backlight_set_up_fade_up(void)
+static void backlight_setup_fade_up(void)
{
if (backlight_fading_type & FADING_UP)
{
@@ -450,7 +452,7 @@ static void backlight_set_up_fade_up(void)
}
}
-static void backlight_set_up_fade_down(void)
+static void backlight_setup_fade_down(void)
{
if (backlight_fading_type & FADING_DOWN)
{
@@ -461,16 +463,14 @@ static void backlight_set_up_fade_down(void)
backlight_fading_state = NOT_FADING;
_backlight_fade_update_state(MIN_BRIGHTNESS_SETTING-1);
_backlight_off();
- /* h300/x5/d2 go to the last known brightness level at backight_on(),which
- * should be the lowest level to keep fading up glitch free
- * targets which set brightness over AS3514 I2C make the backlight on only
- * by setting the brightness, so this step would be noticeable */
-#if !defined(HAVE_AS3514)
+#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_HW_REG)
+ /* write the lowest brightness level to the hardware so that
+ * fading up is glitch free */
_backlight_set_brightness(MIN_BRIGHTNESS_SETTING);
#endif
}
}
-#endif /* USE_BACKLIGHT_SW_FADING */
+#endif /* CONFIG_BACKLIGHT_FADING */
/* Update state of backlight according to timeout setting */
static void backlight_update_state(void)
@@ -498,8 +498,9 @@ static void backlight_update_state(void)
if (UNLIKELY(backlight_timeout < 0))
{
backlight_timer = 0; /* Disable the timeout */
-#ifdef USE_BACKLIGHT_SW_FADING
- backlight_set_up_fade_down();
+#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_SETTING) \
+ || (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_HW_REG)
+ backlight_setup_fade_down();
/* necessary step to issue fading down when the setting is selected */
queue_post(&backlight_queue, SYS_TIMEOUT, 0);
#else
@@ -509,8 +510,9 @@ static void backlight_update_state(void)
else
{
backlight_timer = backlight_timeout;
-#if defined(USE_BACKLIGHT_SW_FADING)
- backlight_set_up_fade_up();
+#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_SETTING) \
+ || (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_HW_REG)
+ backlight_setup_fade_up();
#else
_backlight_on();
#endif
@@ -555,15 +557,13 @@ void backlight_thread(void)
while(1)
{
-#if defined(USE_BACKLIGHT_SW_FADING)
+#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_SETTING) \
+ || (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_HW_REG)
if (backlight_fading_state)
queue_wait_w_tmo(&backlight_queue, &ev, FADE_DELAY);
else
#endif
queue_wait(&backlight_queue, &ev);
-/*
-#endif
-*/
switch(ev.id)
{ /* These events must always be processed */
#ifdef _BACKLIGHT_FADE_BOOST
@@ -643,11 +643,12 @@ void backlight_thread(void)
case BACKLIGHT_OFF:
backlight_timer = 0; /* Disable the timeout */
-#ifndef USE_BACKLIGHT_SW_FADING
+#if (CONFIG_BACKLIGHT_FADING != BACKLIGHT_FADING_SW_SETTING) \
+ && (CONFIG_BACKLIGHT_FADING != BACKLIGHT_FADING_SW_HW_REG)
_backlight_off();
#else
- backlight_set_up_fade_down();
-#endif /* USE_BACKLIGHT_SW_FADING */
+ backlight_setup_fade_down();
+#endif /* CONFIG_BACKLIGHT_FADING */
break;
#ifdef HAVE_LCD_SLEEP
case LCD_SLEEP:
@@ -677,12 +678,13 @@ void backlight_thread(void)
remote_backlight_update_state();
#endif
break;
-#if defined(USE_BACKLIGHT_SW_FADING)
+#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_SETTING) \
+ || (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_HW_REG)
case SYS_TIMEOUT:
if ((_backlight_fade_step(backlight_fading_state)))
- backlight_fading_state = NOT_FADING;
+ backlight_fading_state = NOT_FADING; /* finished fading */
break;
-#endif /* USE_BACKLIGHT_SW_FADING */
+#endif /* CONFIG_BACKLIGHT_FADING */
}
} /* end while */
}
@@ -733,11 +735,11 @@ void backlight_init(void)
#ifndef SIMULATOR
if (_backlight_init())
{
-# ifdef HAVE_BACKLIGHT_PWM_FADING
+#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_PWM)
/* If backlight is already on, don't fade in. */
bl_dim_target = BL_PWM_COUNT;
bl_dim_fraction = (BL_PWM_COUNT<<16);
-# endif
+#endif
}
#endif
/* Leave all lights as set by the bootloader here. The settings load will
@@ -922,7 +924,8 @@ void backlight_set_brightness(int val)
backlight_brightness = val;
_backlight_set_brightness(val);
-#ifdef USE_BACKLIGHT_SW_FADING
+#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_SETTING) \
+ || (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_HW_REG)
/* receive backlight brightness */
_backlight_fade_update_state(val);
#endif
diff --git a/firmware/export/backlight-sw-fading.h b/firmware/export/backlight-sw-fading.h
index 54f732709a..8527fd0f99 100644
--- a/firmware/export/backlight-sw-fading.h
+++ b/firmware/export/backlight-sw-fading.h
@@ -22,10 +22,6 @@
#ifndef BACKLIGHT_THREAD_FADING_H
#define BACKLIGHT_THREAD_FADING_H
-#include "config.h"
-
-#ifdef USE_BACKLIGHT_SW_FADING
-
/* delay supposed to be MAX_BRIGHTNESS_SETTING*2 rounded to the next multiple
* of 5, however not more than 40 */
#define _FADE_DELAY (((MAX_BRIGHTNESS_SETTING*2+4)/5)*5)
@@ -41,6 +37,5 @@ enum {
FADING_UP,
FADING_DOWN,
};
-#endif /* USE_BACKLIGHT_SW_FADING */
#endif /* _BACKLIGHT_THREAD_FADING_ */
diff --git a/firmware/export/backlight.h b/firmware/export/backlight.h
index cb081a5301..f215e0faea 100644
--- a/firmware/export/backlight.h
+++ b/firmware/export/backlight.h
@@ -34,12 +34,10 @@ void backlight_close(void);
int backlight_get_current_timeout(void);
-#if defined(HAVE_BACKLIGHT_PWM_FADING)
+#if defined(HAVE_BACKLIGHT_FADING_INT_SETTING)
void backlight_set_fade_in(int value);
void backlight_set_fade_out(int value);
-#endif
-#if defined(USE_BACKLIGHT_SW_FADING) \
- || defined(USE_BACKLIGHT_CUSTOM_FADING_BOOL)
+#elif defined(HAVE_BACKLIGHT_FADING_BOOL_SETTING)
void backlight_set_fade_in(bool value);
void backlight_set_fade_out(bool value);
#endif
diff --git a/firmware/export/config-c200.h b/firmware/export/config-c200.h
index d68d21455f..cd9f5867dc 100644
--- a/firmware/export/config-c200.h
+++ b/firmware/export/config-c200.h
@@ -111,6 +111,14 @@
#define HAVE_BACKLIGHT
#define HAVE_BACKLIGHT_BRIGHTNESS
+/* Main LCD backlight brightness range and defaults */
+#define MIN_BRIGHTNESS_SETTING 1
+#define MAX_BRIGHTNESS_SETTING 12
+#define DEFAULT_BRIGHTNESS_SETTING 6
+
+/* Which backlight fading type? */
+#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING
+
/* define this if you have a flash memory storage */
#define HAVE_FLASH_STORAGE
@@ -138,12 +146,6 @@
/** Non-simulator section **/
#ifndef SIMULATOR
-/* define this if the backlight thread is used for fade, not for sim, needs
- * HAVE_BACKLIGHT_BRIGHTNESS */
-#ifndef BOOTLOADER
-#define USE_BACKLIGHT_SW_FADING
-#endif
-
/* Define this if you have a PortalPlayer PP5024 */
#define CONFIG_CPU PP5022
@@ -200,13 +202,6 @@
#endif /* SIMULATOR */
-/** Port-specific settings **/
-
-/* Main LCD backlight brightness range and defaults */
-#define MIN_BRIGHTNESS_SETTING 1
-#define MAX_BRIGHTNESS_SETTING 12
-#define DEFAULT_BRIGHTNESS_SETTING 6
-
/* Default recording levels */
#define DEFAULT_REC_MIC_GAIN 23
#define DEFAULT_REC_LEFT_GAIN 23
diff --git a/firmware/export/config-c200v2.h b/firmware/export/config-c200v2.h
index 6ecb478c09..f6a386637c 100644
--- a/firmware/export/config-c200v2.h
+++ b/firmware/export/config-c200v2.h
@@ -136,12 +136,6 @@
/** Non-simulator section **/
#ifndef SIMULATOR
-/* define this if the backlight thread is used for fade, not for sim, needs
- * HAVE_BACKLIGHT_BRIGHTNESS */
-#ifndef BOOTLOADER
-#define USE_BACKLIGHT_SW_FADING
-#endif
-
/* Define this if you have a PortalPlayer PP5024 */
#define CONFIG_CPU AS3525
diff --git a/firmware/export/config-cowond2.h b/firmware/export/config-cowond2.h
index edeb834ef7..2b3b09cb09 100644
--- a/firmware/export/config-cowond2.h
+++ b/firmware/export/config-cowond2.h
@@ -108,9 +108,10 @@
/* Define this for LCD backlight available */
#define HAVE_BACKLIGHT
-
/* Enable LCD brightness control */
#define HAVE_BACKLIGHT_BRIGHTNESS
+/* Which backlight fading type? */
+#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_HW_REG
/* Main LCD backlight brightness range and defaults */
#define MIN_BRIGHTNESS_SETTING 1
@@ -129,13 +130,6 @@
#define CONFIG_CHARGING CHARGING_SIMPLE
#ifndef SIMULATOR
-
-/* define this if the backlight thread is used for fade, not for sim, needs
- * HAVE_BACKLIGHT_BRIGHTNESS */
-#ifndef BOOTLOADER
-#define USE_BACKLIGHT_SW_FADING
-#endif
-
/* Define this if you have a TCC7801 */
#define CONFIG_CPU TCC7801
diff --git a/firmware/export/config-e200.h b/firmware/export/config-e200.h
index 2be64d95cc..7fba79679c 100644
--- a/firmware/export/config-e200.h
+++ b/firmware/export/config-e200.h
@@ -101,6 +101,9 @@
#define HAVE_BACKLIGHT
#define HAVE_BACKLIGHT_BRIGHTNESS
+/* Which backlight fading type? */
+#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING
+
/* define this if the unit uses a scrollwheel for navigation */
#define HAVE_SCROLLWHEEL
/* define from which rotation speed [degree/sec] on the acceleration starts */
@@ -135,12 +138,6 @@
/** Non-simulator section **/
#ifndef SIMULATOR
-/* define this if the backlight thread is used for fade, not for sim, needs
- * HAVE_BACKLIGHT_BRIGHTNESS */
-#ifndef BOOTLOADER
-#define USE_BACKLIGHT_SW_FADING
-#endif
-
/* Define this if you have a PortalPlayer PP5024 */
#define CONFIG_CPU PP5024
diff --git a/firmware/export/config-e200v2.h b/firmware/export/config-e200v2.h
index 564916aea0..78246221be 100644
--- a/firmware/export/config-e200v2.h
+++ b/firmware/export/config-e200v2.h
@@ -106,6 +106,14 @@
#define HAVE_BACKLIGHT
#define HAVE_BACKLIGHT_BRIGHTNESS
+/* Main LCD backlight brightness range and defaults */
+#define MIN_BRIGHTNESS_SETTING 1
+#define MAX_BRIGHTNESS_SETTING 12
+#define DEFAULT_BRIGHTNESS_SETTING 6
+
+/* Which backlight fading type? */
+#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING
+
/* define this if the unit uses a scrollwheel for navigation */
#define HAVE_SCROLLWHEEL
/* define from which rotation speed [degree/sec] on the acceleration starts */
@@ -134,12 +142,6 @@
/** Non-simulator section **/
#ifndef SIMULATOR
-/* define this if the backlight thread is used for fade, not for sim, needs
- * HAVE_BACKLIGHT_BRIGHTNESS */
-#ifndef BOOTLOADER
-#define USE_BACKLIGHT_SW_FADING
-#endif
-
/* Define this if you have an AMS AS3525*/
#define CONFIG_CPU AS3525
@@ -195,13 +197,6 @@
#endif /* SIMULATOR */
-/** Port-specific settings **/
-
-/* Main LCD backlight brightness range and defaults */
-#define MIN_BRIGHTNESS_SETTING 1
-#define MAX_BRIGHTNESS_SETTING 12
-#define DEFAULT_BRIGHTNESS_SETTING 6
-
/* Default recording levels */
#define DEFAULT_REC_MIC_GAIN 23
#define DEFAULT_REC_LEFT_GAIN 23
diff --git a/firmware/export/config-fuze.h b/firmware/export/config-fuze.h
index 3e5880775b..0bc2d70bf7 100644
--- a/firmware/export/config-fuze.h
+++ b/firmware/export/config-fuze.h
@@ -106,6 +106,14 @@
#define HAVE_BACKLIGHT
#define HAVE_BACKLIGHT_BRIGHTNESS
+/* Main LCD backlight brightness range and defaults */
+#define MIN_BRIGHTNESS_SETTING 1
+#define MAX_BRIGHTNESS_SETTING 12
+#define DEFAULT_BRIGHTNESS_SETTING 6
+
+/* Which backlight fading type? */
+#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING
+
/* define this if the unit uses a scrollwheel for navigation */
#define HAVE_SCROLLWHEEL
/* define from which rotation speed [degree/sec] on the acceleration starts */
@@ -134,12 +142,6 @@
/** Non-simulator section **/
#ifndef SIMULATOR
-/* define this if the backlight thread is used for fade, not for sim, needs
- * HAVE_BACKLIGHT_BRIGHTNESS */
-#ifndef BOOTLOADER
-#define USE_BACKLIGHT_SW_FADING
-#endif
-
/* Define this if you have an AMS AS3525*/
#define CONFIG_CPU AS3525
@@ -195,13 +197,6 @@
#endif /* SIMULATOR */
-/** Port-specific settings **/
-
-/* Main LCD backlight brightness range and defaults */
-#define MIN_BRIGHTNESS_SETTING 1
-#define MAX_BRIGHTNESS_SETTING 12
-#define DEFAULT_BRIGHTNESS_SETTING 6
-
/* Default recording levels */
#define DEFAULT_REC_MIC_GAIN 23
#define DEFAULT_REC_LEFT_GAIN 23
diff --git a/firmware/export/config-gigabeat-s.h b/firmware/export/config-gigabeat-s.h
index 93068ae441..6b993b6082 100644
--- a/firmware/export/config-gigabeat-s.h
+++ b/firmware/export/config-gigabeat-s.h
@@ -117,15 +117,14 @@
#define MAX_BRIGHTNESS_SETTING 24
#define DEFAULT_BRIGHTNESS_SETTING 12
+/* Implementation-defined fading type with bool settings */
+#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_TARGET
#define HAVE_HEADPHONE_DETECTION
#endif /* BOOTLOADER */
#ifndef SIMULATOR
-/* Implementation-defined fading type with bool settings */
-#define USE_BACKLIGHT_CUSTOM_FADING_BOOL
-
/* The LCD on a Gigabeat is 240x320 - it is portrait */
#define HAVE_PORTRAIT_LCD
diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h
index be718259f8..6ca2a0701e 100644
--- a/firmware/export/config-h100.h
+++ b/firmware/export/config-h100.h
@@ -74,7 +74,7 @@
#define HAVE_BACKLIGHT
/* We can fade the backlight by using PWM */
-#define HAVE_BACKLIGHT_PWM_FADING
+#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_PWM
/* Define this if you have a software controlled poweroff */
#define HAVE_SW_POWEROFF
diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h
index 4757d7708c..74074e83e0 100644
--- a/firmware/export/config-h120.h
+++ b/firmware/export/config-h120.h
@@ -69,7 +69,7 @@
#define HAVE_BACKLIGHT
/* We can fade the backlight by using PWM */
-#define HAVE_BACKLIGHT_PWM_FADING
+#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_PWM
/* Define this if you have a software controlled poweroff */
#define HAVE_SW_POWEROFF
diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h
index 05d75fc4f0..037bb26b2d 100644
--- a/firmware/export/config-h300.h
+++ b/firmware/export/config-h300.h
@@ -68,6 +68,8 @@
/* Define this for LCD backlight available */
#define HAVE_BACKLIGHT
#define HAVE_BACKLIGHT_BRIGHTNESS
+/* Which backlight fading type? */
+#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_HW_REG
/* Define this if you have a software controlled poweroff */
#define HAVE_SW_POWEROFF
@@ -125,12 +127,6 @@
#ifndef SIMULATOR
-/* define this if the backlight thread is used for fade, not for sim, needs
- * HAVE_BACKLIGHT_BRIGHTNESS */
-#ifndef BOOTLOADER
-#define USE_BACKLIGHT_SW_FADING
-#endif
-
/* Define this if your LCD can be enabled/disabled */
#define HAVE_LCD_ENABLE
diff --git a/firmware/export/config-iaudiox5.h b/firmware/export/config-iaudiox5.h
index 8b1f9086bb..27bd2c523b 100644
--- a/firmware/export/config-iaudiox5.h
+++ b/firmware/export/config-iaudiox5.h
@@ -90,6 +90,8 @@
/* Define this for LCD backlight available */
#define HAVE_BACKLIGHT
#define HAVE_BACKLIGHT_BRIGHTNESS
+/* Which backlight fading type? */
+#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_HW_REG
/* define this if you have a disk storage, i.e. something
that needs spinups and can cause skips when shaked */
@@ -127,12 +129,6 @@
#ifndef SIMULATOR
-/* define this if the backlight thread is used for fade, not for sim, needs
- * HAVE_BACKLIGHT_BRIGHTNESS */
-#ifndef BOOTLOADER
-#define USE_BACKLIGHT_SW_FADING
-#endif
-
/* Define this if your LCD can set contrast */
#define HAVE_LCD_CONTRAST
diff --git a/firmware/export/config-ipodmini.h b/firmware/export/config-ipodmini.h
index 210eb1d717..bc59ededfe 100644
--- a/firmware/export/config-ipodmini.h
+++ b/firmware/export/config-ipodmini.h
@@ -101,7 +101,7 @@
#define HAVE_BACKLIGHT
/* We can fade the backlight by using PWM */
-#define HAVE_BACKLIGHT_PWM_FADING
+#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_PWM
/* Define this if you can detect headphones */
#define HAVE_HEADPHONE_DETECTION
diff --git a/firmware/export/config-ipodmini2g.h b/firmware/export/config-ipodmini2g.h
index 49630d7b3d..4775350712 100644
--- a/firmware/export/config-ipodmini2g.h
+++ b/firmware/export/config-ipodmini2g.h
@@ -101,7 +101,7 @@
#define HAVE_BACKLIGHT
/* We can fade the backlight by using PWM */
-#define HAVE_BACKLIGHT_PWM_FADING
+#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_PWM
/* define this if the unit uses a scrollwheel for navigation */
#define HAVE_SCROLLWHEEL
diff --git a/firmware/export/config-ipodnano.h b/firmware/export/config-ipodnano.h
index 8752181bb9..1d82ec4428 100644
--- a/firmware/export/config-ipodnano.h
+++ b/firmware/export/config-ipodnano.h
@@ -81,15 +81,14 @@
/* Define this for LCD backlight available */
#define HAVE_BACKLIGHT
#define HAVE_BACKLIGHT_BRIGHTNESS
+/* We can fade the backlight by using PWM */
+#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_PWM
/* Main LCD backlight brightness range and defaults */
#define MIN_BRIGHTNESS_SETTING 1
#define MAX_BRIGHTNESS_SETTING 32
#define DEFAULT_BRIGHTNESS_SETTING 16
-/* We can fade the backlight by using PWM */
-#define HAVE_BACKLIGHT_PWM_FADING
-
/* define this if the unit uses a scrollwheel for navigation */
#define HAVE_SCROLLWHEEL
/* define from which rotation speed [degree/sec] on the acceleration starts */
diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h
index ab974dc236..b658a9b3f8 100644
--- a/firmware/export/config-ipodvideo.h
+++ b/firmware/export/config-ipodvideo.h
@@ -86,13 +86,14 @@
#define HAVE_BACKLIGHT
#define HAVE_BACKLIGHT_BRIGHTNESS
+/* We can fade the backlight by using PWM */
+#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_PWM
+
/* Main LCD backlight brightness range and defaults */
#define MIN_BRIGHTNESS_SETTING 1
#define MAX_BRIGHTNESS_SETTING 32
#define DEFAULT_BRIGHTNESS_SETTING 16
-/* We can fade the backlight by using PWM */
-#define HAVE_BACKLIGHT_PWM_FADING
/* define this if the unit uses a scrollwheel for navigation */
#define HAVE_SCROLLWHEEL
diff --git a/firmware/export/config-mrobe100.h b/firmware/export/config-mrobe100.h
index 4ade179c04..f2fc5cb37a 100644
--- a/firmware/export/config-mrobe100.h
+++ b/firmware/export/config-mrobe100.h
@@ -70,7 +70,7 @@
#define HAVE_BACKLIGHT
/* We can fade the backlight by using PWM */
-#define HAVE_BACKLIGHT_PWM_FADING
+#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_PWM
/* Main LCD backlight brightness range and defaults */
#define MIN_BRIGHTNESS_SETTING 1
diff --git a/firmware/export/config-sa9200.h b/firmware/export/config-sa9200.h
index b9fd4575bc..624befcf12 100755
--- a/firmware/export/config-sa9200.h
+++ b/firmware/export/config-sa9200.h
@@ -90,6 +90,9 @@
#define MAX_BRIGHTNESS_SETTING 12
#define DEFAULT_BRIGHTNESS_SETTING 6
+/* Which backlight fading type? */
+#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING
+
/* define this if you have a flash memory storage */
#define HAVE_FLASH_STORAGE
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 7fb41d8d83..58ae66d1cd 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -113,6 +113,24 @@
#define H300_REMOTE 2
#define X5_REMOTE 3
+/* CONFIG_BACKLIGHT_FADING */
+/* No fading capabilities at all (yet) */
+#define BACKLIGHT_NO_FADING 0x0
+/* Backlight fading is controlled using a hardware PWM mechanism */
+#define BACKLIGHT_FADING_PWM 0x1
+/* Backlight is controlled using a software implementation
+ * BACKLIGHT_FADING_SW_SETTING means that backlight is turned on by only setting
+ * the brightness (i.e. no real difference between backlight_on and
+ * backlight_set_brightness)
+ * BACKLIGHT_FADING_SW_SETTING means that backlight brightness is restored
+ * "in hardware", from a hardware register upon backlight_on
+ * Both types need to have minor adjustments in the software fading code */
+#define BACKLIGHT_FADING_SW_SETTING 0x2
+#define BACKLIGHT_FADING_SW_HW_REG 0x4
+/* Backlight fading is done in a target specific way
+ * for example in hardware, but not controllable*/
+#define BACKLIGHT_FADING_TARGET 0x8
+
/* CONFIG_CHARGING */
/* Generic types */
@@ -348,7 +366,12 @@
#include "config_caps.h"
/* now set any CONFIG_ defines correctly if they are not used,
- No need to do this on CONFIG_'s which are compulsary (e.g CONFIG_CODEC ) */
+ No need to do this on CONFIG_'s which are compulsory (e.g CONFIG_CODEC ) */
+
+#if !defined(CONFIG_BACKLIGHT_FADING)
+#define CONFIG_BACKLIGHT_FADING BACKLIGHT_NO_FADING
+#endif
+
#ifndef CONFIG_TUNER
#define CONFIG_TUNER 0
#endif
@@ -413,6 +436,32 @@
#define CONFIG_STORAGE_MULTI
#endif
+/* deactive fading in bootloader/sim */
+#if defined(BOOTLOADER) || defined(SIMULATOR)
+#undef CONFIG_BACKLIGHT_FADING
+#define CONFIG_BACKLIGHT_FADING BACKLIGHT_NO_FADING
+#endif
+
+/* determine which setting/manual text to use,
+ * possibly overridden in target config */
+#if (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_PWM)
+
+#ifndef HAVE_BACKLIGHT_FADING_INT_SETTING
+#define HAVE_BACKLIGHT_FADING_INT_SETTING
+#endif
+
+#elif (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_SETTING) \
+ || (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_SW_HW_REG) \
+ || (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_TARGET)
+
+/* BACKLIGHT_FADING_TARGET may the setting to use */
+#if !defined(HAVE_BACKLIGHT_FADING_BOOL_SETTING) \
+ && !defined(HAVE_BACKLIGHT_FADING_INT_SETTING)
+#define HAVE_BACKLIGHT_FADING_BOOL_SETTING
+#endif
+
+#endif /* CONFIG_BACKLIGHT_FADING */
+
#if defined(BOOTLOADER) && defined(HAVE_ADJUSTABLE_CPU_FREQ)
/* Bootloaders don't use CPU frequency adjustment */
#undef HAVE_ADJUSTABLE_CPU_FREQ
diff --git a/firmware/target/arm/as3525/backlight-e200v2-fuze.c b/firmware/target/arm/as3525/backlight-e200v2-fuze.c
index c26d3919c3..465713a1fc 100644
--- a/firmware/target/arm/as3525/backlight-e200v2-fuze.c
+++ b/firmware/target/arm/as3525/backlight-e200v2-fuze.c
@@ -39,7 +39,9 @@ void _backlight_on(void)
#ifdef HAVE_LCD_ENABLE
lcd_enable(true); /* power on lcd + visible display */
#endif
-#ifndef USE_BACKLIGHT_SW_FADING
+#if (CONFIG_BACKLIGHT_FADING != BACKLIGHT_FADING_SW_SETTING) /* in bootloader/sim */
+ /* if we set the brightness to the settings value, then fading up
+ * is glitchy */
ascodec_write(AS3514_DCDC15, backlight_brightness);
#endif
}
diff --git a/firmware/target/arm/ipod/backlight-target.h b/firmware/target/arm/ipod/backlight-target.h
index 3c4bc04521..ce1b938526 100644
--- a/firmware/target/arm/ipod/backlight-target.h
+++ b/firmware/target/arm/ipod/backlight-target.h
@@ -50,7 +50,8 @@ bool _backlight_init(void);
void _backlight_on(void);
void _backlight_off(void);
-#elif defined HAVE_BACKLIGHT_PWM_FADING /* Mini G1, G2 */
+/* Mini G1, G2, Video, Nano */
+#elif (CONFIG_BACKLIGHT_FADING == BACKLIGHT_FADING_PWM)
#define _backlight_init() true
void _backlight_hw_on(void);
diff --git a/firmware/target/arm/philips/sa9200/backlight-sa9200.c b/firmware/target/arm/philips/sa9200/backlight-sa9200.c
index 4221959a0d..5c967a84ea 100644
--- a/firmware/target/arm/philips/sa9200/backlight-sa9200.c
+++ b/firmware/target/arm/philips/sa9200/backlight-sa9200.c
@@ -39,15 +39,16 @@ void _backlight_on(void)
#ifdef HAVE_LCD_ENABLE
lcd_enable(true); /* power on lcd + visible display */
#endif
-#ifndef USE_BACKLIGHT_SW_FADING
- /* that part ain't useful when fading */
+#if (CONFIG_BACKLIGHT_FADING != BACKLIGHT_FADING_SW_SETTING) /* in bootloader/sim */
+ /* if we set the brightness to the settings value, then fading up
+ * is glitchy */
_backlight_set_brightness(backlight_brightness);
#endif
}
void _backlight_off(void)
{
- ascodec_write(AS3514_DCDC15, 0x0);
+ _backlight_set_brightness(0);
#ifdef HAVE_LCD_ENABLE
lcd_enable(false); /* power off visible display */
#endif
diff --git a/firmware/target/arm/sandisk/backlight-c200_e200.c b/firmware/target/arm/sandisk/backlight-c200_e200.c
index 67e0cddac9..5a2e98a278 100644
--- a/firmware/target/arm/sandisk/backlight-c200_e200.c
+++ b/firmware/target/arm/sandisk/backlight-c200_e200.c
@@ -39,15 +39,16 @@ void _backlight_on(void)
#ifdef HAVE_LCD_ENABLE
lcd_enable(true); /* power on lcd + visible display */
#endif
-#ifndef USE_BACKLIGHT_SW_FADING
- /* that part ain't useful when fading */
+#if (CONFIG_BACKLIGHT_FADING != BACKLIGHT_FADING_SW_SETTING) /* in bootloader/sim */
+ /* if we set the brightness to the settings value, then fading up
+ * is glitchy */
_backlight_set_brightness(backlight_brightness);
#endif
}
void _backlight_off(void)
{
- ascodec_write(AS3514_DCDC15, 0x0);
+ _backlight_set_brightness(0);
#ifdef HAVE_LCD_ENABLE
lcd_enable(false); /* power off visible display */
#endif
diff --git a/manual/configure_rockbox/display_options.tex b/manual/configure_rockbox/display_options.tex
index 048d9b70b6..c5a76e9f0f 100644
--- a/manual/configure_rockbox/display_options.tex
+++ b/manual/configure_rockbox/display_options.tex
@@ -28,7 +28,7 @@
beginning so that the display can be read to see song information. The
amount of time is determined by the value of the backlight timeout
setting, but is no less than 5 seconds.
- \opt{backlight_fade_pwm}{
+ \opt{backlight_fade_int}{
\item[Backlight Fade In:]
The amount of time that the backlight will take to fade from off to on
after a button is pressed. If set to \setting{Off} the backlight will
@@ -41,14 +41,14 @@
fade out. Other valid values: \setting{500ms}, \setting{1s},
\setting{2s}, \setting{3s}, \setting{4s}, \setting{5s} or \setting{10s}.
}
- \opt{backlight_fade_sw}{
+ \opt{backlight_fade_bool}{
\item[Backlight Fade In:]
This options turns on smooth backlight fading when the backlight is
- activated. The fading time is dependent on the brightness level you
+ turning on. The fading time may dependent on the brightness level you
have chosen. If it is turned off, the backlight will turn on immediately.
\item[Backlight Fade Out:]
This options turns on smooth backlight fading when the backlight is
- deactivated. The fading time is dependent on the brightness level you
+ turning off. The fading time may dependent on the brightness level you
have chosen. If it is turned off, the backlight will turn off immediately.
}
\item[First Keypress Enables Backlight Only:]