clockevents/drivers/meson6: Migrate to new 'set-state' interface
Migrate meson6 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: Carlo Caione <carlo@caione.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by: Carlo Caione <carlo@caione.org>
This commit is contained in:
parent
8eda41b086
commit
40117bd559
|
@ -67,25 +67,25 @@ static void meson6_clkevt_time_start(unsigned char timer, bool periodic)
|
||||||
writel(val | TIMER_ENABLE_BIT(timer), timer_base + TIMER_ISA_MUX);
|
writel(val | TIMER_ENABLE_BIT(timer), timer_base + TIMER_ISA_MUX);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void meson6_clkevt_mode(enum clock_event_mode mode,
|
static int meson6_shutdown(struct clock_event_device *evt)
|
||||||
struct clock_event_device *clk)
|
|
||||||
{
|
{
|
||||||
switch (mode) {
|
meson6_clkevt_time_stop(CED_ID);
|
||||||
case CLOCK_EVT_MODE_PERIODIC:
|
return 0;
|
||||||
meson6_clkevt_time_stop(CED_ID);
|
}
|
||||||
meson6_clkevt_time_setup(CED_ID, USEC_PER_SEC/HZ - 1);
|
|
||||||
meson6_clkevt_time_start(CED_ID, true);
|
static int meson6_set_oneshot(struct clock_event_device *evt)
|
||||||
break;
|
{
|
||||||
case CLOCK_EVT_MODE_ONESHOT:
|
meson6_clkevt_time_stop(CED_ID);
|
||||||
meson6_clkevt_time_stop(CED_ID);
|
meson6_clkevt_time_start(CED_ID, false);
|
||||||
meson6_clkevt_time_start(CED_ID, false);
|
return 0;
|
||||||
break;
|
}
|
||||||
case CLOCK_EVT_MODE_UNUSED:
|
|
||||||
case CLOCK_EVT_MODE_SHUTDOWN:
|
static int meson6_set_periodic(struct clock_event_device *evt)
|
||||||
default:
|
{
|
||||||
meson6_clkevt_time_stop(CED_ID);
|
meson6_clkevt_time_stop(CED_ID);
|
||||||
break;
|
meson6_clkevt_time_setup(CED_ID, USEC_PER_SEC / HZ - 1);
|
||||||
}
|
meson6_clkevt_time_start(CED_ID, true);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int meson6_clkevt_next_event(unsigned long evt,
|
static int meson6_clkevt_next_event(unsigned long evt,
|
||||||
|
@ -99,11 +99,15 @@ static int meson6_clkevt_next_event(unsigned long evt,
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct clock_event_device meson6_clockevent = {
|
static struct clock_event_device meson6_clockevent = {
|
||||||
.name = "meson6_tick",
|
.name = "meson6_tick",
|
||||||
.rating = 400,
|
.rating = 400,
|
||||||
.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
|
.features = CLOCK_EVT_FEAT_PERIODIC |
|
||||||
.set_mode = meson6_clkevt_mode,
|
CLOCK_EVT_FEAT_ONESHOT,
|
||||||
.set_next_event = meson6_clkevt_next_event,
|
.set_state_shutdown = meson6_shutdown,
|
||||||
|
.set_state_periodic = meson6_set_periodic,
|
||||||
|
.set_state_oneshot = meson6_set_oneshot,
|
||||||
|
.tick_resume = meson6_shutdown,
|
||||||
|
.set_next_event = meson6_clkevt_next_event,
|
||||||
};
|
};
|
||||||
|
|
||||||
static irqreturn_t meson6_timer_interrupt(int irq, void *dev_id)
|
static irqreturn_t meson6_timer_interrupt(int irq, void *dev_id)
|
||||||
|
|
Loading…
Reference in a new issue