Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clockevents/drivers/sun5i: Migrate to new 'set-state' interface

Migrate sun5i 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: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>

authored by

Viresh Kumar and committed by
Daniel Lezcano
7486f5ad 8e8af4cd

+26 -19
+26 -19
drivers/clocksource/timer-sun5i.c
··· 103 103 ce->timer.base + TIMER_CTL_REG(timer)); 104 104 } 105 105 106 - static void sun5i_clkevt_mode(enum clock_event_mode mode, 107 - struct clock_event_device *clkevt) 106 + static int sun5i_clkevt_shutdown(struct clock_event_device *clkevt) 108 107 { 109 108 struct sun5i_timer_clkevt *ce = to_sun5i_timer_clkevt(clkevt); 110 109 111 - switch (mode) { 112 - case CLOCK_EVT_MODE_PERIODIC: 113 - sun5i_clkevt_time_stop(ce, 0); 114 - sun5i_clkevt_time_setup(ce, 0, ce->timer.ticks_per_jiffy); 115 - sun5i_clkevt_time_start(ce, 0, true); 116 - break; 117 - case CLOCK_EVT_MODE_ONESHOT: 118 - sun5i_clkevt_time_stop(ce, 0); 119 - sun5i_clkevt_time_start(ce, 0, false); 120 - break; 121 - case CLOCK_EVT_MODE_UNUSED: 122 - case CLOCK_EVT_MODE_SHUTDOWN: 123 - default: 124 - sun5i_clkevt_time_stop(ce, 0); 125 - break; 126 - } 110 + sun5i_clkevt_time_stop(ce, 0); 111 + return 0; 112 + } 113 + 114 + static int sun5i_clkevt_set_oneshot(struct clock_event_device *clkevt) 115 + { 116 + struct sun5i_timer_clkevt *ce = to_sun5i_timer_clkevt(clkevt); 117 + 118 + sun5i_clkevt_time_stop(ce, 0); 119 + sun5i_clkevt_time_start(ce, 0, false); 120 + return 0; 121 + } 122 + 123 + static int sun5i_clkevt_set_periodic(struct clock_event_device *clkevt) 124 + { 125 + struct sun5i_timer_clkevt *ce = to_sun5i_timer_clkevt(clkevt); 126 + 127 + sun5i_clkevt_time_stop(ce, 0); 128 + sun5i_clkevt_time_setup(ce, 0, ce->timer.ticks_per_jiffy); 129 + sun5i_clkevt_time_start(ce, 0, true); 130 + return 0; 127 131 } 128 132 129 133 static int sun5i_clkevt_next_event(unsigned long evt, ··· 290 286 ce->clkevt.name = node->name; 291 287 ce->clkevt.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; 292 288 ce->clkevt.set_next_event = sun5i_clkevt_next_event; 293 - ce->clkevt.set_mode = sun5i_clkevt_mode; 289 + ce->clkevt.set_state_shutdown = sun5i_clkevt_shutdown; 290 + ce->clkevt.set_state_periodic = sun5i_clkevt_set_periodic; 291 + ce->clkevt.set_state_oneshot = sun5i_clkevt_set_oneshot; 292 + ce->clkevt.tick_resume = sun5i_clkevt_shutdown; 294 293 ce->clkevt.rating = 340; 295 294 ce->clkevt.irq = irq; 296 295 ce->clkevt.cpumask = cpu_possible_mask;