summaryrefslogtreecommitdiff
path: root/arch/i386/kernel/timers/timer_hpet.c
diff options
context:
space:
mode:
authorShaohua Li <shaohua.li@intel.com>2005-09-03 15:57:07 -0700
committerLinus Torvalds <torvalds@evo.osdl.org>2005-09-05 00:06:18 -0700
commitc3c433e4f33afe255389ba3b1a003dc8deb3de9a (patch)
tree071304e15e21e0a93c17050000a682f4ae1a98c1 /arch/i386/kernel/timers/timer_hpet.c
parent57c4ce3cbfba1bb0da7f37b9328a713cbd5d0919 (diff)
[PATCH] add suspend/resume for timer
The timers lack .suspend/.resume methods. Because of this, jiffies got a big compensation after a S3 resume. And then softlockup watchdog reports an oops. This occured with HPET enabled, but it's also possible for other timers. Signed-off-by: Shaohua Li <shaohua.li@intel.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/i386/kernel/timers/timer_hpet.c')
-rw-r--r--arch/i386/kernel/timers/timer_hpet.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/i386/kernel/timers/timer_hpet.c b/arch/i386/kernel/timers/timer_hpet.c
index cbb3f221ced8..001de97c9e4a 100644
--- a/arch/i386/kernel/timers/timer_hpet.c
+++ b/arch/i386/kernel/timers/timer_hpet.c
@@ -181,6 +181,19 @@ static int __init init_hpet(char* override)
return 0;
}
+static int hpet_resume(void)
+{
+ write_seqlock(&monotonic_lock);
+ /* Assume this is the last mark offset time */
+ rdtsc(last_tsc_low, last_tsc_high);
+
+ if (hpet_use_timer)
+ hpet_last = hpet_readl(HPET_T0_CMP) - hpet_tick;
+ else
+ hpet_last = hpet_readl(HPET_COUNTER);
+ write_sequnlock(&monotonic_lock);
+ return 0;
+}
/************************************************************/
/* tsc timer_opts struct */
@@ -190,6 +203,7 @@ static struct timer_opts timer_hpet __read_mostly = {
.get_offset = get_offset_hpet,
.monotonic_clock = monotonic_clock_hpet,
.delay = delay_hpet,
+ .resume = hpet_resume,
};
struct init_timer_opts __initdata timer_hpet_init = {