Index: firmware/target/arm/s5l8702/ipod6g/backlight-ipod6g.c =================================================================== --- firmware/target/arm/s5l8702/ipod6g/backlight-ipod6g.c (revision 31637) +++ firmware/target/arm/s5l8702/ipod6g/backlight-ipod6g.c (working copy) @@ -57,9 +57,11 @@ bool _backlight_init(void) { - pmu_write(0x2a, 6); - pmu_write(0x28, 0x20); - pmu_write(0x2b, 20); + /* LEDCTL: overvoltage protection enabled, OCP limit is 500mA */ + pmu_write(0x2a, 0x05); + + pmu_write(0x2b, 0x14); /* T_dimstep = 16 * value / 32768 */ + _backlight_set_brightness(DEFAULT_BRIGHTNESS_SETTING); _backlight_on(); Index: firmware/target/arm/s5l8702/ipod6g/lcd-ipod6g.c =================================================================== --- firmware/target/arm/s5l8702/ipod6g/lcd-ipod6g.c (revision 31637) +++ firmware/target/arm/s5l8702/ipod6g/lcd-ipod6g.c (working copy) @@ -53,6 +53,7 @@ static struct semaphore lcd_wakeup; static struct mutex lcd_mutex; static uint16_t lcd_dblbuf[LCD_HEIGHT][LCD_WIDTH]; +static bool lcd_ispowered; static inline void s5l_lcd_write_cmd_data(int cmd, int data) @@ -100,7 +101,7 @@ bool lcd_active(void) { - return true; + return lcd_ispowered; } void lcd_shutdown(void) @@ -137,13 +138,55 @@ s5l_lcd_write_cmd(0x10); sleep(HZ / 20); } + lcd_ispowered = false; mutex_unlock(&lcd_mutex); } #ifdef HAVE_LCD_SLEEP +void lcd_awake(void) +{ + /* unmask lcd controller clock gate */ + PWRCON(0) &= ~(1 << 1); + + if (lcd_type & 2) { + // TODO + return; + } + else /* lcd_type == 0 || lcd_type == 1 */ + { + s5l_lcd_write_cmd(0x11); /* Sleep Out mode */ + sleep(HZ / 15); + s5l_lcd_write_cmd(0x29); /* Display On */ + } + + lcd_ispowered = true; + + send_event(LCD_EVENT_ACTIVATION, NULL); +} + void lcd_sleep(void) { - lcd_shutdown(); + mutex_lock(&lcd_mutex); + + if (lcd_type & 2) { + // TODO + mutex_unlock(&lcd_mutex); + return; + } + else /* lcd_type == 0 || lcd_type == 1 */ + { + s5l_lcd_write_cmd(0x28); /* Display Off */ + sleep(HZ / 20); + s5l_lcd_write_cmd(0x10); /* Sleep In Mode */ + sleep(HZ / 20); + } + + /* mask LCD controller clock gate */ + PWRCON(0) |= (1 << 1); + + lcd_ispowered = false; + + mutex_unlock(&lcd_mutex); } #endif Index: firmware/export/config/ipod6g.h =================================================================== --- firmware/export/config/ipod6g.h (revision 31637) +++ firmware/export/config/ipod6g.h (working copy) @@ -93,8 +93,8 @@ /* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE should be defined as well. */ #ifndef BOOTLOADER -//TODO: #define HAVE_LCD_SLEEP -//TODO: #define HAVE_LCD_SLEEP_SETTING +#define HAVE_LCD_SLEEP +#define HAVE_LCD_SLEEP_SETTING #endif #define CONFIG_KEYPAD IPOD_4G_PAD