aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-omap.c
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2007-05-08 03:33:42 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:15:18 -0400
commit7ca1d488ffe4817adaba61cc05b972782f7d3f91 (patch)
tree97fee4d2ddbc5be5265d99f5825e902f7a9262c1 /drivers/rtc/rtc-omap.c
parentcd9662094edf4173e87f0452e57e4eacc228f8ff (diff)
rtc: suspend()/resume() restores system clock
RTC class suspend/resume support, re-initializing the system clock on resume from the clock used to initialize it at boot time. - The reinit-on-resume is hooked to the existing RTC_HCTOSYS config option, on the grounds that a clock good enough for init must also be good enough for re-init. - Inlining a version of the code used by ARM, to save and restore the delta between a selected RTC and the current system wall-clock time. - Removes calls to that ARM code from AT91, OMAP1, and S3C RTCs. This means that systems using those RTCs across suspend/resume will likely want to change their kernel configs to enable RTC_HCTOSYS. If HCTOSYS isn't using a second RTC (with battery?), this changes the system's initial date from Jan 1970 to the epoch this hardware uses: 1998 for AT91, 2000 for OMAP1 (assuming no split power mode), etc. This goes on top of the patch series removing "struct class_device" usage from the RTC framework. That's all needed for class suspend()/resume(). Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Acked-By: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc/rtc-omap.c')
-rw-r--r--drivers/rtc/rtc-omap.c17
1 files changed, 0 insertions, 17 deletions
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index ded35fd13ba0..e6c7b0149f27 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -488,19 +488,10 @@ static int __devexit omap_rtc_remove(struct platform_device *pdev)
488 488
489#ifdef CONFIG_PM 489#ifdef CONFIG_PM
490 490
491static struct timespec rtc_delta;
492static u8 irqstat; 491static u8 irqstat;
493 492
494static int omap_rtc_suspend(struct platform_device *pdev, pm_message_t state) 493static int omap_rtc_suspend(struct platform_device *pdev, pm_message_t state)
495{ 494{
496 struct rtc_time rtc_tm;
497 struct timespec time;
498
499 time.tv_nsec = 0;
500 omap_rtc_read_time(NULL, &rtc_tm);
501 rtc_tm_to_time(&rtc_tm, &time.tv_sec);
502
503 save_time_delta(&rtc_delta, &time);
504 irqstat = rtc_read(OMAP_RTC_INTERRUPTS_REG); 495 irqstat = rtc_read(OMAP_RTC_INTERRUPTS_REG);
505 496
506 /* FIXME the RTC alarm is not currently acting as a wakeup event 497 /* FIXME the RTC alarm is not currently acting as a wakeup event
@@ -517,14 +508,6 @@ static int omap_rtc_suspend(struct platform_device *pdev, pm_message_t state)
517 508
518static int omap_rtc_resume(struct platform_device *pdev) 509static int omap_rtc_resume(struct platform_device *pdev)
519{ 510{
520 struct rtc_time rtc_tm;
521 struct timespec time;
522
523 time.tv_nsec = 0;
524 omap_rtc_read_time(NULL, &rtc_tm);
525 rtc_tm_to_time(&rtc_tm, &time.tv_sec);
526
527 restore_time_delta(&rtc_delta, &time);
528 if (device_may_wakeup(&pdev->dev)) 511 if (device_may_wakeup(&pdev->dev))
529 disable_irq_wake(omap_rtc_alarm); 512 disable_irq_wake(omap_rtc_alarm);
530 else 513 else