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>
This commit is contained in:
parent
8ff8fc13bd
commit
9552a6af8c
@ -86,20 +86,16 @@ static int pit_set_next_event(unsigned long delta,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pit_set_mode(enum clock_event_mode mode,
|
static int pit_shutdown(struct clock_event_device *evt)
|
||||||
struct clock_event_device *evt)
|
|
||||||
{
|
{
|
||||||
switch (mode) {
|
pit_timer_disable();
|
||||||
case CLOCK_EVT_MODE_PERIODIC:
|
return 0;
|
||||||
pit_set_next_event(cycle_per_jiffy, evt);
|
}
|
||||||
break;
|
|
||||||
case CLOCK_EVT_MODE_SHUTDOWN:
|
static int pit_set_periodic(struct clock_event_device *evt)
|
||||||
case CLOCK_EVT_MODE_UNUSED:
|
{
|
||||||
pit_timer_disable();
|
pit_set_next_event(cycle_per_jiffy, evt);
|
||||||
break;
|
return 0;
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static irqreturn_t pit_timer_interrupt(int irq, void *dev_id)
|
static 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)
|
|||||||
* and start the counter again. So software need to disable the timer
|
* and start the counter again. So software need to disable the timer
|
||||||
* to stop the counter loop in ONESHOT mode.
|
* to stop the counter loop in ONESHOT mode.
|
||||||
*/
|
*/
|
||||||
if (likely(evt->mode == CLOCK_EVT_MODE_ONESHOT))
|
if (likely(clockevent_state_oneshot(evt)))
|
||||||
pit_timer_disable();
|
pit_timer_disable();
|
||||||
|
|
||||||
evt->event_handler(evt);
|
evt->event_handler(evt);
|
||||||
@ -125,7 +121,8 @@ static irqreturn_t pit_timer_interrupt(int irq, void *dev_id)
|
|||||||
static struct clock_event_device clockevent_pit = {
|
static struct clock_event_device clockevent_pit = {
|
||||||
.name = "VF pit timer",
|
.name = "VF pit timer",
|
||||||
.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
|
.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
|
||||||
.set_mode = pit_set_mode,
|
.set_state_shutdown = pit_shutdown,
|
||||||
|
.set_state_periodic = pit_set_periodic,
|
||||||
.set_next_event = pit_set_next_event,
|
.set_next_event = pit_set_next_event,
|
||||||
.rating = 300,
|
.rating = 300,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user