Commit 3a5dccf9 authored by Russell King's avatar Russell King

[ARM] Fix PXA and SA1100 suspend/resume

- Don't write the current time back to the RTC on suspend - we may
  jump over a programmed wakeup alarm.
- Restore SA1100 GPIO output state
parent dccfefd2
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
*/ */
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/time.h>
#include <asm/hardware.h> #include <asm/hardware.h>
#include <asm/memory.h> #include <asm/memory.h>
...@@ -63,15 +64,11 @@ int pm_do_suspend(void) ...@@ -63,15 +64,11 @@ int pm_do_suspend(void)
{ {
unsigned long sleep_save[SLEEP_SAVE_SIZE]; unsigned long sleep_save[SLEEP_SAVE_SIZE];
unsigned long checksum = 0; unsigned long checksum = 0;
unsigned long delta;
int i; int i;
cli();
clf();
leds_event(led_stop);
/* preserve current time */ /* preserve current time */
RCNR = xtime.tv_sec; delta = xtime.tv_sec - RCNR;
/* /*
* Temporary solution. This won't be necessary once * Temporary solution. This won't be necessary once
...@@ -184,16 +181,12 @@ int pm_do_suspend(void) ...@@ -184,16 +181,12 @@ int pm_do_suspend(void)
RESTORE(FFIER); RESTORE(FFIER);
/* restore current time */ /* restore current time */
xtime.tv_sec = RCNR; xtime.tv_sec = RCNR + delta;
#ifdef DEBUG #ifdef DEBUG
printk(KERN_DEBUG "*** made it back from resume\n"); printk(KERN_DEBUG "*** made it back from resume\n");
#endif #endif
leds_event(led_start);
sti();
return 0; return 0;
} }
......
...@@ -57,9 +57,11 @@ enum { SLEEP_SAVE_SP = 0, ...@@ -57,9 +57,11 @@ enum { SLEEP_SAVE_SP = 0,
int pm_do_suspend(void) int pm_do_suspend(void)
{ {
unsigned long sleep_save[SLEEP_SAVE_SIZE]; unsigned long sleep_save[SLEEP_SAVE_SIZE];
unsigned long delta, gpio;
/* preserve current time */ /* preserve current time */
RCNR = xtime.tv_sec; delta = xtime.tv_sec - RCNR;
gpio = GPLR;
/* save vital registers */ /* save vital registers */
SAVE(OSCR); SAVE(OSCR);
...@@ -112,6 +114,9 @@ int pm_do_suspend(void) ...@@ -112,6 +114,9 @@ int pm_do_suspend(void)
RESTORE(Ser1SDCR0); RESTORE(Ser1SDCR0);
GPSR = gpio;
GPCR = ~gpio;
/* /*
* Clear the peripheral sleep-hold bit. * Clear the peripheral sleep-hold bit.
*/ */
...@@ -125,7 +130,7 @@ int pm_do_suspend(void) ...@@ -125,7 +130,7 @@ int pm_do_suspend(void)
RESTORE(OIER); RESTORE(OIER);
/* restore current time */ /* restore current time */
xtime.tv_sec = RCNR; xtime.tv_sec = RCNR + delta;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment