summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2009-02-09 07:01:46 +0000
committerMichael Sevakis <jethead71@rockbox.org>2009-02-09 07:01:46 +0000
commitf7a06dd6fc2022876c392e186bcf5037dd5a34bf (patch)
tree98818e2c6dfef6e475158f9f3b54cbf3630ed5d4 /firmware/target
parent9f5687c9e633dcc2caef7351747af9ee86689590 (diff)
Gigabeat S: Try to save some power. Implement lcd_enable and turn off LCD DMA channel when backlight is off.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19953 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/arm/imx31/gigabeat-s/backlight-imx31.c4
-rw-r--r--firmware/target/arm/imx31/gigabeat-s/lcd-imx31.c35
2 files changed, 30 insertions, 9 deletions
diff --git a/firmware/target/arm/imx31/gigabeat-s/backlight-imx31.c b/firmware/target/arm/imx31/gigabeat-s/backlight-imx31.c
index 8b4459c3a9..8f75b72f58 100644
--- a/firmware/target/arm/imx31/gigabeat-s/backlight-imx31.c
+++ b/firmware/target/arm/imx31/gigabeat-s/backlight-imx31.c
@@ -23,6 +23,7 @@
#include "backlight.h"
#include "mc13783.h"
#include "backlight-target.h"
+#include "lcd.h"
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
/* Table that uses combinations of current level and pwm fraction to get
@@ -129,6 +130,9 @@ void _backlight_on(void)
#ifdef HAVE_LCD_SLEEP
backlight_lcd_sleep_countdown(false); /* stop counter */
#endif
+#ifdef HAVE_LCD_ENABLE
+ lcd_enable(true);
+#endif
/* Set/clear LEDRAMPUP bit, clear LEDRAMPDOWN bit,
* Ensure LED supply is on. */
diff --git a/firmware/target/arm/imx31/gigabeat-s/lcd-imx31.c b/firmware/target/arm/imx31/gigabeat-s/lcd-imx31.c
index c353380221..47834b3b19 100644
--- a/firmware/target/arm/imx31/gigabeat-s/lcd-imx31.c
+++ b/firmware/target/arm/imx31/gigabeat-s/lcd-imx31.c
@@ -30,8 +30,8 @@
#define MAIN_LCD_IDMAC_CHANNEL 14
#define LCDADDR(x, y) (&lcd_framebuffer[(y)][(x)])
-static volatile bool lcd_on = true;
-volatile bool lcd_poweroff = false;
+static bool lcd_on = true;
+static bool lcd_powered = true;
static unsigned lcd_yuv_options = 0;
/*
** This is imported from lcd-16bit.c
@@ -98,24 +98,41 @@ void lcd_update_rect(int x, int y, int width, int height)
}
}
-#ifdef HAVE_LCD_SLEEP
void lcd_sleep(void)
{
- _backlight_lcd_sleep();
+ if (lcd_powered)
+ {
+ lcd_enable(false);
+ lcd_powered = false;
+ IPU_IDMAC_CHA_EN &= ~(1ul << MAIN_LCD_IDMAC_CHANNEL);
+ _backlight_lcd_sleep();
+ }
}
-#endif /* HAVE_LCD_SLEEP */
-#if 0
void lcd_enable(bool state)
{
- (void)state;
+ if (state == lcd_on)
+ return;
+
+ if (state)
+ {
+ IPU_IDMAC_CHA_EN |= 1ul << MAIN_LCD_IDMAC_CHANNEL;
+ sleep(HZ/50);
+ lcd_powered = true;
+ lcd_on = true;
+ lcd_update();
+ lcd_call_enable_hook();
+ }
+ else
+ {
+ lcd_on = false;
+ }
}
bool lcd_enabled(void)
{
- return true;
+ return lcd_on;
}
-#endif
/* Update the display.
This must be called after all other LCD functions that change the display. */