From f548336e271f970d7ccd8a84e85ce8590ff7deab Mon Sep 17 00:00:00 2001 From: Nicolas Pennequin Date: Sat, 29 Sep 2007 20:56:07 +0000 Subject: [PATCH] Fix the LCD line remaining active after shutdown on grayscale ipods (FS#5199). Original patch by Tomasz Mon, modified by me. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14907 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/config-ipod1g2g.h | 3 +++ firmware/export/config-ipod3g.h | 3 +++ firmware/export/config-ipod4g.h | 3 +++ firmware/export/config-ipodmini.h | 3 +++ firmware/export/config-ipodmini2g.h | 3 +++ firmware/export/lcd.h | 4 ++++ firmware/powermgmt.c | 4 ++++ firmware/target/arm/ipod/lcd-gray.c | 9 +++++++++ 8 files changed, 32 insertions(+) diff --git a/firmware/export/config-ipod1g2g.h b/firmware/export/config-ipod1g2g.h index d51a7437ec..138ef8dc77 100644 --- a/firmware/export/config-ipod1g2g.h +++ b/firmware/export/config-ipod1g2g.h @@ -17,6 +17,9 @@ /* define this if you can invert the colours on your LCD */ #define HAVE_LCD_INVERT +/* define this if the LCD needs to be shutdown */ +#define HAVE_LCD_SHUTDOWN + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN /* define this if you have access to the pitchscreen */ diff --git a/firmware/export/config-ipod3g.h b/firmware/export/config-ipod3g.h index 6555aad9db..e3c2a922d9 100644 --- a/firmware/export/config-ipod3g.h +++ b/firmware/export/config-ipod3g.h @@ -17,6 +17,9 @@ /* define this if you can invert the colours on your LCD */ #define HAVE_LCD_INVERT +/* define this if the LCD needs to be shutdown */ +#define HAVE_LCD_SHUTDOWN + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN /* define this if you have access to the pitchscreen */ diff --git a/firmware/export/config-ipod4g.h b/firmware/export/config-ipod4g.h index 28f7b8b5a9..d75650ba4f 100644 --- a/firmware/export/config-ipod4g.h +++ b/firmware/export/config-ipod4g.h @@ -27,6 +27,9 @@ /* define this if you can invert the colours on your LCD */ #define HAVE_LCD_INVERT +/* define this if the LCD needs to be shutdown */ +#define HAVE_LCD_SHUTDOWN + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN /* define this if you have access to the pitchscreen */ diff --git a/firmware/export/config-ipodmini.h b/firmware/export/config-ipodmini.h index a7d86427b3..3b2473718d 100644 --- a/firmware/export/config-ipodmini.h +++ b/firmware/export/config-ipodmini.h @@ -17,6 +17,9 @@ /* define this if you can invert the colours on your LCD */ #define HAVE_LCD_INVERT +/* define this if the LCD needs to be shutdown */ +#define HAVE_LCD_SHUTDOWN + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN /* define this if you have access to the pitchscreen */ diff --git a/firmware/export/config-ipodmini2g.h b/firmware/export/config-ipodmini2g.h index d8c5f9f755..34e5f5a46b 100644 --- a/firmware/export/config-ipodmini2g.h +++ b/firmware/export/config-ipodmini2g.h @@ -17,6 +17,9 @@ /* define this if you can invert the colours on your LCD */ #define HAVE_LCD_INVERT +/* define this if the LCD needs to be shutdown */ +#define HAVE_LCD_SHUTDOWN + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN /* define this if you have access to the pitchscreen */ diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index 2ea9906a2a..eb67a12211 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h @@ -288,6 +288,10 @@ extern bool lcd_enabled(void); extern void lcd_sleep(void); #endif /* HAVE_LCD_SLEEP */ +#ifdef HAVE_LCD_SHUTDOWN +void lcd_shutdown(void); +#endif + /* Bitmap formats */ enum { diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index 50a2579cb5..bb88fce318 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c @@ -1181,6 +1181,10 @@ void shutdown_hw(void) lcd_remote_set_contrast(0); #endif +#ifdef HAVE_LCD_SHUTDOWN + lcd_shutdown(); +#endif + /* Small delay to make sure all HW gets time to flush. Especially eeprom chips are quite slow and might be still writing the last byte. */ diff --git a/firmware/target/arm/ipod/lcd-gray.c b/firmware/target/arm/ipod/lcd-gray.c index 265cc447d7..707075b701 100644 --- a/firmware/target/arm/ipod/lcd-gray.c +++ b/firmware/target/arm/ipod/lcd-gray.c @@ -368,3 +368,12 @@ void lcd_update(void) { lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT); } + +#ifdef HAVE_LCD_SHUTDOWN +/* LCD powerdown */ +void lcd_shutdown(void) +{ + lcd_cmd_and_data(R_POWER_CONTROL, 0x1500); /* Turn off op amp power */ + lcd_cmd_and_data(R_POWER_CONTROL, 0x1502); /* Put LCD driver in standby */ +} +#endif