Commit a785fb39 authored by Viresh Kumar's avatar Viresh Kumar

ARM/mmp/time: Migrate to new 'set-state' interface

Migrate mmp 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.

We weren't doing anything in set_mode(RESUME) except of
local_irq_{save|restore}(), which isn't required and so ->tick_resume
isn't implemented.

Cc: Eric Miao <eric.y.miao@gmail.com>
Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
parent 9325a3a8
...@@ -124,32 +124,25 @@ static int timer_set_next_event(unsigned long delta, ...@@ -124,32 +124,25 @@ static int timer_set_next_event(unsigned long delta,
return 0; return 0;
} }
static void timer_set_mode(enum clock_event_mode mode, static int timer_set_shutdown(struct clock_event_device *evt)
struct clock_event_device *dev)
{ {
unsigned long flags; unsigned long flags;
local_irq_save(flags); local_irq_save(flags);
switch (mode) { /* disable the matching interrupt */
case CLOCK_EVT_MODE_ONESHOT: __raw_writel(0x00, mmp_timer_base + TMR_IER(0));
case CLOCK_EVT_MODE_UNUSED:
case CLOCK_EVT_MODE_SHUTDOWN:
/* disable the matching interrupt */
__raw_writel(0x00, mmp_timer_base + TMR_IER(0));
break;
case CLOCK_EVT_MODE_RESUME:
case CLOCK_EVT_MODE_PERIODIC:
break;
}
local_irq_restore(flags); local_irq_restore(flags);
return 0;
} }
static struct clock_event_device ckevt = { static struct clock_event_device ckevt = {
.name = "clockevent", .name = "clockevent",
.features = CLOCK_EVT_FEAT_ONESHOT, .features = CLOCK_EVT_FEAT_ONESHOT,
.rating = 200, .rating = 200,
.set_next_event = timer_set_next_event, .set_next_event = timer_set_next_event,
.set_mode = timer_set_mode, .set_state_shutdown = timer_set_shutdown,
.set_state_oneshot = timer_set_shutdown,
}; };
static cycle_t clksrc_read(struct clocksource *cs) static cycle_t clksrc_read(struct clocksource *cs)
......
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