Commit 9325a3a8 authored by Viresh Kumar's avatar Viresh Kumar

ARM/lpc32xx/timer: Migrate to new 'set-state' interface

Migrate lpc32xx 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: Roland Stigge <stigge@antcom.de>
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
parent 7cfa3c69
...@@ -43,36 +43,24 @@ static int lpc32xx_clkevt_next_event(unsigned long delta, ...@@ -43,36 +43,24 @@ static int lpc32xx_clkevt_next_event(unsigned long delta,
return 0; return 0;
} }
static void lpc32xx_clkevt_mode(enum clock_event_mode mode, static int lpc32xx_shutdown(struct clock_event_device *evt)
struct clock_event_device *dev)
{ {
switch (mode) { /*
case CLOCK_EVT_MODE_PERIODIC: * Disable the timer. When using oneshot, we must also
WARN_ON(1); * disable the timer to wait for the first call to
break; * set_next_event().
*/
case CLOCK_EVT_MODE_ONESHOT: __raw_writel(0, LPC32XX_TIMER_TCR(LPC32XX_TIMER0_BASE));
case CLOCK_EVT_MODE_SHUTDOWN: return 0;
/*
* Disable the timer. When using oneshot, we must also
* disable the timer to wait for the first call to
* set_next_event().
*/
__raw_writel(0, LPC32XX_TIMER_TCR(LPC32XX_TIMER0_BASE));
break;
case CLOCK_EVT_MODE_UNUSED:
case CLOCK_EVT_MODE_RESUME:
break;
}
} }
static struct clock_event_device lpc32xx_clkevt = { static struct clock_event_device lpc32xx_clkevt = {
.name = "lpc32xx_clkevt", .name = "lpc32xx_clkevt",
.features = CLOCK_EVT_FEAT_ONESHOT, .features = CLOCK_EVT_FEAT_ONESHOT,
.rating = 300, .rating = 300,
.set_next_event = lpc32xx_clkevt_next_event, .set_next_event = lpc32xx_clkevt_next_event,
.set_mode = lpc32xx_clkevt_mode, .set_state_shutdown = lpc32xx_shutdown,
.set_state_oneshot = lpc32xx_shutdown,
}; };
static irqreturn_t lpc32xx_timer_interrupt(int irq, void *dev_id) static irqreturn_t lpc32xx_timer_interrupt(int irq, void *dev_id)
......
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