summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Dziok <b0hoon@o2.pl>2014-01-13 23:50:40 +0100
committerSzymon Dziok <b0hoon@o2.pl>2014-01-13 23:50:40 +0100
commit518d9ecb35708d0995556b03466b79459d974ade (patch)
treecb3529f06777a6f9d8182a176f3998f10a060afc
parentb25cd9792fe3f0f2299560412111607da3baea18 (diff)
downloadrockbox-518d9ecb35708d0995556b03466b79459d974ade.tar.gz
rockbox-518d9ecb35708d0995556b03466b79459d974ade.zip
HDD1630: implement lcd_enable (display on/off).
Change-Id: I8b72a9c333d8a9dbcb62c366a9af298f1dd9b2f7
-rw-r--r--firmware/export/config/gogearhdd1630.h2
-rw-r--r--firmware/target/arm/philips/hdd1630/backlight-hdd1630.c9
-rw-r--r--firmware/target/arm/philips/hdd1630/lcd-hdd1630.c40
3 files changed, 50 insertions, 1 deletions
diff --git a/firmware/export/config/gogearhdd1630.h b/firmware/export/config/gogearhdd1630.h
index 6379c26801..9abf90acb9 100644
--- a/firmware/export/config/gogearhdd1630.h
+++ b/firmware/export/config/gogearhdd1630.h
@@ -56,7 +56,7 @@
56 56
57#ifndef BOOTLOADER 57#ifndef BOOTLOADER
58/* Define this if your LCD can be enabled/disabled */ 58/* Define this if your LCD can be enabled/disabled */
59/* #define HAVE_LCD_ENABLE */ 59#define HAVE_LCD_ENABLE
60 60
61/* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE 61/* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE
62 * should be defined as well. 62 * should be defined as well.
diff --git a/firmware/target/arm/philips/hdd1630/backlight-hdd1630.c b/firmware/target/arm/philips/hdd1630/backlight-hdd1630.c
index 00f38bb0f4..95a9ad8b86 100644
--- a/firmware/target/arm/philips/hdd1630/backlight-hdd1630.c
+++ b/firmware/target/arm/philips/hdd1630/backlight-hdd1630.c
@@ -22,6 +22,7 @@
22#include "backlight-target.h" 22#include "backlight-target.h"
23#include "system.h" 23#include "system.h"
24#include "backlight.h" 24#include "backlight.h"
25#include "lcd.h"
25#include "synaptics-mep.h" 26#include "synaptics-mep.h"
26 27
27#ifdef HAVE_BACKLIGHT_BRIGHTNESS 28#ifdef HAVE_BACKLIGHT_BRIGHTNESS
@@ -36,6 +37,10 @@ void _backlight_set_brightness(int brightness)
36 37
37void _backlight_on(void) 38void _backlight_on(void)
38{ 39{
40#ifdef HAVE_LCD_ENABLE
41 lcd_enable(true);
42#endif
43
39 GPO32_ENABLE |= 0x400; 44 GPO32_ENABLE |= 0x400;
40 GPO32_VAL |= 0x400; 45 GPO32_VAL |= 0x400;
41} 46}
@@ -44,6 +49,10 @@ void _backlight_off(void)
44{ 49{
45 GPO32_ENABLE |= 0x400; 50 GPO32_ENABLE |= 0x400;
46 GPO32_VAL &=~0x400; 51 GPO32_VAL &=~0x400;
52
53#ifdef HAVE_LCD_ENABLE
54 lcd_enable(false);
55#endif
47} 56}
48 57
49#ifdef HAVE_BUTTON_LIGHT 58#ifdef HAVE_BUTTON_LIGHT
diff --git a/firmware/target/arm/philips/hdd1630/lcd-hdd1630.c b/firmware/target/arm/philips/hdd1630/lcd-hdd1630.c
index 28bef09463..c26c0bc963 100644
--- a/firmware/target/arm/philips/hdd1630/lcd-hdd1630.c
+++ b/firmware/target/arm/philips/hdd1630/lcd-hdd1630.c
@@ -77,6 +77,9 @@
77#define RDEV 0xd4 77#define RDEV 0xd4
78#define RDRR 0xd5 78#define RDRR 0xd5
79 79
80/* Whether the lcd is currently enabled or not */
81static bool lcd_enabled;
82
80/* Display status */ 83/* Display status */
81static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0; 84static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0;
82static unsigned mad_ctrl = 0; 85static unsigned mad_ctrl = 0;
@@ -239,7 +242,44 @@ void lcd_init_device(void)
239 242
240 lcd_send_cmd(DISPON); 243 lcd_send_cmd(DISPON);
241#endif 244#endif
245 lcd_enabled = true;
246}
247
248#ifdef HAVE_LCD_ENABLE
249/* enable / disable lcd */
250void lcd_enable(bool on)
251{
252 if (on == lcd_enabled)
253 return;
254
255 if (on) /* lcd_display_on() */
256 {
257 /* from the OF */
258 lcd_send_cmd(SLPOUT);
259 sleep(HZ/5); /* 200ms */
260
261 /* Probably out of sync and we don't wanna pepper the code with
262 lcd_update() calls for this. */
263 lcd_update();
264 send_event(LCD_EVENT_ACTIVATION, NULL);
265
266 lcd_enabled = true;
267 }
268 else /* lcd_display_off() */
269 {
270 /* from the OF */
271 lcd_send_cmd(SLPIN);
272
273 lcd_enabled = false;
274 }
275}
276
277
278bool lcd_active(void)
279{
280 return lcd_enabled;
242} 281}
282#endif /* HAVE_LCD_ENABLE */
243 283
244/*** hardware configuration ***/ 284/*** hardware configuration ***/
245int lcd_default_contrast(void) 285int lcd_default_contrast(void)