From 3c561f2cf999b2d805084aabeb4d5feac6fa3893 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Thu, 13 Mar 2008 19:36:58 +0000 Subject: Make the LCD remote work in the Iriver H1x0 and H300 bootloaders as well (untested). * Only try the initial remote LCD init if the remote is plugged, and do it in main builds as well, giving slightly earlier remote LCD output when booting. * Fix delays in the X5/M5 remote LCD init. * Remove an unnecessary check in the X5/M5 remote LCD driver and the M3 LCD driver. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16655 a1c6a512-1295-4272-9138-f99709370657 --- .../target/coldfire/iaudio/lcd-remote-iaudio.c | 12 ++--- firmware/target/coldfire/iaudio/m3/lcd-m3.c | 8 +-- .../target/coldfire/iriver/lcd-remote-iriver.c | 58 ++++++++++++---------- 3 files changed, 42 insertions(+), 36 deletions(-) (limited to 'firmware') diff --git a/firmware/target/coldfire/iaudio/lcd-remote-iaudio.c b/firmware/target/coldfire/iaudio/lcd-remote-iaudio.c index 3c14bb61a0..5a03dc6180 100644 --- a/firmware/target/coldfire/iaudio/lcd-remote-iaudio.c +++ b/firmware/target/coldfire/iaudio/lcd-remote-iaudio.c @@ -324,7 +324,7 @@ void lcd_remote_on(void) { CS_HI; CLK_HI; - sleep(10); + sleep(HZ/100); lcd_remote_write_command(LCD_SET_DUTY_RATIO); lcd_remote_write_command(0x70); /* 1/128 */ @@ -339,7 +339,7 @@ void lcd_remote_on(void) lcd_remote_write_command(LCD_CONTROL_POWER | 7); /* All circuits ON */ - sleep(30); + sleep(3*HZ/100); lcd_remote_write_command_ex(LCD_SET_GRAY | 0, 0x00); lcd_remote_write_command_ex(LCD_SET_GRAY | 1, 0x00); @@ -371,7 +371,7 @@ void lcd_remote_off(void) void lcd_remote_poweroff(void) { /* Set power save -> Power OFF (VDD - VSS) .. that's it */ - if (remote_initialized && remote_detect()) + if (remote_initialized) lcd_remote_write_command(LCD_SET_POWER_SAVE | 1); } @@ -430,9 +430,9 @@ void lcd_remote_init_device(void) or_l(0x01000000, &GPIO_FUNCTION); lcd_remote_clear_display(); -#ifdef BOOTLOADER - lcd_remote_on(); -#else + if (remote_detect()) + lcd_remote_on(); +#ifndef BOOTLOADER tick_add_task(remote_tick); #endif } diff --git a/firmware/target/coldfire/iaudio/m3/lcd-m3.c b/firmware/target/coldfire/iaudio/m3/lcd-m3.c index d54e0596ab..b8c410b321 100644 --- a/firmware/target/coldfire/iaudio/m3/lcd-m3.c +++ b/firmware/target/coldfire/iaudio/m3/lcd-m3.c @@ -362,7 +362,7 @@ void lcd_off(void) void lcd_poweroff(void) { /* Set power save -> Power OFF (VDD - VSS) .. that's it */ - if (initialized && remote_detect()) + if (initialized) lcd_write_command(LCD_SET_POWER_SAVE | 1); } @@ -421,9 +421,9 @@ void lcd_init_device(void) or_l(0x40000000, &GPIO_FUNCTION); lcd_clear_display(); -#ifdef BOOTLOADER - lcd_on(); -#else + if (remote_detect()) + lcd_on(); +#ifndef BOOTLOADER tick_add_task(lcd_tick); #endif } diff --git a/firmware/target/coldfire/iriver/lcd-remote-iriver.c b/firmware/target/coldfire/iriver/lcd-remote-iriver.c index 29dbfad3db..cab7cc4104 100644 --- a/firmware/target/coldfire/iriver/lcd-remote-iriver.c +++ b/firmware/target/coldfire/iriver/lcd-remote-iriver.c @@ -72,7 +72,6 @@ static bool cached_invert = false; static bool cached_flip = false; static int cached_contrast = DEFAULT_REMOTE_CONTRAST_SETTING; -static void remote_tick(void); #ifdef HAVE_REMOTE_LCD_TICKING static inline void _byte_delay(int delay) @@ -414,31 +413,6 @@ int remote_type(void) return _remote_type; } -void lcd_remote_init_device(void) -{ -#ifdef IRIVER_H300_SERIES - or_l(0x10010000, &GPIO_FUNCTION); /* GPIO16: RS - GPIO28: CLK */ - - or_l(0x00040006, &GPIO1_FUNCTION); /* GPO33: Backlight - GPIO34: CS - GPIO50: Data */ - or_l(0x10010000, &GPIO_ENABLE); - or_l(0x00040006, &GPIO1_ENABLE); -#else - or_l(0x10010800, &GPIO_FUNCTION); /* GPIO11: Backlight - GPIO16: RS - GPIO28: CLK */ - - or_l(0x00040004, &GPIO1_FUNCTION); /* GPIO34: CS - GPIO50: Data */ - or_l(0x10010800, &GPIO_ENABLE); - or_l(0x00040004, &GPIO1_ENABLE); -#endif - lcd_remote_clear_display(); - tick_add_task(remote_tick); -} - void lcd_remote_on(void) { CS_HI; @@ -475,6 +449,7 @@ void lcd_remote_off(void) CS_HI; } +#ifndef BOOTLOADER /* Monitor remote hotswap */ static void remote_tick(void) { @@ -549,6 +524,37 @@ static void remote_tick(void) if (cs_countdown == 0) CS_HI; } +#endif + +void lcd_remote_init_device(void) +{ +#ifdef IRIVER_H300_SERIES + or_l(0x10010000, &GPIO_FUNCTION); /* GPIO16: RS + GPIO28: CLK */ + + or_l(0x00040006, &GPIO1_FUNCTION); /* GPO33: Backlight + GPIO34: CS + GPIO50: Data */ + or_l(0x10010000, &GPIO_ENABLE); + or_l(0x00040006, &GPIO1_ENABLE); +#else + or_l(0x10010800, &GPIO_FUNCTION); /* GPIO11: Backlight + GPIO16: RS + GPIO28: CLK */ + + or_l(0x00040004, &GPIO1_FUNCTION); /* GPIO34: CS + GPIO50: Data */ + or_l(0x10010800, &GPIO_ENABLE); + or_l(0x00040004, &GPIO1_ENABLE); +#endif + + lcd_remote_clear_display(); + if (remote_detect()) + lcd_remote_on(); +#ifndef BOOTLOADER + tick_add_task(remote_tick); +#endif +} /* Update the display. This must be called after all other LCD functions that change the display. */ -- cgit v1.2.3