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

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

Migrate cs5535 driver to the new 'set-state' interface provided by
the 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: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Andres Salomon <dilinger@queued.net>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

authored by

Viresh Kumar and committed by
Daniel Lezcano
8f9327cb b4cf5d71

+14 -10
+14 -10
drivers/clocksource/cs5535-clockevt.c
··· 42 42 * 256 128 .125 512.000 43 43 */ 44 44 45 - static unsigned int cs5535_tick_mode = CLOCK_EVT_MODE_SHUTDOWN; 46 45 static struct cs5535_mfgpt_timer *cs5535_event_clock; 47 46 48 47 /* Selected from the table above */ ··· 76 77 MFGPT_SETUP_CNTEN | MFGPT_SETUP_CMP2); 77 78 } 78 79 79 - static void mfgpt_set_mode(enum clock_event_mode mode, 80 - struct clock_event_device *evt) 80 + static int mfgpt_shutdown(struct clock_event_device *evt) 81 81 { 82 82 disable_timer(cs5535_event_clock); 83 + return 0; 84 + } 83 85 84 - if (mode == CLOCK_EVT_MODE_PERIODIC) 85 - start_timer(cs5535_event_clock, MFGPT_PERIODIC); 86 - 87 - cs5535_tick_mode = mode; 86 + static int mfgpt_set_periodic(struct clock_event_device *evt) 87 + { 88 + disable_timer(cs5535_event_clock); 89 + start_timer(cs5535_event_clock, MFGPT_PERIODIC); 90 + return 0; 88 91 } 89 92 90 93 static int mfgpt_next_event(unsigned long delta, struct clock_event_device *evt) ··· 98 97 static struct clock_event_device cs5535_clockevent = { 99 98 .name = DRV_NAME, 100 99 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 101 - .set_mode = mfgpt_set_mode, 100 + .set_state_shutdown = mfgpt_shutdown, 101 + .set_state_periodic = mfgpt_set_periodic, 102 + .set_state_oneshot = mfgpt_shutdown, 103 + .tick_resume = mfgpt_shutdown, 102 104 .set_next_event = mfgpt_next_event, 103 105 .rating = 250, 104 106 }; ··· 117 113 /* Turn off the clock (and clear the event) */ 118 114 disable_timer(cs5535_event_clock); 119 115 120 - if (cs5535_tick_mode == CLOCK_EVT_MODE_SHUTDOWN) 116 + if (clockevent_state_shutdown(&cs5535_clockevent)) 121 117 return IRQ_HANDLED; 122 118 123 119 /* Clear the counter */ ··· 125 121 126 122 /* Restart the clock in periodic mode */ 127 123 128 - if (cs5535_tick_mode == CLOCK_EVT_MODE_PERIODIC) 124 + if (clockevent_state_periodic(&cs5535_clockevent)) 129 125 cs5535_mfgpt_write(cs5535_event_clock, MFGPT_REG_SETUP, 130 126 MFGPT_SETUP_CNTEN | MFGPT_SETUP_CMP2); 131 127