unicore/time: Migrate to new 'set-state' interface
Migrate unicore 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 for PERIODIC or RESUME modes and so their callbacks aren't implemented. Cc: Guan Xuetao <gxt@mprc.pku.edu.cn> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
This commit is contained in:
parent
71b5280b79
commit
3078c8df2c
|
@ -46,21 +46,11 @@ puv3_osmr0_set_next_event(unsigned long delta, struct clock_event_device *c)
|
||||||
return (signed)(next - oscr) <= MIN_OSCR_DELTA ? -ETIME : 0;
|
return (signed)(next - oscr) <= MIN_OSCR_DELTA ? -ETIME : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int puv3_osmr0_shutdown(struct clock_event_device *evt)
|
||||||
puv3_osmr0_set_mode(enum clock_event_mode mode, struct clock_event_device *c)
|
|
||||||
{
|
{
|
||||||
switch (mode) {
|
|
||||||
case CLOCK_EVT_MODE_ONESHOT:
|
|
||||||
case CLOCK_EVT_MODE_UNUSED:
|
|
||||||
case CLOCK_EVT_MODE_SHUTDOWN:
|
|
||||||
writel(readl(OST_OIER) & ~OST_OIER_E0, OST_OIER);
|
writel(readl(OST_OIER) & ~OST_OIER_E0, OST_OIER);
|
||||||
writel(readl(OST_OSSR) & ~OST_OSSR_M0, OST_OSSR);
|
writel(readl(OST_OSSR) & ~OST_OSSR_M0, OST_OSSR);
|
||||||
break;
|
return 0;
|
||||||
|
|
||||||
case CLOCK_EVT_MODE_RESUME:
|
|
||||||
case CLOCK_EVT_MODE_PERIODIC:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct clock_event_device ckevt_puv3_osmr0 = {
|
static struct clock_event_device ckevt_puv3_osmr0 = {
|
||||||
|
@ -68,7 +58,8 @@ static struct clock_event_device ckevt_puv3_osmr0 = {
|
||||||
.features = CLOCK_EVT_FEAT_ONESHOT,
|
.features = CLOCK_EVT_FEAT_ONESHOT,
|
||||||
.rating = 200,
|
.rating = 200,
|
||||||
.set_next_event = puv3_osmr0_set_next_event,
|
.set_next_event = puv3_osmr0_set_next_event,
|
||||||
.set_mode = puv3_osmr0_set_mode,
|
.set_state_shutdown = puv3_osmr0_shutdown,
|
||||||
|
.set_state_oneshot = puv3_osmr0_shutdown,
|
||||||
};
|
};
|
||||||
|
|
||||||
static cycle_t puv3_read_oscr(struct clocksource *cs)
|
static cycle_t puv3_read_oscr(struct clocksource *cs)
|
||||||
|
|
Loading…
Reference in New Issue