summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorKarl Kurbjun <kkurbjun@gmail.com>2009-03-26 22:20:46 +0000
committerKarl Kurbjun <kkurbjun@gmail.com>2009-03-26 22:20:46 +0000
commit9d1b99534e0a3bf6559a4fe06420b0bc9274a688 (patch)
tree06decc501f46fae58171909a0cd1153bf6828a17 /firmware
parentb084d603562cdf2eb90cdfd0c5c0e1e5fa8776a9 (diff)
downloadrockbox-9d1b99534e0a3bf6559a4fe06420b0bc9274a688.tar.gz
rockbox-9d1b99534e0a3bf6559a4fe06420b0bc9274a688.zip
Add support for powering down the LCD (saves 50 mA when disabled)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20547 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/export/config-mrobe500.h12
-rw-r--r--firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c10
-rw-r--r--firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c59
3 files changed, 74 insertions, 7 deletions
diff --git a/firmware/export/config-mrobe500.h b/firmware/export/config-mrobe500.h
index 9854d50e01..d5d31ffc41 100644
--- a/firmware/export/config-mrobe500.h
+++ b/firmware/export/config-mrobe500.h
@@ -72,7 +72,17 @@
#define LCD_PIXELFORMAT RGB565 /* rgb565 */
/* Define this if your LCD can be enabled/disabled */
-//#define HAVE_LCD_ENABLE
+#define HAVE_LCD_ENABLE
+
+#define HAVE_LCD_SLEEP_SETTING
+
+/* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE
+ should be defined as well. */
+#define HAVE_LCD_SLEEP
+
+/* We don't use a setting but a fixed delay after the backlight has
+ * turned off */
+#define LCD_SLEEP_TIMEOUT (5*HZ)
/* remote LCD */
//#define HAVE_REMOTE_LCD
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c
index 1537e76219..855f10ef35 100644
--- a/firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c
+++ b/firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c
@@ -30,12 +30,22 @@
void _backlight_on(void)
{
+#ifdef HAVE_LCD_SLEEP
+ backlight_lcd_sleep_countdown(false); /* stop counter */
+#endif
+#ifdef HAVE_LCD_ENABLE
+ lcd_enable(true); /* power on lcd + visible display */
+#endif
_backlight_set_brightness(DEFAULT_BRIGHTNESS_SETTING);
}
void _backlight_off(void)
{
_backlight_set_brightness(0);
+#ifdef HAVE_LCD_SLEEP
+ /* Disable lcd after fade completes (when lcd_sleep timeout expires) */
+ backlight_lcd_sleep_countdown(true); /* start countdown */
+#endif
}
/* Assumes that the backlight has been initialized */
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c
index cdba4c8118..1126f35149 100644
--- a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c
+++ b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c
@@ -38,7 +38,11 @@
extern void lcd_copy_buffer_rect(fb_data *dst, const fb_data *src,
int width, int height);
-static volatile bool lcd_on = true;
+static bool lcd_on = true;
+#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
+static bool lcd_powered = true;
+#endif
+
volatile bool lcd_poweroff = false;
/*
** These are imported from lcd-16bit.c
@@ -46,10 +50,55 @@ volatile bool lcd_poweroff = false;
extern unsigned fg_pattern;
extern unsigned bg_pattern;
+#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
bool lcd_active(void)
{
return lcd_on;
}
+#endif
+
+#if defined(HAVE_LCD_SLEEP)
+void lcd_sleep()
+{
+ if (lcd_powered)
+ {
+ /* "not powered" implies "disabled" */
+ if (lcd_on)
+ lcd_enable(false);
+ IO_GIO_BITCLR2=1<<4;
+ lcd_powered=false;
+ }
+}
+#endif
+
+#if defined(HAVE_LCD_ENABLE)
+void lcd_enable(bool state)
+{
+ if (state == lcd_on)
+ return;
+
+ if(state)
+ {
+ /* "enabled" implies "powered" */
+ if (!lcd_powered)
+ {
+ lcd_powered=true;
+ IO_GIO_BITSET2=1<<4;
+ /* Wait long enough for a frame to be written - yes, it
+ * takes awhile. */
+ sleep(HZ/5);
+ }
+
+ lcd_on = true;
+ lcd_update();
+ lcd_activation_call_hook();
+ }
+ else
+ {
+ lcd_on = false;
+ }
+}
+#endif
/* LCD init - based on code from ingenient-bsp/bootloader/board/dm320/splash.c
* and code by Catalin Patulea from the M:Robe 500i linux port
@@ -80,6 +129,9 @@ void lcd_init_device(void)
IO_OSD_OSDWIN0YP=0;
IO_OSD_OSDWIN0XL=480;
IO_OSD_OSDWIN0YL=640;
+
+ /* Set pin 36 to an output */
+ IO_GIO_DIR2&=!(1<<4);
}
/* Update a fraction of the display. */
@@ -138,11 +190,6 @@ void lcd_update_rect(int x, int y, int width, int height)
#endif
}
-void lcd_enable(bool state)
-{
- (void)state;
-}
-
/* Update the display.
This must be called after all other LCD functions that change the display. */
void lcd_update(void)