diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2015-07-06 07:11:56 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2015-09-03 06:07:51 -0400 |
commit | 9f95618f9fe5fc902a3d8fecd10c98e482fab6c5 (patch) | |
tree | 6e61baf3f52cb32b94ebcfebc2b9916f24c290c1 | |
parent | 1edf907a09e1cad9032411d84679b637ab696593 (diff) |
MIPS: cevt-ds1287: Migrate to new 'set-state' interface
Migrate cevt-ds1287 driver to the new 'set-state' interface provided by
clockevents core, the earlier 'set-mode' interface is marked obsolete
now.
This also enables us to implement callbacks for new states of clockevent
devices, for example: ONESHOT_STOPPED.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: linux-mips@linux-mips.org
Cc: linaro-kernel@lists.linaro.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Patchwork: https://patchwork.linux-mips.org/patch/10603/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | arch/mips/kernel/cevt-ds1287.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/arch/mips/kernel/cevt-ds1287.c b/arch/mips/kernel/cevt-ds1287.c index ff1f01b72270..77a5ddf53f57 100644 --- a/arch/mips/kernel/cevt-ds1287.c +++ b/arch/mips/kernel/cevt-ds1287.c | |||
@@ -59,27 +59,32 @@ static int ds1287_set_next_event(unsigned long delta, | |||
59 | return -EINVAL; | 59 | return -EINVAL; |
60 | } | 60 | } |
61 | 61 | ||
62 | static void ds1287_set_mode(enum clock_event_mode mode, | 62 | static int ds1287_shutdown(struct clock_event_device *evt) |
63 | struct clock_event_device *evt) | ||
64 | { | 63 | { |
65 | u8 val; | 64 | u8 val; |
66 | 65 | ||
67 | spin_lock(&rtc_lock); | 66 | spin_lock(&rtc_lock); |
68 | 67 | ||
69 | val = CMOS_READ(RTC_REG_B); | 68 | val = CMOS_READ(RTC_REG_B); |
69 | val &= ~RTC_PIE; | ||
70 | CMOS_WRITE(val, RTC_REG_B); | ||
70 | 71 | ||
71 | switch (mode) { | 72 | spin_unlock(&rtc_lock); |
72 | case CLOCK_EVT_MODE_PERIODIC: | 73 | return 0; |
73 | val |= RTC_PIE; | 74 | } |
74 | break; | ||
75 | default: | ||
76 | val &= ~RTC_PIE; | ||
77 | break; | ||
78 | } | ||
79 | 75 | ||
76 | static int ds1287_set_periodic(struct clock_event_device *evt) | ||
77 | { | ||
78 | u8 val; | ||
79 | |||
80 | spin_lock(&rtc_lock); | ||
81 | |||
82 | val = CMOS_READ(RTC_REG_B); | ||
83 | val |= RTC_PIE; | ||
80 | CMOS_WRITE(val, RTC_REG_B); | 84 | CMOS_WRITE(val, RTC_REG_B); |
81 | 85 | ||
82 | spin_unlock(&rtc_lock); | 86 | spin_unlock(&rtc_lock); |
87 | return 0; | ||
83 | } | 88 | } |
84 | 89 | ||
85 | static void ds1287_event_handler(struct clock_event_device *dev) | 90 | static void ds1287_event_handler(struct clock_event_device *dev) |
@@ -87,11 +92,13 @@ static void ds1287_event_handler(struct clock_event_device *dev) | |||
87 | } | 92 | } |
88 | 93 | ||
89 | static struct clock_event_device ds1287_clockevent = { | 94 | static struct clock_event_device ds1287_clockevent = { |
90 | .name = "ds1287", | 95 | .name = "ds1287", |
91 | .features = CLOCK_EVT_FEAT_PERIODIC, | 96 | .features = CLOCK_EVT_FEAT_PERIODIC, |
92 | .set_next_event = ds1287_set_next_event, | 97 | .set_next_event = ds1287_set_next_event, |
93 | .set_mode = ds1287_set_mode, | 98 | .set_state_shutdown = ds1287_shutdown, |
94 | .event_handler = ds1287_event_handler, | 99 | .set_state_periodic = ds1287_set_periodic, |
100 | .tick_resume = ds1287_shutdown, | ||
101 | .event_handler = ds1287_event_handler, | ||
95 | }; | 102 | }; |
96 | 103 | ||
97 | static irqreturn_t ds1287_interrupt(int irq, void *dev_id) | 104 | static irqreturn_t ds1287_interrupt(int irq, void *dev_id) |