diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2015-06-18 06:54:32 -0400 |
---|---|---|
committer | Daniel Lezcano <daniel.lezcano@linaro.org> | 2015-08-10 05:40:36 -0400 |
commit | 99b3fa72efc545a7e21955c17f6a2f6f87dfacde (patch) | |
tree | 9f1c0b70215e92e30de95305b444ab8e352d04b7 | |
parent | 736b2df2abc1f128ce381e9f2e578502cabc2973 (diff) |
clockevents/drivers/rockchip: Migrate to new 'set-state' interface
Migrate rockchip 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.
We weren't doing anything for oneshot or resume modes, and so the
callbacks aren't provided.
Cc: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
-rw-r--r-- | drivers/clocksource/rockchip_timer.c | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/drivers/clocksource/rockchip_timer.c b/drivers/clocksource/rockchip_timer.c index a35993bafb20..bb2c2b050964 100644 --- a/drivers/clocksource/rockchip_timer.c +++ b/drivers/clocksource/rockchip_timer.c | |||
@@ -82,23 +82,18 @@ static inline int rk_timer_set_next_event(unsigned long cycles, | |||
82 | return 0; | 82 | return 0; |
83 | } | 83 | } |
84 | 84 | ||
85 | static inline void rk_timer_set_mode(enum clock_event_mode mode, | 85 | static int rk_timer_shutdown(struct clock_event_device *ce) |
86 | struct clock_event_device *ce) | ||
87 | { | 86 | { |
88 | switch (mode) { | 87 | rk_timer_disable(ce); |
89 | case CLOCK_EVT_MODE_PERIODIC: | 88 | return 0; |
90 | rk_timer_disable(ce); | 89 | } |
91 | rk_timer_update_counter(rk_timer(ce)->freq / HZ - 1, ce); | 90 | |
92 | rk_timer_enable(ce, TIMER_MODE_FREE_RUNNING); | 91 | static int rk_timer_set_periodic(struct clock_event_device *ce) |
93 | break; | 92 | { |
94 | case CLOCK_EVT_MODE_ONESHOT: | 93 | rk_timer_disable(ce); |
95 | case CLOCK_EVT_MODE_RESUME: | 94 | rk_timer_update_counter(rk_timer(ce)->freq / HZ - 1, ce); |
96 | break; | 95 | rk_timer_enable(ce, TIMER_MODE_FREE_RUNNING); |
97 | case CLOCK_EVT_MODE_UNUSED: | 96 | return 0; |
98 | case CLOCK_EVT_MODE_SHUTDOWN: | ||
99 | rk_timer_disable(ce); | ||
100 | break; | ||
101 | } | ||
102 | } | 97 | } |
103 | 98 | ||
104 | static irqreturn_t rk_timer_interrupt(int irq, void *dev_id) | 99 | static irqreturn_t rk_timer_interrupt(int irq, void *dev_id) |
@@ -107,7 +102,7 @@ static irqreturn_t rk_timer_interrupt(int irq, void *dev_id) | |||
107 | 102 | ||
108 | rk_timer_interrupt_clear(ce); | 103 | rk_timer_interrupt_clear(ce); |
109 | 104 | ||
110 | if (ce->mode == CLOCK_EVT_MODE_ONESHOT) | 105 | if (clockevent_state_oneshot(ce)) |
111 | rk_timer_disable(ce); | 106 | rk_timer_disable(ce); |
112 | 107 | ||
113 | ce->event_handler(ce); | 108 | ce->event_handler(ce); |
@@ -161,7 +156,8 @@ static void __init rk_timer_init(struct device_node *np) | |||
161 | ce->name = TIMER_NAME; | 156 | ce->name = TIMER_NAME; |
162 | ce->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; | 157 | ce->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; |
163 | ce->set_next_event = rk_timer_set_next_event; | 158 | ce->set_next_event = rk_timer_set_next_event; |
164 | ce->set_mode = rk_timer_set_mode; | 159 | ce->set_state_shutdown = rk_timer_shutdown; |
160 | ce->set_state_periodic = rk_timer_set_periodic; | ||
165 | ce->irq = irq; | 161 | ce->irq = irq; |
166 | ce->cpumask = cpumask_of(0); | 162 | ce->cpumask = cpumask_of(0); |
167 | ce->rating = 250; | 163 | ce->rating = 250; |