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

Configure Feed

Select the types of activity you want to include in your feed.

clocksource/drivers/mediatek: Optimize systimer irq clear flow on shutdown

mtk_syst_clkevt_shutdown is called after irq disabled in suspend flow,
clear any pending systimer irq when shutdown to avoid suspend aborted
due to timer irq pending

Also as for systimer in mediatek socs, there must be firstly enable
timer before clear systimer irq

Fixes: e3af677607d9("clocksource/drivers/timer-mediatek: Add support for system timer")
Signed-off-by: Fengquan Chen <fengquan.chen@mediatek.com>
Tested-by: Hsin-Yi Wang <hsinyi@chromium.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/1617960162-1988-2-git-send-email-Fengquan.Chen@mediatek.com

authored by

Fengquan Chen and committed by
Daniel Lezcano
ce957065 3b87265d

+6 -2
+6 -2
drivers/clocksource/timer-mediatek.c
··· 60 60 * SYST_CON_EN: Clock enable. Shall be set to 61 61 * - Start timer countdown. 62 62 * - Allow timeout ticks being updated. 63 - * - Allow changing interrupt functions. 63 + * - Allow changing interrupt status,like clear irq pending. 64 64 * 65 - * SYST_CON_IRQ_EN: Set to allow interrupt. 65 + * SYST_CON_IRQ_EN: Set to enable interrupt. 66 66 * 67 67 * SYST_CON_IRQ_CLR: Set to clear interrupt. 68 68 */ ··· 75 75 static void mtk_syst_ack_irq(struct timer_of *to) 76 76 { 77 77 /* Clear and disable interrupt */ 78 + writel(SYST_CON_EN, SYST_CON_REG(to)); 78 79 writel(SYST_CON_IRQ_CLR | SYST_CON_EN, SYST_CON_REG(to)); 79 80 } 80 81 ··· 112 111 113 112 static int mtk_syst_clkevt_shutdown(struct clock_event_device *clkevt) 114 113 { 114 + /* Clear any irq */ 115 + mtk_syst_ack_irq(to_timer_of(clkevt)); 116 + 115 117 /* Disable timer */ 116 118 writel(0, SYST_CON_REG(to_timer_of(clkevt))); 117 119