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. */