clockevents/drivers/efm32: Migrate to new 'set-state' interface
Migrate efm32 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. There is nothing to be done for resume state and so isn't implemented. Cc: Uwe Kleine-König <kernel@pengutronix.de> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
This commit is contained in:
parent
d96f4412bc
commit
20bf54f117
@ -48,40 +48,42 @@ struct efm32_clock_event_ddata {
|
|||||||
unsigned periodic_top;
|
unsigned periodic_top;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void efm32_clock_event_set_mode(enum clock_event_mode mode,
|
static int efm32_clock_event_shutdown(struct clock_event_device *evtdev)
|
||||||
struct clock_event_device *evtdev)
|
|
||||||
{
|
{
|
||||||
struct efm32_clock_event_ddata *ddata =
|
struct efm32_clock_event_ddata *ddata =
|
||||||
container_of(evtdev, struct efm32_clock_event_ddata, evtdev);
|
container_of(evtdev, struct efm32_clock_event_ddata, evtdev);
|
||||||
|
|
||||||
switch (mode) {
|
writel_relaxed(TIMERn_CMD_STOP, ddata->base + TIMERn_CMD);
|
||||||
case CLOCK_EVT_MODE_PERIODIC:
|
return 0;
|
||||||
writel_relaxed(TIMERn_CMD_STOP, ddata->base + TIMERn_CMD);
|
}
|
||||||
writel_relaxed(ddata->periodic_top, ddata->base + TIMERn_TOP);
|
|
||||||
writel_relaxed(TIMERn_CTRL_PRESC_1024 |
|
|
||||||
TIMERn_CTRL_CLKSEL_PRESCHFPERCLK |
|
|
||||||
TIMERn_CTRL_MODE_DOWN,
|
|
||||||
ddata->base + TIMERn_CTRL);
|
|
||||||
writel_relaxed(TIMERn_CMD_START, ddata->base + TIMERn_CMD);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CLOCK_EVT_MODE_ONESHOT:
|
static int efm32_clock_event_set_oneshot(struct clock_event_device *evtdev)
|
||||||
writel_relaxed(TIMERn_CMD_STOP, ddata->base + TIMERn_CMD);
|
{
|
||||||
writel_relaxed(TIMERn_CTRL_PRESC_1024 |
|
struct efm32_clock_event_ddata *ddata =
|
||||||
TIMERn_CTRL_CLKSEL_PRESCHFPERCLK |
|
container_of(evtdev, struct efm32_clock_event_ddata, evtdev);
|
||||||
TIMERn_CTRL_OSMEN |
|
|
||||||
TIMERn_CTRL_MODE_DOWN,
|
|
||||||
ddata->base + TIMERn_CTRL);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CLOCK_EVT_MODE_UNUSED:
|
writel_relaxed(TIMERn_CMD_STOP, ddata->base + TIMERn_CMD);
|
||||||
case CLOCK_EVT_MODE_SHUTDOWN:
|
writel_relaxed(TIMERn_CTRL_PRESC_1024 |
|
||||||
writel_relaxed(TIMERn_CMD_STOP, ddata->base + TIMERn_CMD);
|
TIMERn_CTRL_CLKSEL_PRESCHFPERCLK |
|
||||||
break;
|
TIMERn_CTRL_OSMEN |
|
||||||
|
TIMERn_CTRL_MODE_DOWN,
|
||||||
|
ddata->base + TIMERn_CTRL);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
case CLOCK_EVT_MODE_RESUME:
|
static int efm32_clock_event_set_periodic(struct clock_event_device *evtdev)
|
||||||
break;
|
{
|
||||||
}
|
struct efm32_clock_event_ddata *ddata =
|
||||||
|
container_of(evtdev, struct efm32_clock_event_ddata, evtdev);
|
||||||
|
|
||||||
|
writel_relaxed(TIMERn_CMD_STOP, ddata->base + TIMERn_CMD);
|
||||||
|
writel_relaxed(ddata->periodic_top, ddata->base + TIMERn_TOP);
|
||||||
|
writel_relaxed(TIMERn_CTRL_PRESC_1024 |
|
||||||
|
TIMERn_CTRL_CLKSEL_PRESCHFPERCLK |
|
||||||
|
TIMERn_CTRL_MODE_DOWN,
|
||||||
|
ddata->base + TIMERn_CTRL);
|
||||||
|
writel_relaxed(TIMERn_CMD_START, ddata->base + TIMERn_CMD);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int efm32_clock_event_set_next_event(unsigned long evt,
|
static int efm32_clock_event_set_next_event(unsigned long evt,
|
||||||
@ -112,7 +114,9 @@ static struct efm32_clock_event_ddata clock_event_ddata = {
|
|||||||
.evtdev = {
|
.evtdev = {
|
||||||
.name = "efm32 clockevent",
|
.name = "efm32 clockevent",
|
||||||
.features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC,
|
.features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC,
|
||||||
.set_mode = efm32_clock_event_set_mode,
|
.set_state_shutdown = efm32_clock_event_shutdown,
|
||||||
|
.set_state_periodic = efm32_clock_event_set_periodic,
|
||||||
|
.set_state_oneshot = efm32_clock_event_set_oneshot,
|
||||||
.set_next_event = efm32_clock_event_set_next_event,
|
.set_next_event = efm32_clock_event_set_next_event,
|
||||||
.rating = 200,
|
.rating = 200,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user