watchdog: da9063: fix suspend/resume handling of HW_RUNNING watchdog

da9063_wdt_suspend() and da9063_wdt_resume() only check watchdog_active(),
when the watchdog is left running by the driver sets
WDOG_HW_RUNNING in da9063_wdt_probe() but userspace never opens the
device, so WDOG_ACTIVE remains cleared, the wdt_disable() will not be
executed in da9063_wdt_suspend. In this case, the suspend callback is
a no-op and the watchdog keeps counting during system suspend,
leading to an unexpected system reset.
Check WDOG_HW_RUNNING and wdd,can fix this issue.

Fixes: a7ceca4398 ("watchdog: da9063: optionally disable watchdog during suspend")
Cc: stable@vger.kernel.org
Signed-off-by: Li Jun <lijun01@kylinos.cn>
Link: https://patch.msgid.link/20260917013710.2754679-1-lijun01@kylinos.cn
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
Li Jun 2026-09-17 09:37:10 +08:00 committed by Guenter Roeck
parent 8f0ca55016
commit 7cb575b71a

View File

@ -271,7 +271,7 @@ static int da9063_wdt_suspend(struct device *dev)
if (!da9063->use_sw_pm)
return 0;
if (watchdog_active(wdd))
if (watchdog_active(wdd) || watchdog_hw_running(wdd))
return da9063_wdt_stop(wdd);
return 0;
@ -285,7 +285,7 @@ static int da9063_wdt_resume(struct device *dev)
if (!da9063->use_sw_pm)
return 0;
if (watchdog_active(wdd))
if (watchdog_active(wdd) || watchdog_hw_running(wdd))
return da9063_wdt_start(wdd);
return 0;