summaryrefslogtreecommitdiff
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
parentd87f9fc90902722ad568649d9291ef2e299c1837 (diff)
downloadrockbox-6a9aac7a5fd6dab96f8599be5f32ae4c1ddb3df6.tar.gz
rockbox-6a9aac7a5fd6dab96f8599be5f32ae4c1ddb3df6.zip
sansa clipzip: implement lcd_enable
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30407 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/export/config/sansaclipzip.h2
-rw-r--r--firmware/target/arm/as3525/sansa-clipzip/backlight-clipzip.c8
-rw-r--r--firmware/target/arm/as3525/sansa-clipzip/lcd-clipzip.c57
3 files changed, 66 insertions, 1 deletions
diff --git a/firmware/export/config/sansaclipzip.h b/firmware/export/config/sansaclipzip.h
index 749439c668..58b19664b8 100644
--- a/firmware/export/config/sansaclipzip.h
+++ b/firmware/export/config/sansaclipzip.h
@@ -48,7 +48,7 @@
48#define LCD_PIXELFORMAT RGB565SWAPPED /* rgb565 swapped */ 48#define LCD_PIXELFORMAT RGB565SWAPPED /* rgb565 swapped */
49 49
50/* define this if you have LCD enable function */ 50/* define this if you have LCD enable function */
51//#define HAVE_LCD_ENABLE 51#define HAVE_LCD_ENABLE
52 52
53#ifndef BOOTLOADER 53#ifndef BOOTLOADER
54/* Define this if your LCD can be put to sleep. 54/* Define this if your LCD can be put to sleep.
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)
39 ascodec_write_pmu(AS3543_BACKLIGHT, 1, 0x91); 39 ascodec_write_pmu(AS3543_BACKLIGHT, 1, 0x91);
40 sleep(1); 40 sleep(1);
41 ascodec_write_pmu(AS3543_BACKLIGHT, 1, 0x91); 41 ascodec_write_pmu(AS3543_BACKLIGHT, 1, 0x91);
42
43#ifdef HAVE_LCD_ENABLE
44 lcd_enable(true);
45#endif
42} 46}
43 47
44void _backlight_off(void) 48void _backlight_off(void)
45{ 49{
50#ifdef HAVE_LCD_ENABLE
51 lcd_enable(false);
52#endif
53
46 GPIOB_PIN(1) = 0; 54 GPIOB_PIN(1) = 0;
47 55
48 ascodec_write_pmu(AS3543_BACKLIGHT, 1, 0x91); 56 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 @@
29/* the detected lcd type (0 or 1) */ 29/* the detected lcd type (0 or 1) */
30static int lcd_type; 30static int lcd_type;
31 31
32#ifdef HAVE_LCD_ENABLE
33/* whether the lcd is currently enabled or not */
34static bool lcd_enabled;
35#endif
36
32/* initialises the host lcd hardware, returns the lcd type */ 37/* initialises the host lcd hardware, returns the lcd type */
33int lcd_hw_init(void) 38int lcd_hw_init(void)
34{ 39{
@@ -262,6 +267,57 @@ static void lcd_init_type1(void)
262 lcd_write_dat(0x00); 267 lcd_write_dat(0x00);
263} 268}
264 269
270#ifdef HAVE_LCD_ENABLE
271/* enables/disables the lcd */
272void lcd_enable(bool on)
273{
274 lcd_enabled = on;
275
276 if (lcd_type == 0) {
277 if (on) {
278 lcd_write(0x14, 0x00);
279 lcd_write(0x02, 0x01);
280 lcd_write(0xD2, 0x04);
281 lcd_write(0xD0, 0x80);
282 sleep(HZ * 100/1000);
283
284 lcd_write(0xD0, 0x00);
285 }
286 else {
287 lcd_write(0xD2, 0x05);
288 lcd_write(0xD0, 0x80);
289 sleep(HZ * 100/1000);
290
291 lcd_write(0x02, 0x00);
292 lcd_write(0xD0, 0x00);
293 lcd_write(0x14, 0x01);
294 }
295 }
296 else {
297 if (on) {
298 lcd_write_cmd(0x03);
299 lcd_write_dat(0x00);
300
301 lcd_write_cmd(0x02);
302 lcd_write_dat(0x01);
303 }
304 else {
305 lcd_write_cmd(0x02);
306 lcd_write_dat(0x00);
307
308 lcd_write_cmd(0x03);
309 lcd_write_dat(0x01);
310 }
311 }
312}
313
314/* returns true if the lcd is enabled */
315bool lcd_active(void)
316{
317 return lcd_enabled;
318}
319#endif /* HAVE_LCD_ENABLE */
320
265/* initialises the lcd */ 321/* initialises the lcd */
266void lcd_init_device(void) 322void lcd_init_device(void)
267{ 323{
@@ -272,6 +328,7 @@ void lcd_init_device(void)
272 else { 328 else {
273 lcd_init_type1(); 329 lcd_init_type1();
274 } 330 }
331 lcd_enable(true);
275} 332}
276 333
277/* sets up the lcd to receive frame buffer data */ 334/* sets up the lcd to receive frame buffer data */