aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/kernel/time.c')
-rw-r--r--arch/sh/kernel/time.c39
1 files changed, 32 insertions, 7 deletions
diff --git a/arch/sh/kernel/time.c b/arch/sh/kernel/time.c
index 314a275c04e072..e24e9289c83e03 100644
--- a/arch/sh/kernel/time.c
+++ b/arch/sh/kernel/time.c
@@ -30,11 +30,11 @@ EXPORT_SYMBOL(rtc_lock);
/* XXX: Can we initialize this in a routine somewhere? Dreamcast doesn't want
* these routines anywhere... */
#ifdef CONFIG_SH_RTC
-void (*rtc_get_time)(struct timespec *) = sh_rtc_gettimeofday;
-int (*rtc_set_time)(const time_t) = sh_rtc_settimeofday;
+void (*rtc_sh_get_time)(struct timespec *) = sh_rtc_gettimeofday;
+int (*rtc_sh_set_time)(const time_t) = sh_rtc_settimeofday;
#else
-void (*rtc_get_time)(struct timespec *);
-int (*rtc_set_time)(const time_t);
+void (*rtc_sh_get_time)(struct timespec *);
+int (*rtc_sh_set_time)(const time_t);
#endif
/*
@@ -136,7 +136,7 @@ void handle_timer_tick(struct pt_regs *regs)
xtime.tv_sec > last_rtc_update + 660 &&
(xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 &&
(xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) {
- if (rtc_set_time(xtime.tv_sec) == 0)
+ if (rtc_sh_set_time(xtime.tv_sec) == 0)
last_rtc_update = xtime.tv_sec;
else
/* do it again in 60s */
@@ -144,8 +144,33 @@ void handle_timer_tick(struct pt_regs *regs)
}
}
+#ifdef CONFIG_PM
+int timer_suspend(struct sys_device *dev, pm_message_t state)
+{
+ struct sys_timer *sys_timer = container_of(dev, struct sys_timer, dev);
+
+ sys_timer->ops->stop();
+
+ return 0;
+}
+
+int timer_resume(struct sys_device *dev)
+{
+ struct sys_timer *sys_timer = container_of(dev, struct sys_timer, dev);
+
+ sys_timer->ops->start();
+
+ return 0;
+}
+#else
+#define timer_suspend NULL
+#define timer_resume NULL
+#endif
+
static struct sysdev_class timer_sysclass = {
set_kset_name("timer"),
+ .suspend = timer_suspend,
+ .resume = timer_resume,
};
static int __init timer_init_sysfs(void)
@@ -169,8 +194,8 @@ void __init time_init(void)
clk_init();
- if (rtc_get_time) {
- rtc_get_time(&xtime);
+ if (rtc_sh_get_time) {
+ rtc_sh_get_time(&xtime);
} else {
xtime.tv_sec = mktime(2000, 1, 1, 0, 0, 0);
xtime.tv_nsec = 0;