aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2015-06-18 06:54:35 -0400
committerDaniel Lezcano <daniel.lezcano@linaro.org>2015-08-10 05:40:38 -0400
commit19a9ffb3d6e9ed1d3a46aee18d0b7f8eff41c82b (patch)
tree7672b1d3f083d3d088547aac63634de8fd6df9cf
parent051b782e2406af7f831602c70f887ca9b510b511 (diff)
clockevents/drivers/sh_mtu2: Migrate to new 'set-state' interface
Migrate sh_mtu2 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: Magnus Damm <damm+renesas@opensource.se> Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Cc: Paul Mundt <lethal@linux-sh.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-rw-r--r--drivers/clocksource/sh_mtu2.c42
1 files changed, 16 insertions, 26 deletions
diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c
index 3d88698cf2b8..f1985da8113f 100644
--- a/drivers/clocksource/sh_mtu2.c
+++ b/drivers/clocksource/sh_mtu2.c
@@ -276,36 +276,25 @@ static struct sh_mtu2_channel *ced_to_sh_mtu2(struct clock_event_device *ced)
276 return container_of(ced, struct sh_mtu2_channel, ced); 276 return container_of(ced, struct sh_mtu2_channel, ced);
277} 277}
278 278
279static void sh_mtu2_clock_event_mode(enum clock_event_mode mode, 279static int sh_mtu2_clock_event_shutdown(struct clock_event_device *ced)
280 struct clock_event_device *ced)
281{ 280{
282 struct sh_mtu2_channel *ch = ced_to_sh_mtu2(ced); 281 struct sh_mtu2_channel *ch = ced_to_sh_mtu2(ced);
283 int disabled = 0;
284 282
285 /* deal with old setting first */ 283 sh_mtu2_disable(ch);
286 switch (ced->mode) { 284 return 0;
287 case CLOCK_EVT_MODE_PERIODIC: 285}
286
287static int sh_mtu2_clock_event_set_periodic(struct clock_event_device *ced)
288{
289 struct sh_mtu2_channel *ch = ced_to_sh_mtu2(ced);
290
291 if (clockevent_state_periodic(ced))
288 sh_mtu2_disable(ch); 292 sh_mtu2_disable(ch);
289 disabled = 1;
290 break;
291 default:
292 break;
293 }
294 293
295 switch (mode) { 294 dev_info(&ch->mtu->pdev->dev, "ch%u: used for periodic clock events\n",
296 case CLOCK_EVT_MODE_PERIODIC: 295 ch->index);
297 dev_info(&ch->mtu->pdev->dev, 296 sh_mtu2_enable(ch);
298 "ch%u: used for periodic clock events\n", ch->index); 297 return 0;
299 sh_mtu2_enable(ch);
300 break;
301 case CLOCK_EVT_MODE_UNUSED:
302 if (!disabled)
303 sh_mtu2_disable(ch);
304 break;
305 case CLOCK_EVT_MODE_SHUTDOWN:
306 default:
307 break;
308 }
309} 298}
310 299
311static void sh_mtu2_clock_event_suspend(struct clock_event_device *ced) 300static void sh_mtu2_clock_event_suspend(struct clock_event_device *ced)
@@ -327,7 +316,8 @@ static void sh_mtu2_register_clockevent(struct sh_mtu2_channel *ch,
327 ced->features = CLOCK_EVT_FEAT_PERIODIC; 316 ced->features = CLOCK_EVT_FEAT_PERIODIC;
328 ced->rating = 200; 317 ced->rating = 200;
329 ced->cpumask = cpu_possible_mask; 318 ced->cpumask = cpu_possible_mask;
330 ced->set_mode = sh_mtu2_clock_event_mode; 319 ced->set_state_shutdown = sh_mtu2_clock_event_shutdown;
320 ced->set_state_periodic = sh_mtu2_clock_event_set_periodic;
331 ced->suspend = sh_mtu2_clock_event_suspend; 321 ced->suspend = sh_mtu2_clock_event_suspend;
332 ced->resume = sh_mtu2_clock_event_resume; 322 ced->resume = sh_mtu2_clock_event_resume;
333 323