aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clocksource/vf_pit_timer.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2015-06-18 06:54:53 -0400
committerDaniel Lezcano <daniel.lezcano@linaro.org>2015-08-10 05:40:50 -0400
commit9552a6af8c807ab547c053399b40bd05781fa0a8 (patch)
treedb03ba564afd9078b21e067c52eee0faeb1e25db /drivers/clocksource/vf_pit_timer.c
parent8ff8fc13bdd4f1474720669042fccfbf304638f1 (diff)
clockevents/drivers/vf_pit: Migrate to new 'set-state' interface
Migrate vf_pit 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. Cc: Jingchang Lu <b35083@freescale.com> Cc: Stefan Agner <stefan@agner.ch> Cc: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by: Stefan Agner <stefan@agner.ch>
Diffstat (limited to 'drivers/clocksource/vf_pit_timer.c')
-rw-r--r--drivers/clocksource/vf_pit_timer.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/drivers/clocksource/vf_pit_timer.c b/drivers/clocksource/vf_pit_timer.c
index b45ac6229b57..f07ba9932171 100644
--- a/drivers/clocksource/vf_pit_timer.c
+++ b/drivers/clocksource/vf_pit_timer.c
@@ -86,20 +86,16 @@ static int pit_set_next_event(unsigned long delta,
86 return 0; 86 return 0;
87} 87}
88 88
89static void pit_set_mode(enum clock_event_mode mode, 89static int pit_shutdown(struct clock_event_device *evt)
90 struct clock_event_device *evt)
91{ 90{
92 switch (mode) { 91 pit_timer_disable();
93 case CLOCK_EVT_MODE_PERIODIC: 92 return 0;
94 pit_set_next_event(cycle_per_jiffy, evt); 93}
95 break; 94
96 case CLOCK_EVT_MODE_SHUTDOWN: 95static int pit_set_periodic(struct clock_event_device *evt)
97 case CLOCK_EVT_MODE_UNUSED: 96{
98 pit_timer_disable(); 97 pit_set_next_event(cycle_per_jiffy, evt);
99 break; 98 return 0;
100 default:
101 break;
102 }
103} 99}
104 100
105static irqreturn_t pit_timer_interrupt(int irq, void *dev_id) 101static irqreturn_t pit_timer_interrupt(int irq, void *dev_id)
@@ -114,7 +110,7 @@ static irqreturn_t pit_timer_interrupt(int irq, void *dev_id)
114 * and start the counter again. So software need to disable the timer 110 * and start the counter again. So software need to disable the timer
115 * to stop the counter loop in ONESHOT mode. 111 * to stop the counter loop in ONESHOT mode.
116 */ 112 */
117 if (likely(evt->mode == CLOCK_EVT_MODE_ONESHOT)) 113 if (likely(clockevent_state_oneshot(evt)))
118 pit_timer_disable(); 114 pit_timer_disable();
119 115
120 evt->event_handler(evt); 116 evt->event_handler(evt);
@@ -125,7 +121,8 @@ static irqreturn_t pit_timer_interrupt(int irq, void *dev_id)
125static struct clock_event_device clockevent_pit = { 121static struct clock_event_device clockevent_pit = {
126 .name = "VF pit timer", 122 .name = "VF pit timer",
127 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 123 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
128 .set_mode = pit_set_mode, 124 .set_state_shutdown = pit_shutdown,
125 .set_state_periodic = pit_set_periodic,
129 .set_next_event = pit_set_next_event, 126 .set_next_event = pit_set_next_event,
130 .rating = 300, 127 .rating = 300,
131}; 128};