diff options
author | David Brownell <david-b@pacbell.net> | 2007-05-08 03:33:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 14:15:18 -0400 |
commit | 7ca1d488ffe4817adaba61cc05b972782f7d3f91 (patch) | |
tree | 97fee4d2ddbc5be5265d99f5825e902f7a9262c1 /drivers/rtc/rtc-s3c.c | |
parent | cd9662094edf4173e87f0452e57e4eacc228f8ff (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-s3c.c')
-rw-r--r-- | drivers/rtc/rtc-s3c.c | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 3617c970caaa..54b613053468 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
@@ -548,37 +548,15 @@ static int ticnt_save; | |||
548 | 548 | ||
549 | static int s3c_rtc_suspend(struct platform_device *pdev, pm_message_t state) | 549 | static int s3c_rtc_suspend(struct platform_device *pdev, pm_message_t state) |
550 | { | 550 | { |
551 | struct rtc_time tm; | ||
552 | struct timespec time; | ||
553 | |||
554 | time.tv_nsec = 0; | ||
555 | |||
556 | /* save TICNT for anyone using periodic interrupts */ | 551 | /* save TICNT for anyone using periodic interrupts */ |
557 | |||
558 | ticnt_save = readb(s3c_rtc_base + S3C2410_TICNT); | 552 | ticnt_save = readb(s3c_rtc_base + S3C2410_TICNT); |
559 | |||
560 | /* calculate time delta for suspend */ | ||
561 | |||
562 | s3c_rtc_gettime(&pdev->dev, &tm); | ||
563 | rtc_tm_to_time(&tm, &time.tv_sec); | ||
564 | save_time_delta(&s3c_rtc_delta, &time); | ||
565 | s3c_rtc_enable(pdev, 0); | 553 | s3c_rtc_enable(pdev, 0); |
566 | |||
567 | return 0; | 554 | return 0; |
568 | } | 555 | } |
569 | 556 | ||
570 | static int s3c_rtc_resume(struct platform_device *pdev) | 557 | static int s3c_rtc_resume(struct platform_device *pdev) |
571 | { | 558 | { |
572 | struct rtc_time tm; | ||
573 | struct timespec time; | ||
574 | |||
575 | time.tv_nsec = 0; | ||
576 | |||
577 | s3c_rtc_enable(pdev, 1); | 559 | s3c_rtc_enable(pdev, 1); |
578 | s3c_rtc_gettime(&pdev->dev, &tm); | ||
579 | rtc_tm_to_time(&tm, &time.tv_sec); | ||
580 | restore_time_delta(&s3c_rtc_delta, &time); | ||
581 | |||
582 | writeb(ticnt_save, s3c_rtc_base + S3C2410_TICNT); | 560 | writeb(ticnt_save, s3c_rtc_base + S3C2410_TICNT); |
583 | return 0; | 561 | return 0; |
584 | } | 562 | } |