diff options
-rw-r--r-- | firmware/export/config/gogearhdd1630.h | 2 | ||||
-rw-r--r-- | firmware/target/arm/philips/hdd1630/backlight-hdd1630.c | 9 | ||||
-rw-r--r-- | firmware/target/arm/philips/hdd1630/lcd-hdd1630.c | 40 |
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 @@ #ifndef BOOTLOADER /* Define this if your LCD can be enabled/disabled */ -/* #define HAVE_LCD_ENABLE */ +#define HAVE_LCD_ENABLE /* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE * 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 @@ #include "backlight-target.h" #include "system.h" #include "backlight.h" +#include "lcd.h" #include "synaptics-mep.h" #ifdef HAVE_BACKLIGHT_BRIGHTNESS @@ -36,6 +37,10 @@ void _backlight_set_brightness(int brightness) void _backlight_on(void) { +#ifdef HAVE_LCD_ENABLE + lcd_enable(true); +#endif + GPO32_ENABLE |= 0x400; GPO32_VAL |= 0x400; } @@ -44,6 +49,10 @@ void _backlight_off(void) { GPO32_ENABLE |= 0x400; GPO32_VAL &=~0x400; + +#ifdef HAVE_LCD_ENABLE + lcd_enable(false); +#endif } #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 @@ #define RDEV 0xd4 #define RDRR 0xd5 +/* Whether the lcd is currently enabled or not */ +static bool lcd_enabled; + /* Display status */ static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0; static unsigned mad_ctrl = 0; @@ -239,7 +242,44 @@ void lcd_init_device(void) lcd_send_cmd(DISPON); #endif + lcd_enabled = true; +} + +#ifdef HAVE_LCD_ENABLE +/* enable / disable lcd */ +void lcd_enable(bool on) +{ + if (on == lcd_enabled) + return; + + if (on) /* lcd_display_on() */ + { + /* from the OF */ + lcd_send_cmd(SLPOUT); + sleep(HZ/5); /* 200ms */ + + /* Probably out of sync and we don't wanna pepper the code with + lcd_update() calls for this. */ + lcd_update(); + send_event(LCD_EVENT_ACTIVATION, NULL); + + lcd_enabled = true; + } + else /* lcd_display_off() */ + { + /* from the OF */ + lcd_send_cmd(SLPIN); + + lcd_enabled = false; + } +} + + +bool lcd_active(void) +{ + return lcd_enabled; } +#endif /* HAVE_LCD_ENABLE */ /*** hardware configuration ***/ int lcd_default_contrast(void) |