提交 73766340 编写于 作者: V Viresh Kumar 提交者: Daniel Lezcano

clockevents/drivers/fsl_ftm: Migrate to new 'set-state' interface

Migrate fsl_ftm 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: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: NDaniel Lezcano <daniel.lezcano@linaro.org>
上级 226be92b
...@@ -153,19 +153,16 @@ static int ftm_set_next_event(unsigned long delta, ...@@ -153,19 +153,16 @@ static int ftm_set_next_event(unsigned long delta,
return 0; return 0;
} }
static void ftm_set_mode(enum clock_event_mode mode, static int ftm_set_oneshot(struct clock_event_device *evt)
struct clock_event_device *evt)
{ {
switch (mode) { ftm_counter_disable(priv->clkevt_base);
case CLOCK_EVT_MODE_PERIODIC: return 0;
ftm_set_next_event(priv->periodic_cyc, evt); }
break;
case CLOCK_EVT_MODE_ONESHOT: static int ftm_set_periodic(struct clock_event_device *evt)
ftm_counter_disable(priv->clkevt_base); {
break; ftm_set_next_event(priv->periodic_cyc, evt);
default: return 0;
return;
}
} }
static irqreturn_t ftm_evt_interrupt(int irq, void *dev_id) static irqreturn_t ftm_evt_interrupt(int irq, void *dev_id)
...@@ -174,7 +171,7 @@ static irqreturn_t ftm_evt_interrupt(int irq, void *dev_id) ...@@ -174,7 +171,7 @@ static irqreturn_t ftm_evt_interrupt(int irq, void *dev_id)
ftm_irq_acknowledge(priv->clkevt_base); ftm_irq_acknowledge(priv->clkevt_base);
if (likely(evt->mode == CLOCK_EVT_MODE_ONESHOT)) { if (likely(clockevent_state_oneshot(evt))) {
ftm_irq_disable(priv->clkevt_base); ftm_irq_disable(priv->clkevt_base);
ftm_counter_disable(priv->clkevt_base); ftm_counter_disable(priv->clkevt_base);
} }
...@@ -185,11 +182,13 @@ static irqreturn_t ftm_evt_interrupt(int irq, void *dev_id) ...@@ -185,11 +182,13 @@ static irqreturn_t ftm_evt_interrupt(int irq, void *dev_id)
} }
static struct clock_event_device ftm_clockevent = { static struct clock_event_device ftm_clockevent = {
.name = "Freescale ftm timer", .name = "Freescale ftm timer",
.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, .features = CLOCK_EVT_FEAT_PERIODIC |
.set_mode = ftm_set_mode, CLOCK_EVT_FEAT_ONESHOT,
.set_next_event = ftm_set_next_event, .set_state_periodic = ftm_set_periodic,
.rating = 300, .set_state_oneshot = ftm_set_oneshot,
.set_next_event = ftm_set_next_event,
.rating = 300,
}; };
static struct irqaction ftm_timer_irq = { static struct irqaction ftm_timer_irq = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册