From 69b4e80f2b528648c155e5aa492b889cb01a086e Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Sun, 17 Sep 2006 09:19:50 +0000 Subject: x5: No more remote LCD streaks when powering off with remote active. Will not affect hot unplugging of course. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10967 a1c6a512-1295-4272-9138-f99709370657 --- .../target/coldfire/iaudio/x5/lcd-remote-target.h | 1 + firmware/target/coldfire/iaudio/x5/lcd-remote-x5.c | 45 +++++++++++++--------- firmware/target/coldfire/iaudio/x5/power-x5.c | 2 + 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/firmware/target/coldfire/iaudio/x5/lcd-remote-target.h b/firmware/target/coldfire/iaudio/x5/lcd-remote-target.h index 8c20526ff3..783363bef3 100755 --- a/firmware/target/coldfire/iaudio/x5/lcd-remote-target.h +++ b/firmware/target/coldfire/iaudio/x5/lcd-remote-target.h @@ -28,6 +28,7 @@ void lcd_remote_powersave(bool on); void lcd_remote_set_contrast(int val); void lcd_remote_on(void); void lcd_remote_off(void); +void lcd_remote_poweroff(void); /* for when remote is plugged during shutdown*/ extern bool remote_initialized; diff --git a/firmware/target/coldfire/iaudio/x5/lcd-remote-x5.c b/firmware/target/coldfire/iaudio/x5/lcd-remote-x5.c index d707e95ca6..46e1eba1fd 100755 --- a/firmware/target/coldfire/iaudio/x5/lcd-remote-x5.c +++ b/firmware/target/coldfire/iaudio/x5/lcd-remote-x5.c @@ -23,23 +23,23 @@ /* The LCD in the iAudio M3/M5/X5 remote control is a Tomato LSI 0350 */ -#define LCD_SET_DUTY_RATIO 0x48 -#define LCD_SELECT_ADC 0xa0 -#define LCD_SELECT_SHL 0xc0 -#define LCD_SET_COM0 0x44 -#define LCD_OSC_ON 0xab -#define LCD_SELECT_DCDC 0x64 -#define LCD_SELECT_RES 0x20 -#define LCD_SET_VOLUME 0x81 -#define LCD_SET_BIAS 0x50 -#define LCD_CONTROL_POWER 0x28 -#define LCD_DISPLAY_ON 0xae -#define LCD_SET_INITLINE 0x40 -#define LCD_SET_COLUMN 0x10 -#define LCD_SET_PAGE 0xb0 -#define LCD_SET_GRAY 0x88 -#define LCD_SET_PWM_FRC 0x90 -#define LCD_SET_POWER_SAVE 0xa8 +#define LCD_SET_DUTY_RATIO 0x48 +#define LCD_SELECT_ADC 0xa0 +#define LCD_SELECT_SHL 0xc0 +#define LCD_SET_COM0 0x44 +#define LCD_OSC_ON 0xab +#define LCD_SELECT_DCDC 0x64 +#define LCD_SELECT_RES 0x20 +#define LCD_SET_VOLUME 0x81 +#define LCD_SET_BIAS 0x50 +#define LCD_CONTROL_POWER 0x28 +#define LCD_DISPLAY_ON 0xae +#define LCD_SET_INITLINE 0x40 +#define LCD_SET_COLUMN 0x10 +#define LCD_SET_PAGE 0xb0 +#define LCD_SET_GRAY 0x88 +#define LCD_SET_PWM_FRC 0x90 +#define LCD_SET_POWER_SAVE 0xa8 #define LCD_REVERSE 0xa6 #define CS_LO and_l(~0x00000020, &GPIO1_OUT) @@ -328,7 +328,7 @@ void lcd_remote_init_device(void) or_l(0x00000020, &GPIO1_OUT); or_l(0x00000020, &GPIO1_ENABLE); or_l(0x00000020, &GPIO1_FUNCTION); - + and_l(~0x01000000, &GPIO_OUT); and_l(~0x01000000, &GPIO_ENABLE); or_l(0x01000000, &GPIO_FUNCTION); @@ -339,7 +339,7 @@ void lcd_remote_on(void) CS_HI; CLK_HI; sleep(10); - + lcd_remote_write_command(LCD_SET_DUTY_RATIO); lcd_remote_write_command(0x70); /* 1/128 */ @@ -382,6 +382,13 @@ void lcd_remote_off(void) RS_HI; } +void lcd_remote_poweroff(void) +{ + /* Set power save -> Power OFF (VDD - VSS) .. that's it */ + if (remote_initialized && remote_detect()) + lcd_remote_write_command(LCD_SET_POWER_SAVE | 1); +} + /* Update the display. This must be called after all other LCD functions that change the display. */ void lcd_remote_update(void) ICODE_ATTR; diff --git a/firmware/target/coldfire/iaudio/x5/power-x5.c b/firmware/target/coldfire/iaudio/x5/power-x5.c index ee06353149..4d44500fd5 100644 --- a/firmware/target/coldfire/iaudio/x5/power-x5.c +++ b/firmware/target/coldfire/iaudio/x5/power-x5.c @@ -23,6 +23,7 @@ #include "system.h" #include "power.h" #include "pcf50606.h" +#include "lcd-remote-target.h" #ifndef SIMULATOR @@ -58,6 +59,7 @@ bool ide_powered(void) void power_off(void) { + lcd_remote_poweroff(); set_irq_level(HIGHEST_IRQ_LEVEL); and_l(~0x00000008, &GPIO_OUT); /* Set KEEPACT low */ asm("halt"); -- cgit v1.2.3