ARM/omap2/timer: Migrate to new 'set-state' interface
Migrate omap2 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. Acked-by: Santosh Shilimkar <ssantosh@kernel.org> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
This commit is contained in:
parent
69ec063f60
commit
74364615a6
|
@ -102,38 +102,38 @@ static int omap2_gp_timer_set_next_event(unsigned long cycles,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void omap2_gp_timer_set_mode(enum clock_event_mode mode,
|
static int omap2_gp_timer_shutdown(struct clock_event_device *evt)
|
||||||
struct clock_event_device *evt)
|
{
|
||||||
|
__omap_dm_timer_stop(&clkev, OMAP_TIMER_POSTED, clkev.rate);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int omap2_gp_timer_set_periodic(struct clock_event_device *evt)
|
||||||
{
|
{
|
||||||
u32 period;
|
u32 period;
|
||||||
|
|
||||||
__omap_dm_timer_stop(&clkev, OMAP_TIMER_POSTED, clkev.rate);
|
__omap_dm_timer_stop(&clkev, OMAP_TIMER_POSTED, clkev.rate);
|
||||||
|
|
||||||
switch (mode) {
|
period = clkev.rate / HZ;
|
||||||
case CLOCK_EVT_MODE_PERIODIC:
|
period -= 1;
|
||||||
period = clkev.rate / HZ;
|
/* Looks like we need to first set the load value separately */
|
||||||
period -= 1;
|
__omap_dm_timer_write(&clkev, OMAP_TIMER_LOAD_REG, 0xffffffff - period,
|
||||||
/* Looks like we need to first set the load value separately */
|
OMAP_TIMER_POSTED);
|
||||||
__omap_dm_timer_write(&clkev, OMAP_TIMER_LOAD_REG,
|
__omap_dm_timer_load_start(&clkev,
|
||||||
0xffffffff - period, OMAP_TIMER_POSTED);
|
OMAP_TIMER_CTRL_AR | OMAP_TIMER_CTRL_ST,
|
||||||
__omap_dm_timer_load_start(&clkev,
|
0xffffffff - period, OMAP_TIMER_POSTED);
|
||||||
OMAP_TIMER_CTRL_AR | OMAP_TIMER_CTRL_ST,
|
return 0;
|
||||||
0xffffffff - period, OMAP_TIMER_POSTED);
|
|
||||||
break;
|
|
||||||
case CLOCK_EVT_MODE_ONESHOT:
|
|
||||||
break;
|
|
||||||
case CLOCK_EVT_MODE_UNUSED:
|
|
||||||
case CLOCK_EVT_MODE_SHUTDOWN:
|
|
||||||
case CLOCK_EVT_MODE_RESUME:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct clock_event_device clockevent_gpt = {
|
static struct clock_event_device clockevent_gpt = {
|
||||||
.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
|
.features = CLOCK_EVT_FEAT_PERIODIC |
|
||||||
.rating = 300,
|
CLOCK_EVT_FEAT_ONESHOT,
|
||||||
.set_next_event = omap2_gp_timer_set_next_event,
|
.rating = 300,
|
||||||
.set_mode = omap2_gp_timer_set_mode,
|
.set_next_event = omap2_gp_timer_set_next_event,
|
||||||
|
.set_state_shutdown = omap2_gp_timer_shutdown,
|
||||||
|
.set_state_periodic = omap2_gp_timer_set_periodic,
|
||||||
|
.set_state_oneshot = omap2_gp_timer_shutdown,
|
||||||
|
.tick_resume = omap2_gp_timer_shutdown,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct property device_disabled = {
|
static struct property device_disabled = {
|
||||||
|
|
Loading…
Reference in New Issue