summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
authorBertrik Sikken <bertrik@sikken.nl>2011-09-01 16:59:30 +0000
committerBertrik Sikken <bertrik@sikken.nl>2011-09-01 16:59:30 +0000
commit6a9aac7a5fd6dab96f8599be5f32ae4c1ddb3df6 (patch)
tree7deb418ea3efe07cc87b933c3e555b09ab845047 /firmware/target
parentd87f9fc90902722ad568649d9291ef2e299c1837 (diff)
sansa clipzip: implement lcd_enable
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30407 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/arm/as3525/sansa-clipzip/backlight-clipzip.c8
-rw-r--r--firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c57
2 files changed, 65 insertions, 0 deletions
diff --git a/firmware/target/arm/as3525/sansa-clipzip/backlight-clipzip.c b/firmware/target/arm/as3525/sansa-clipzip/backlight-clipzip.c
index 1fae4b3007..e2a175b574 100644
--- a/firmware/target/arm/as3525/sansa-clipzip/backlight-clipzip.c
+++ b/firmware/target/arm/as3525/sansa-clipzip/backlight-clipzip.c
@@ -39,10 +39,18 @@ void _backlight_on(void)
ascodec_write_pmu(AS3543_BACKLIGHT, 1, 0x91);
sleep(1);
ascodec_write_pmu(AS3543_BACKLIGHT, 1, 0x91);
+
+#ifdef HAVE_LCD_ENABLE
+ lcd_enable(true);
+#endif
}
void _backlight_off(void)
{
+#ifdef HAVE_LCD_ENABLE
+ lcd_enable(false);
+#endif
+
GPIOB_PIN(1) = 0;
ascodec_write_pmu(AS3543_BACKLIGHT, 1, 0x91);
diff --git a/firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c b/firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c
index 47d896a2f3..c828bab61c 100644
--- a/firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c
+++ b/firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c
@@ -29,6 +29,11 @@
/* the detected lcd type (0 or 1) */
static int lcd_type;
+#ifdef HAVE_LCD_ENABLE
+/* whether the lcd is currently enabled or not */
+static bool lcd_enabled;
+#endif
+
/* initialises the host lcd hardware, returns the lcd type */
int lcd_hw_init(void)
{
@@ -262,6 +267,57 @@ static void lcd_init_type1(void)
lcd_write_dat(0x00);
}
+#ifdef HAVE_LCD_ENABLE
+/* enables/disables the lcd */
+void lcd_enable(bool on)
+{
+ lcd_enabled = on;
+
+ if (lcd_type == 0) {
+ if (on) {
+ lcd_write(0x14, 0x00);
+ lcd_write(0x02, 0x01);
+ lcd_write(0xD2, 0x04);
+ lcd_write(0xD0, 0x80);
+ sleep(HZ * 100/1000);
+
+ lcd_write(0xD0, 0x00);
+ }
+ else {
+ lcd_write(0xD2, 0x05);
+ lcd_write(0xD0, 0x80);
+ sleep(HZ * 100/1000);
+
+ lcd_write(0x02, 0x00);
+ lcd_write(0xD0, 0x00);
+ lcd_write(0x14, 0x01);
+ }
+ }
+ else {
+ if (on) {
+ lcd_write_cmd(0x03);
+ lcd_write_dat(0x00);
+
+ lcd_write_cmd(0x02);
+ lcd_write_dat(0x01);
+ }
+ else {
+ lcd_write_cmd(0x02);
+ lcd_write_dat(0x00);
+
+ lcd_write_cmd(0x03);
+ lcd_write_dat(0x01);
+ }
+ }
+}
+
+/* returns true if the lcd is enabled */
+bool lcd_active(void)
+{
+ return lcd_enabled;
+}
+#endif /* HAVE_LCD_ENABLE */
+
/* initialises the lcd */
void lcd_init_device(void)
{
@@ -272,6 +328,7 @@ void lcd_init_device(void)
else {
lcd_init_type1();
}
+ lcd_enable(true);
}
/* sets up the lcd to receive frame buffer data */