From d4bfc1523268213437c1506ebd3857521b530144 Mon Sep 17 00:00:00 2001 From: Torne Wuff Date: Sat, 9 Jan 2010 19:04:51 +0000 Subject: FS#10107: work around the issue on some ipods where after shutdown they do not power on. Some ipods do not power on correctly after being shut down and require a hard reset before they work again. This workaround shuts the device down via the OF which prevents the problem from occurring. There is a cosmetic effect: the low battery symbol appears briefly on power of. Change applies to PP502x ipods: 4G/photo/video/mini1g/mini2g/nano1g Patch by Boris Gjenero (dreamlayers), manual changes by me. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24207 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/ipod/power-ipod.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'firmware') diff --git a/firmware/target/arm/ipod/power-ipod.c b/firmware/target/arm/ipod/power-ipod.c index 0b516466fe..46701c8d3f 100644 --- a/firmware/target/arm/ipod/power-ipod.c +++ b/firmware/target/arm/ipod/power-ipod.c @@ -28,6 +28,10 @@ #include "pcf50605.h" #include "usb.h" #include "lcd.h" +#include "string.h" +#if CONFIG_CPU == PP5022 || CONFIG_CPU == PP5020 +#include "rtc.h" +#endif void power_init(void) { @@ -152,9 +156,24 @@ void power_off(void) #endif #ifndef BOOTLOADER -#ifdef IPOD_1G2G +#if CONFIG_CPU == PP5022 || CONFIG_CPU == PP5020 + /* When shut down by OF, wakeup via alarm is enabled. This resets the + alarm time so an unintended wakeup does not occur. */ + if (!(pcf50605_wakeup_flags & 0x10)) + rtc_enable_alarm(false); +#endif +#if defined(IPOD_1G2G) /* we cannot turn off the 1st gen/ 2nd gen yet. Need to figure out sleep mode. */ system_reboot(); +#elif CONFIG_CPU == PP5022 + /* The OF in flash assumes boot failed because the battery is low. + If there is no charger connected, this leads to a shutdown. + */ + memcpy((void *)(0x4001ff00+8), "booting!", 8); + system_reboot(); +#elif CONFIG_CPU == PP5020 + memcpy((void *)(0x40017f00+8), "booting!", 8); + system_reboot(); #else /* We don't turn off the ipod, we put it in a deep sleep */ pcf50605_standby_mode(); -- cgit v1.2.3