Commit f0753793 authored by Viresh Kumar's avatar Viresh Kumar Committed by Daniel Lezcano

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

Migrate zevio 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: Daniel Tang <dt.tangr@gmail.com>
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
parent 214bc755
...@@ -76,32 +76,28 @@ static int zevio_timer_set_event(unsigned long delta, ...@@ -76,32 +76,28 @@ static int zevio_timer_set_event(unsigned long delta,
return 0; return 0;
} }
static void zevio_timer_set_mode(enum clock_event_mode mode, static int zevio_timer_shutdown(struct clock_event_device *dev)
struct clock_event_device *dev)
{ {
struct zevio_timer *timer = container_of(dev, struct zevio_timer, struct zevio_timer *timer = container_of(dev, struct zevio_timer,
clkevt); clkevt);
switch (mode) { /* Disable timer interrupts */
case CLOCK_EVT_MODE_RESUME: writel(0, timer->interrupt_regs + IO_INTR_MSK);
case CLOCK_EVT_MODE_ONESHOT: writel(TIMER_INTR_ALL, timer->interrupt_regs + IO_INTR_ACK);
/* Enable timer interrupts */ /* Stop timer */
writel(TIMER_INTR_MSK, timer->interrupt_regs + IO_INTR_MSK); writel(CNTL_STOP_TIMER, timer->timer1 + IO_CONTROL);
writel(TIMER_INTR_ALL, timer->interrupt_regs + IO_INTR_ACK); return 0;
break; }
case CLOCK_EVT_MODE_SHUTDOWN:
case CLOCK_EVT_MODE_UNUSED: static int zevio_timer_set_oneshot(struct clock_event_device *dev)
/* Disable timer interrupts */ {
writel(0, timer->interrupt_regs + IO_INTR_MSK); struct zevio_timer *timer = container_of(dev, struct zevio_timer,
writel(TIMER_INTR_ALL, timer->interrupt_regs + IO_INTR_ACK); clkevt);
/* Stop timer */
writel(CNTL_STOP_TIMER, timer->timer1 + IO_CONTROL); /* Enable timer interrupts */
break; writel(TIMER_INTR_MSK, timer->interrupt_regs + IO_INTR_MSK);
case CLOCK_EVT_MODE_PERIODIC: writel(TIMER_INTR_ALL, timer->interrupt_regs + IO_INTR_ACK);
default: return 0;
/* Unsupported */
break;
}
} }
static irqreturn_t zevio_timer_interrupt(int irq, void *dev_id) static irqreturn_t zevio_timer_interrupt(int irq, void *dev_id)
...@@ -162,7 +158,9 @@ static int __init zevio_timer_add(struct device_node *node) ...@@ -162,7 +158,9 @@ static int __init zevio_timer_add(struct device_node *node)
if (timer->interrupt_regs && irqnr) { if (timer->interrupt_regs && irqnr) {
timer->clkevt.name = timer->clockevent_name; timer->clkevt.name = timer->clockevent_name;
timer->clkevt.set_next_event = zevio_timer_set_event; timer->clkevt.set_next_event = zevio_timer_set_event;
timer->clkevt.set_mode = zevio_timer_set_mode; timer->clkevt.set_state_shutdown = zevio_timer_shutdown;
timer->clkevt.set_state_oneshot = zevio_timer_set_oneshot;
timer->clkevt.tick_resume = zevio_timer_set_oneshot;
timer->clkevt.rating = 200; timer->clkevt.rating = 200;
timer->clkevt.cpumask = cpu_all_mask; timer->clkevt.cpumask = cpu_all_mask;
timer->clkevt.features = CLOCK_EVT_FEAT_ONESHOT; timer->clkevt.features = CLOCK_EVT_FEAT_ONESHOT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment