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

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

Migrate qcom 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.

Periodic mode isn't supported by the driver and so the callback isn't
provided anymore.

Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Kumar Gala <galak@codeaurora.org>
Cc: Andy Gross <agross@codeaurora.org>
Cc: David Brown <davidb@codeaurora.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>

authored by

Viresh Kumar and committed by
Daniel Lezcano
736b2df2 47d490ea

+7 -17
+7 -17
drivers/clocksource/qcom-timer.c
··· 47 47 { 48 48 struct clock_event_device *evt = dev_id; 49 49 /* Stop the timer tick */ 50 - if (evt->mode == CLOCK_EVT_MODE_ONESHOT) { 50 + if (clockevent_state_oneshot(evt)) { 51 51 u32 ctrl = readl_relaxed(event_base + TIMER_ENABLE); 52 52 ctrl &= ~TIMER_ENABLE_EN; 53 53 writel_relaxed(ctrl, event_base + TIMER_ENABLE); ··· 75 75 return 0; 76 76 } 77 77 78 - static void msm_timer_set_mode(enum clock_event_mode mode, 79 - struct clock_event_device *evt) 78 + static int msm_timer_shutdown(struct clock_event_device *evt) 80 79 { 81 80 u32 ctrl; 82 81 83 82 ctrl = readl_relaxed(event_base + TIMER_ENABLE); 84 83 ctrl &= ~(TIMER_ENABLE_EN | TIMER_ENABLE_CLR_ON_MATCH_EN); 85 - 86 - switch (mode) { 87 - case CLOCK_EVT_MODE_RESUME: 88 - case CLOCK_EVT_MODE_PERIODIC: 89 - break; 90 - case CLOCK_EVT_MODE_ONESHOT: 91 - /* Timer is enabled in set_next_event */ 92 - break; 93 - case CLOCK_EVT_MODE_UNUSED: 94 - case CLOCK_EVT_MODE_SHUTDOWN: 95 - break; 96 - } 97 84 writel_relaxed(ctrl, event_base + TIMER_ENABLE); 85 + return 0; 98 86 } 99 87 100 88 static struct clock_event_device __percpu *msm_evt; ··· 114 126 evt->name = "msm_timer"; 115 127 evt->features = CLOCK_EVT_FEAT_ONESHOT; 116 128 evt->rating = 200; 117 - evt->set_mode = msm_timer_set_mode; 129 + evt->set_state_shutdown = msm_timer_shutdown; 130 + evt->set_state_oneshot = msm_timer_shutdown; 131 + evt->tick_resume = msm_timer_shutdown; 118 132 evt->set_next_event = msm_timer_set_next_event; 119 133 evt->cpumask = cpumask_of(cpu); 120 134 ··· 137 147 138 148 static void msm_local_timer_stop(struct clock_event_device *evt) 139 149 { 140 - evt->set_mode(CLOCK_EVT_MODE_UNUSED, evt); 150 + evt->set_state_shutdown(evt); 141 151 disable_percpu_irq(evt->irq); 142 152 } 143 153