diff options
| author | Tony Breeds <tony@bakeyournoodle.com> | 2007-09-20 23:26:02 -0400 |
|---|---|---|
| committer | Paul Mackerras <paulus@samba.org> | 2007-10-02 21:48:42 -0400 |
| commit | aa3be5f32db137bc4404f32a24b36fb47d48d260 (patch) | |
| tree | c1478636bf2025cf9e700c48239418836cb43fbd /arch/powerpc/sysdev | |
| parent | df174e3be88d4352bfcfe20d11adc671d2961c79 (diff) | |
[POWERPC] Implement {read,update}_persistent_clock
With these functions implemented we cooperate better with the generic
timekeeping code. This obsoletes the need for the timer sysdev as a bonus.
Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/sysdev')
| -rw-r--r-- | arch/powerpc/sysdev/Makefile | 5 | ||||
| -rw-r--r-- | arch/powerpc/sysdev/timer.c | 81 |
2 files changed, 0 insertions, 86 deletions
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile index ed41dc0a310f..b0ea8e9495e8 100644 --- a/arch/powerpc/sysdev/Makefile +++ b/arch/powerpc/sysdev/Makefile | |||
| @@ -21,11 +21,6 @@ obj-$(CONFIG_MV64X60) += $(mv64x60-y) mv64x60_pic.o mv64x60_dev.o \ | |||
| 21 | obj-$(CONFIG_RTC_DRV_CMOS) += rtc_cmos_setup.o | 21 | obj-$(CONFIG_RTC_DRV_CMOS) += rtc_cmos_setup.o |
| 22 | obj-$(CONFIG_AXON_RAM) += axonram.o | 22 | obj-$(CONFIG_AXON_RAM) += axonram.o |
| 23 | 23 | ||
| 24 | # contains only the suspend handler for time | ||
| 25 | ifeq ($(CONFIG_RTC_CLASS),) | ||
| 26 | obj-$(CONFIG_PM) += timer.o | ||
| 27 | endif | ||
| 28 | |||
| 29 | ifeq ($(CONFIG_PPC_MERGE),y) | 24 | ifeq ($(CONFIG_PPC_MERGE),y) |
| 30 | obj-$(CONFIG_PPC_INDIRECT_PCI) += indirect_pci.o | 25 | obj-$(CONFIG_PPC_INDIRECT_PCI) += indirect_pci.o |
| 31 | obj-$(CONFIG_PPC_I8259) += i8259.o | 26 | obj-$(CONFIG_PPC_I8259) += i8259.o |
diff --git a/arch/powerpc/sysdev/timer.c b/arch/powerpc/sysdev/timer.c deleted file mode 100644 index e81e7ec2e799..000000000000 --- a/arch/powerpc/sysdev/timer.c +++ /dev/null | |||
| @@ -1,81 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Common code to keep time when machine suspends. | ||
| 3 | * | ||
| 4 | * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> | ||
| 5 | * | ||
| 6 | * GPLv2 | ||
| 7 | */ | ||
| 8 | |||
| 9 | #include <linux/time.h> | ||
| 10 | #include <linux/sysdev.h> | ||
| 11 | #include <asm/rtc.h> | ||
| 12 | |||
| 13 | static unsigned long suspend_rtc_time; | ||
| 14 | |||
| 15 | /* | ||
| 16 | * Reset the time after a sleep. | ||
| 17 | */ | ||
| 18 | static int timer_resume(struct sys_device *dev) | ||
| 19 | { | ||
| 20 | struct timeval tv; | ||
| 21 | struct timespec ts; | ||
| 22 | struct rtc_time cur_rtc_tm; | ||
| 23 | unsigned long cur_rtc_time, diff; | ||
| 24 | |||
| 25 | /* get current RTC time and convert to seconds */ | ||
| 26 | get_rtc_time(&cur_rtc_tm); | ||
| 27 | cur_rtc_time = mktime(cur_rtc_tm.tm_year + 1900, | ||
| 28 | cur_rtc_tm.tm_mon + 1, | ||
| 29 | cur_rtc_tm.tm_mday, | ||
| 30 | cur_rtc_tm.tm_hour, | ||
| 31 | cur_rtc_tm.tm_min, | ||
| 32 | cur_rtc_tm.tm_sec); | ||
| 33 | |||
| 34 | diff = cur_rtc_time - suspend_rtc_time; | ||
| 35 | |||
| 36 | /* adjust time of day by seconds that elapsed while | ||
| 37 | * we were suspended */ | ||
| 38 | do_gettimeofday(&tv); | ||
| 39 | ts.tv_sec = tv.tv_sec + diff; | ||
| 40 | ts.tv_nsec = tv.tv_usec * NSEC_PER_USEC; | ||
| 41 | do_settimeofday(&ts); | ||
| 42 | |||
| 43 | return 0; | ||
| 44 | } | ||
| 45 | |||
| 46 | static int timer_suspend(struct sys_device *dev, pm_message_t state) | ||
| 47 | { | ||
| 48 | struct rtc_time suspend_rtc_tm; | ||
| 49 | WARN_ON(!ppc_md.get_rtc_time); | ||
| 50 | |||
| 51 | get_rtc_time(&suspend_rtc_tm); | ||
| 52 | suspend_rtc_time = mktime(suspend_rtc_tm.tm_year + 1900, | ||
| 53 | suspend_rtc_tm.tm_mon + 1, | ||
| 54 | suspend_rtc_tm.tm_mday, | ||
| 55 | suspend_rtc_tm.tm_hour, | ||
| 56 | suspend_rtc_tm.tm_min, | ||
| 57 | suspend_rtc_tm.tm_sec); | ||
| 58 | |||
| 59 | return 0; | ||
| 60 | } | ||
| 61 | |||
| 62 | static struct sysdev_class timer_sysclass = { | ||
| 63 | .resume = timer_resume, | ||
| 64 | .suspend = timer_suspend, | ||
| 65 | set_kset_name("timer"), | ||
| 66 | }; | ||
| 67 | |||
| 68 | static struct sys_device device_timer = { | ||
| 69 | .id = 0, | ||
| 70 | .cls = &timer_sysclass, | ||
| 71 | }; | ||
| 72 | |||
| 73 | static int time_init_device(void) | ||
| 74 | { | ||
| 75 | int error = sysdev_class_register(&timer_sysclass); | ||
| 76 | if (!error) | ||
| 77 | error = sysdev_register(&device_timer); | ||
| 78 | return error; | ||
| 79 | } | ||
| 80 | |||
| 81 | device_initcall(time_init_device); | ||
