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

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

Migrate prima2 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: Barry Song <baohua@kernel.org>
Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: NDaniel Lezcano <daniel.lezcano@linaro.org>
上级 634eb0ec
...@@ -104,26 +104,21 @@ static int sirfsoc_timer_set_next_event(unsigned long delta, ...@@ -104,26 +104,21 @@ static int sirfsoc_timer_set_next_event(unsigned long delta,
return next - now > delta ? -ETIME : 0; return next - now > delta ? -ETIME : 0;
} }
static void sirfsoc_timer_set_mode(enum clock_event_mode mode, static int sirfsoc_timer_shutdown(struct clock_event_device *evt)
struct clock_event_device *ce)
{ {
u32 val = readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN); u32 val = readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
switch (mode) {
case CLOCK_EVT_MODE_PERIODIC: writel_relaxed(val & ~BIT(0),
WARN_ON(1); sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
break; return 0;
case CLOCK_EVT_MODE_ONESHOT: }
writel_relaxed(val | BIT(0),
sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN); static int sirfsoc_timer_set_oneshot(struct clock_event_device *evt)
break; {
case CLOCK_EVT_MODE_SHUTDOWN: u32 val = readl_relaxed(sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
writel_relaxed(val & ~BIT(0),
sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN); writel_relaxed(val | BIT(0), sirfsoc_timer_base + SIRFSOC_TIMER_INT_EN);
break; return 0;
case CLOCK_EVT_MODE_UNUSED:
case CLOCK_EVT_MODE_RESUME:
break;
}
} }
static void sirfsoc_clocksource_suspend(struct clocksource *cs) static void sirfsoc_clocksource_suspend(struct clocksource *cs)
...@@ -157,7 +152,8 @@ static struct clock_event_device sirfsoc_clockevent = { ...@@ -157,7 +152,8 @@ static struct clock_event_device sirfsoc_clockevent = {
.name = "sirfsoc_clockevent", .name = "sirfsoc_clockevent",
.rating = 200, .rating = 200,
.features = CLOCK_EVT_FEAT_ONESHOT, .features = CLOCK_EVT_FEAT_ONESHOT,
.set_mode = sirfsoc_timer_set_mode, .set_state_shutdown = sirfsoc_timer_shutdown,
.set_state_oneshot = sirfsoc_timer_set_oneshot,
.set_next_event = sirfsoc_timer_set_next_event, .set_next_event = sirfsoc_timer_set_next_event,
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册