Re: [PATCH v3] watchdog: mtk_wdt: Stop a running watchdog over system sleep even if not opened
From: Guenter Roeck
Date: Mon Oct 19 2026 - 21:46:04 EST
On Sat, Oct 10, 2026 at 09:36:31PM -0400, zoan37 wrote:
> mtk_wdt_suspend() and mtk_wdt_resume() only stop and restart the
> watchdog when it is active, that is, when userspace has opened it.
>
> But a watchdog that the bootloader left enabled stays enabled at probe,
> marked WDOG_HW_RUNNING, and the watchdog core pings it until userspace
> takes over; that has been the case since
> commit bbece05c0d3a ("watchdog: mtk_wdt: Remove mtk_wdt_stop() in probe()
> to prevent the system freeze and it doesn't reboot by watchdog problem").
> If the system suspends before userspace opens the device, or userspace
> never does, nothing stops the watchdog and nothing pings it while the
> system sleeps, so it resets the system one timeout (31 s by default)
> into the sleep.
>
> Also stop it on suspend and restart it on resume when it is running in
> hardware, like sp805_wdt does.
>
> The watchdog core keeps pinging such a watchdog until
> mtk_wdt_suspend() stops it, so it stays fed while tasks are frozen
> before the devices suspend. It may also ping once after resume, before
> mtk_wdt_resume() has started the watchdog again; that only reloads the
> counter of a stopped watchdog, and the watchdog stays powered over
> system sleep (it is what resets the system from s2idle without this
> patch). watchdog_stop_ping_on_suspend() is deliberately not used: it
> stops the pings from PM_SUSPEND_PREPARE on, which would leave a running
> watchdog unfed while tasks are frozen and could reset the system there
> with a short timeout.
>
> Fixes: bbece05c0d3a ("watchdog: mtk_wdt: Remove mtk_wdt_stop() in probe() to prevent the system freeze and it doesn't reboot by watchdog problem")
> Assisted-by: LLM
> Signed-off-by: zoan37 <agentzoan@xxxxxxxxx>
Applied.
Thanks,
Guenter