summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2010-05-24 10:06:46 +0000
committerRafaël Carré <rafael.carre@gmail.com>2010-05-24 10:06:46 +0000
commiteae2464e9a93dc3a8918abcc62348af6c8d9bc9b (patch)
treec1057f21182c77082551360ead33d6b9f36b12e6
parentdda102ed4aae4bf32108ae9751c01d6883a6ae2c (diff)
downloadrockbox-eae2464e9a93dc3a8918abcc62348af6c8d9bc9b.tar.gz
rockbox-eae2464e9a93dc3a8918abcc62348af6c8d9bc9b.tar.bz2
rockbox-eae2464e9a93dc3a8918abcc62348af6c8d9bc9b.zip
as3543 rtc wakeup: fix power off
If we disable the hearbeat source after enabling the watchdog there's no more lock-up when powering off the dap Comment out alarm enabling on startup since rockbox disables the alarm anyway git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26247 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/drivers/rtc/rtc_as3514.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/firmware/drivers/rtc/rtc_as3514.c b/firmware/drivers/rtc/rtc_as3514.c
index e5db839e77..837806d2ea 100644
--- a/firmware/drivers/rtc/rtc_as3514.c
+++ b/firmware/drivers/rtc/rtc_as3514.c
@@ -93,8 +93,6 @@ void rtc_alarm_poweroff(void)
disable_irq();
- ascodec_write_pmu(0x1a, 4, 0x0); // In_Cntr : disable hearbeat source
-
ascodec_write(AS3543_WAKEUP, seconds);
seconds >>= 8;
ascodec_write(AS3543_WAKEUP, seconds);
@@ -102,11 +100,15 @@ void rtc_alarm_poweroff(void)
seconds |= 1<<7; /* enable bit */
ascodec_write(AS3543_WAKEUP, seconds);
- /* write our watermark : desired time of wake up */
+ /* write our desired time of wake up to detect power-up from RTC */
ascodec_write(AS3543_WAKEUP, wakeup_h);
ascodec_write(AS3543_WAKEUP, wakeup_m);
- ascodec_write(AS3514_SYSTEM, (1<<3) | (1<<0)); // enable hearbeat watchdog
+ /* enable hearbeat watchdog */
+ ascodec_write(AS3514_SYSTEM, (1<<3) | (1<<0));
+
+ /* In_Cntr : disable hearbeat source */
+ ascodec_write_pmu(0x1a, 4, ascodec_read_pmu(0x1a, 4) & ~(3<<2));
while(1);
}
@@ -128,7 +130,9 @@ bool rtc_check_alarm_started(bool release_alarm)
ascodec_read(AS3543_WAKEUP); /* bits 15:8 */
if(ascodec_read(AS3543_WAKEUP) & (1<<7)) /* enable bit */
{
+#if 0 /* we could have a persistent setting for wake-up time */
alarm_enabled = true;
+#endif
/* subsequent reads give the 16 bytes static SRAM */
wakeup_h = ascodec_read(AS3543_WAKEUP);