Re: [PATCH v4] watchdog: sunxi_wdt: stop the watchdog across system suspend
From: Guenter Roeck
Date: Tue Nov 17 2026 - 23:24:37 EST
On Wed, Nov 18, 2026 at 08:50:48AM +0800, Yang Siyuan wrote:
> The H616 watchdog has a maximum timeout of 16 seconds. systemd keeps
> /dev/watchdog0 open with RuntimeWatchdogSec=16s, but during system
> suspend all userspace is frozen and the watchdog core does not stop the
> hardware. A suspend longer than the timeout therefore resets the board
> before it can resume.
>
> Add system sleep PM ops to stop the watchdog before suspend and restart
> it after resume if it was running. The driver did not store its private
> data in the platform device, so add platform_set_drvdata() for the PM
> callbacks.
>
> Use DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr(), and use
> watchdog_hw_running() instead of a private flag to decide whether the
> hardware needs to be stopped and restarted.
>
> Tested on an Anbernic RG35XX-SP: a 30-second s2idle suspend resumes
> without the 16-second watchdog reset, and /dev/watchdog0 keeps working
> afterwards.
>
> Signed-off-by: Yang Siyuan <hsyysy@xxxxxxx>
Applied.
Thanks,
Guenter