aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2015-06-18 06:54:23 -0400
committerDaniel Lezcano <daniel.lezcano@linaro.org>2015-08-10 05:40:30 -0400
commit40117bd559d3119eb06206f5323680d712db7775 (patch)
tree9d4ad444a27b14531268fdbf6547a848809609c5
parent8eda41b0863ca82010010e951b7aa13b66a06e78 (diff)
clockevents/drivers/meson6: Migrate to new 'set-state' interface
Migrate meson6 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: Carlo Caione <carlo@caione.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by: Carlo Caione <carlo@caione.org>
-rw-r--r--drivers/clocksource/meson6_timer.c50
1 files changed, 27 insertions, 23 deletions
diff --git a/drivers/clocksource/meson6_timer.c b/drivers/clocksource/meson6_timer.c
index 5c15cba41dca..1fa22c4d2d49 100644
--- a/drivers/clocksource/meson6_timer.c
+++ b/drivers/clocksource/meson6_timer.c
@@ -67,25 +67,25 @@ static void meson6_clkevt_time_start(unsigned char timer, bool periodic)
67 writel(val | TIMER_ENABLE_BIT(timer), timer_base + TIMER_ISA_MUX); 67 writel(val | TIMER_ENABLE_BIT(timer), timer_base + TIMER_ISA_MUX);
68} 68}
69 69
70static void meson6_clkevt_mode(enum clock_event_mode mode, 70static int meson6_shutdown(struct clock_event_device *evt)
71 struct clock_event_device *clk)
72{ 71{
73 switch (mode) { 72 meson6_clkevt_time_stop(CED_ID);
74 case CLOCK_EVT_MODE_PERIODIC: 73 return 0;
75 meson6_clkevt_time_stop(CED_ID); 74}
76 meson6_clkevt_time_setup(CED_ID, USEC_PER_SEC/HZ - 1); 75
77 meson6_clkevt_time_start(CED_ID, true); 76static int meson6_set_oneshot(struct clock_event_device *evt)
78 break; 77{
79 case CLOCK_EVT_MODE_ONESHOT: 78 meson6_clkevt_time_stop(CED_ID);
80 meson6_clkevt_time_stop(CED_ID); 79 meson6_clkevt_time_start(CED_ID, false);
81 meson6_clkevt_time_start(CED_ID, false); 80 return 0;
82 break; 81}
83 case CLOCK_EVT_MODE_UNUSED: 82
84 case CLOCK_EVT_MODE_SHUTDOWN: 83static int meson6_set_periodic(struct clock_event_device *evt)
85 default: 84{
86 meson6_clkevt_time_stop(CED_ID); 85 meson6_clkevt_time_stop(CED_ID);
87 break; 86 meson6_clkevt_time_setup(CED_ID, USEC_PER_SEC / HZ - 1);
88 } 87 meson6_clkevt_time_start(CED_ID, true);
88 return 0;
89} 89}
90 90
91static int meson6_clkevt_next_event(unsigned long evt, 91static int meson6_clkevt_next_event(unsigned long evt,
@@ -99,11 +99,15 @@ static int meson6_clkevt_next_event(unsigned long evt,
99} 99}
100 100
101static struct clock_event_device meson6_clockevent = { 101static struct clock_event_device meson6_clockevent = {
102 .name = "meson6_tick", 102 .name = "meson6_tick",
103 .rating = 400, 103 .rating = 400,
104 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 104 .features = CLOCK_EVT_FEAT_PERIODIC |
105 .set_mode = meson6_clkevt_mode, 105 CLOCK_EVT_FEAT_ONESHOT,
106 .set_next_event = meson6_clkevt_next_event, 106 .set_state_shutdown = meson6_shutdown,
107 .set_state_periodic = meson6_set_periodic,
108 .set_state_oneshot = meson6_set_oneshot,
109 .tick_resume = meson6_shutdown,
110 .set_next_event = meson6_clkevt_next_event,
107}; 111};
108 112
109static irqreturn_t meson6_timer_interrupt(int irq, void *dev_id) 113static irqreturn_t meson6_timer_interrupt(int irq, void *dev_id)