Commit bc660a45 authored by Viresh Kumar's avatar Viresh Kumar

ARM/davinci/time: Migrate to new 'set-state' interface

Migrate davinci 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 in set_mode(RESUME) and so .tick_resume()
isn't implemented.

Cc: Sekhar Nori <nsekhar@ti.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
parent 9bdc2e0c
...@@ -303,36 +303,42 @@ static int davinci_set_next_event(unsigned long cycles, ...@@ -303,36 +303,42 @@ static int davinci_set_next_event(unsigned long cycles,
return 0; return 0;
} }
static void davinci_set_mode(enum clock_event_mode mode, static int davinci_shutdown(struct clock_event_device *evt)
struct clock_event_device *evt)
{ {
struct timer_s *t = &timers[TID_CLOCKEVENT]; struct timer_s *t = &timers[TID_CLOCKEVENT];
switch (mode) { t->opts &= ~TIMER_OPTS_STATE_MASK;
case CLOCK_EVT_MODE_PERIODIC: t->opts |= TIMER_OPTS_DISABLED;
t->period = davinci_clock_tick_rate / (HZ); return 0;
t->opts &= ~TIMER_OPTS_STATE_MASK; }
t->opts |= TIMER_OPTS_PERIODIC;
timer32_config(t); static int davinci_set_oneshot(struct clock_event_device *evt)
break; {
case CLOCK_EVT_MODE_ONESHOT: struct timer_s *t = &timers[TID_CLOCKEVENT];
t->opts &= ~TIMER_OPTS_STATE_MASK;
t->opts |= TIMER_OPTS_ONESHOT; t->opts &= ~TIMER_OPTS_STATE_MASK;
break; t->opts |= TIMER_OPTS_ONESHOT;
case CLOCK_EVT_MODE_UNUSED: return 0;
case CLOCK_EVT_MODE_SHUTDOWN: }
t->opts &= ~TIMER_OPTS_STATE_MASK;
t->opts |= TIMER_OPTS_DISABLED; static int davinci_set_periodic(struct clock_event_device *evt)
break; {
case CLOCK_EVT_MODE_RESUME: struct timer_s *t = &timers[TID_CLOCKEVENT];
break;
} t->period = davinci_clock_tick_rate / (HZ);
t->opts &= ~TIMER_OPTS_STATE_MASK;
t->opts |= TIMER_OPTS_PERIODIC;
timer32_config(t);
return 0;
} }
static struct clock_event_device clockevent_davinci = { static struct clock_event_device clockevent_davinci = {
.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, .features = CLOCK_EVT_FEAT_PERIODIC |
.set_next_event = davinci_set_next_event, CLOCK_EVT_FEAT_ONESHOT,
.set_mode = davinci_set_mode, .set_next_event = davinci_set_next_event,
.set_state_shutdown = davinci_shutdown,
.set_state_periodic = davinci_set_periodic,
.set_state_oneshot = davinci_set_oneshot,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment