Commit 68cfa179 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] suspend/resume support for PIT

From: Pavel Machek <pavel@ucw.cz>

This adds proper suspend/resume support for PIT.  That means that clock are
actually correct after suspend/resume.
parent 7f6060e8
...@@ -307,7 +307,31 @@ unsigned long get_cmos_time(void) ...@@ -307,7 +307,31 @@ unsigned long get_cmos_time(void)
return retval; return retval;
} }
static long clock_cmos_diff;
static int time_suspend(struct sys_device *dev, u32 state)
{
/*
* Estimate time zone so that set_time can update the clock
*/
clock_cmos_diff = -get_cmos_time();
clock_cmos_diff += get_seconds();
return 0;
}
static int time_resume(struct sys_device *dev)
{
unsigned long sec = get_cmos_time() + clock_cmos_diff;
write_seqlock_irq(&xtime_lock);
xtime.tv_sec = sec;
xtime.tv_nsec = 0;
write_sequnlock_irq(&xtime_lock);
return 0;
}
static struct sysdev_class pit_sysclass = { static struct sysdev_class pit_sysclass = {
.resume = time_resume,
.suspend = time_suspend,
set_kset_name("pit"), set_kset_name("pit"),
}; };
......
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