aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clocksource/qcom-timer.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2015-06-18 06:54:31 -0400
committerDaniel Lezcano <daniel.lezcano@linaro.org>2015-08-10 05:40:36 -0400
commit736b2df2abc1f128ce381e9f2e578502cabc2973 (patch)
treeb0a58d5f619e9410bf0920b83c721323123c213d /drivers/clocksource/qcom-timer.c
parent47d490ea1529633f02209fcb4e89438995375a6f (diff)
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>
Diffstat (limited to 'drivers/clocksource/qcom-timer.c')
-rw-r--r--drivers/clocksource/qcom-timer.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/drivers/clocksource/qcom-timer.c b/drivers/clocksource/qcom-timer.c
index cba2d015564c..f8e09f923651 100644
--- a/drivers/clocksource/qcom-timer.c
+++ b/drivers/clocksource/qcom-timer.c
@@ -47,7 +47,7 @@ static irqreturn_t msm_timer_interrupt(int irq, void *dev_id)
47{ 47{
48 struct clock_event_device *evt = dev_id; 48 struct clock_event_device *evt = dev_id;
49 /* Stop the timer tick */ 49 /* Stop the timer tick */
50 if (evt->mode == CLOCK_EVT_MODE_ONESHOT) { 50 if (clockevent_state_oneshot(evt)) {
51 u32 ctrl = readl_relaxed(event_base + TIMER_ENABLE); 51 u32 ctrl = readl_relaxed(event_base + TIMER_ENABLE);
52 ctrl &= ~TIMER_ENABLE_EN; 52 ctrl &= ~TIMER_ENABLE_EN;
53 writel_relaxed(ctrl, event_base + TIMER_ENABLE); 53 writel_relaxed(ctrl, event_base + TIMER_ENABLE);
@@ -75,26 +75,14 @@ static int msm_timer_set_next_event(unsigned long cycles,
75 return 0; 75 return 0;
76} 76}
77 77
78static void msm_timer_set_mode(enum clock_event_mode mode, 78static int msm_timer_shutdown(struct clock_event_device *evt)
79 struct clock_event_device *evt)
80{ 79{
81 u32 ctrl; 80 u32 ctrl;
82 81
83 ctrl = readl_relaxed(event_base + TIMER_ENABLE); 82 ctrl = readl_relaxed(event_base + TIMER_ENABLE);
84 ctrl &= ~(TIMER_ENABLE_EN | TIMER_ENABLE_CLR_ON_MATCH_EN); 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 writel_relaxed(ctrl, event_base + TIMER_ENABLE); 84 writel_relaxed(ctrl, event_base + TIMER_ENABLE);
85 return 0;
98} 86}
99 87
100static struct clock_event_device __percpu *msm_evt; 88static struct clock_event_device __percpu *msm_evt;
@@ -126,7 +114,9 @@ static int msm_local_timer_setup(struct clock_event_device *evt)
126 evt->name = "msm_timer"; 114 evt->name = "msm_timer";
127 evt->features = CLOCK_EVT_FEAT_ONESHOT; 115 evt->features = CLOCK_EVT_FEAT_ONESHOT;
128 evt->rating = 200; 116 evt->rating = 200;
129 evt->set_mode = msm_timer_set_mode; 117 evt->set_state_shutdown = msm_timer_shutdown;
118 evt->set_state_oneshot = msm_timer_shutdown;
119 evt->tick_resume = msm_timer_shutdown;
130 evt->set_next_event = msm_timer_set_next_event; 120 evt->set_next_event = msm_timer_set_next_event;
131 evt->cpumask = cpumask_of(cpu); 121 evt->cpumask = cpumask_of(cpu);
132 122
@@ -147,7 +137,7 @@ static int msm_local_timer_setup(struct clock_event_device *evt)
147 137
148static void msm_local_timer_stop(struct clock_event_device *evt) 138static void msm_local_timer_stop(struct clock_event_device *evt)
149{ 139{
150 evt->set_mode(CLOCK_EVT_MODE_UNUSED, evt); 140 evt->set_state_shutdown(evt);
151 disable_percpu_irq(evt->irq); 141 disable_percpu_irq(evt->irq);
152} 142}
153 143