Skip to content

Commit 2c9c4c9

Browse files
claudiubezneadlezcano
authored andcommitted
clocksource/drivers/timer-microchip-pit64b: Remove suspend/resume ops for ce
Remove suspend and resume ops for clockevent and add set_state_oneshot() instead. Along with this mchp_pit64b_{suspend, resume}() were called on proper function to disable/enable clocks. This will allow disabling clocks for clockevent in case it is not selected as active clockevent. Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> Link: https://lore.kernel.org/r/20220609094041.1796372-2-claudiu.beznea@microchip.com Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
1 parent 5b2ca9b commit 2c9c4c9

1 file changed

Lines changed: 16 additions & 14 deletions

File tree

drivers/clocksource/timer-microchip-pit64b.c

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ static int mchp_pit64b_clkevt_shutdown(struct clock_event_device *cedev)
173173
{
174174
struct mchp_pit64b_timer *timer = clkevt_to_mchp_pit64b_timer(cedev);
175175

176-
writel_relaxed(MCHP_PIT64B_CR_SWRST, timer->base + MCHP_PIT64B_CR);
176+
if (!clockevent_state_detached(cedev))
177+
mchp_pit64b_suspend(timer);
177178

178179
return 0;
179180
}
@@ -182,35 +183,37 @@ static int mchp_pit64b_clkevt_set_periodic(struct clock_event_device *cedev)
182183
{
183184
struct mchp_pit64b_timer *timer = clkevt_to_mchp_pit64b_timer(cedev);
184185

186+
if (clockevent_state_shutdown(cedev))
187+
mchp_pit64b_resume(timer);
188+
185189
mchp_pit64b_reset(timer, mchp_pit64b_ce_cycles, MCHP_PIT64B_MR_CONT,
186190
MCHP_PIT64B_IER_PERIOD);
187191

188192
return 0;
189193
}
190194

191-
static int mchp_pit64b_clkevt_set_next_event(unsigned long evt,
192-
struct clock_event_device *cedev)
195+
static int mchp_pit64b_clkevt_set_oneshot(struct clock_event_device *cedev)
193196
{
194197
struct mchp_pit64b_timer *timer = clkevt_to_mchp_pit64b_timer(cedev);
195198

196-
mchp_pit64b_reset(timer, evt, MCHP_PIT64B_MR_ONE_SHOT,
199+
if (clockevent_state_shutdown(cedev))
200+
mchp_pit64b_resume(timer);
201+
202+
mchp_pit64b_reset(timer, mchp_pit64b_ce_cycles, MCHP_PIT64B_MR_ONE_SHOT,
197203
MCHP_PIT64B_IER_PERIOD);
198204

199205
return 0;
200206
}
201207

202-
static void mchp_pit64b_clkevt_suspend(struct clock_event_device *cedev)
208+
static int mchp_pit64b_clkevt_set_next_event(unsigned long evt,
209+
struct clock_event_device *cedev)
203210
{
204211
struct mchp_pit64b_timer *timer = clkevt_to_mchp_pit64b_timer(cedev);
205212

206-
mchp_pit64b_suspend(timer);
207-
}
208-
209-
static void mchp_pit64b_clkevt_resume(struct clock_event_device *cedev)
210-
{
211-
struct mchp_pit64b_timer *timer = clkevt_to_mchp_pit64b_timer(cedev);
213+
mchp_pit64b_reset(timer, evt, MCHP_PIT64B_MR_ONE_SHOT,
214+
MCHP_PIT64B_IER_PERIOD);
212215

213-
mchp_pit64b_resume(timer);
216+
return 0;
214217
}
215218

216219
static irqreturn_t mchp_pit64b_interrupt(int irq, void *dev_id)
@@ -395,9 +398,8 @@ static int __init mchp_pit64b_init_clkevt(struct mchp_pit64b_timer *timer,
395398
ce->clkevt.rating = 150;
396399
ce->clkevt.set_state_shutdown = mchp_pit64b_clkevt_shutdown;
397400
ce->clkevt.set_state_periodic = mchp_pit64b_clkevt_set_periodic;
401+
ce->clkevt.set_state_oneshot = mchp_pit64b_clkevt_set_oneshot;
398402
ce->clkevt.set_next_event = mchp_pit64b_clkevt_set_next_event;
399-
ce->clkevt.suspend = mchp_pit64b_clkevt_suspend;
400-
ce->clkevt.resume = mchp_pit64b_clkevt_resume;
401403
ce->clkevt.cpumask = cpumask_of(0);
402404
ce->clkevt.irq = irq;
403405

0 commit comments

Comments
 (0)