From 3a5dccf9ef176823e6faffa2c328d094e0d918bd Mon Sep 17 00:00:00 2001 From: Russell King Date: Fri, 5 Sep 2003 19:04:35 +0100 Subject: [PATCH] [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 --- arch/arm/mach-pxa/pm.c | 15 ++++----------- arch/arm/mach-sa1100/pm.c | 9 +++++++-- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/arch/arm/mach-pxa/pm.c b/arch/arm/mach-pxa/pm.c index 98b4d76cf7c37..c8183c873e1a9 100644 --- a/arch/arm/mach-pxa/pm.c +++ b/arch/arm/mach-pxa/pm.c @@ -12,6 +12,7 @@ */ #include +#include #include #include @@ -63,15 +64,11 @@ int pm_do_suspend(void) { unsigned long sleep_save[SLEEP_SAVE_SIZE]; unsigned long checksum = 0; + unsigned long delta; int i; - cli(); - clf(); - - leds_event(led_stop); - /* preserve current time */ - RCNR = xtime.tv_sec; + delta = xtime.tv_sec - RCNR; /* * Temporary solution. This won't be necessary once @@ -184,16 +181,12 @@ int pm_do_suspend(void) RESTORE(FFIER); /* restore current time */ - xtime.tv_sec = RCNR; + xtime.tv_sec = RCNR + delta; #ifdef DEBUG printk(KERN_DEBUG "*** made it back from resume\n"); #endif - leds_event(led_start); - - sti(); - return 0; } diff --git a/arch/arm/mach-sa1100/pm.c b/arch/arm/mach-sa1100/pm.c index ca55d99f678ed..5c37635429bdb 100644 --- a/arch/arm/mach-sa1100/pm.c +++ b/arch/arm/mach-sa1100/pm.c @@ -57,9 +57,11 @@ enum { SLEEP_SAVE_SP = 0, int pm_do_suspend(void) { unsigned long sleep_save[SLEEP_SAVE_SIZE]; + unsigned long delta, gpio; /* preserve current time */ - RCNR = xtime.tv_sec; + delta = xtime.tv_sec - RCNR; + gpio = GPLR; /* save vital registers */ SAVE(OSCR); @@ -112,6 +114,9 @@ int pm_do_suspend(void) RESTORE(Ser1SDCR0); + GPSR = gpio; + GPCR = ~gpio; + /* * Clear the peripheral sleep-hold bit. */ @@ -125,7 +130,7 @@ int pm_do_suspend(void) RESTORE(OIER); /* restore current time */ - xtime.tv_sec = RCNR; + xtime.tv_sec = RCNR + delta; return 0; } -- 2.53.0