Commit 74d6c68c authored by Wang Wensheng's avatar Wang Wensheng Committed by Wim Van Sebroeck

watchdog: sbsa: Test WDOG_HW_RUNNING bit in suspend and resume

If the sbsa_gwdt is enabled by BIOS, the kernel set WDOG_HW_RUNNING bit
and keep it alive before anyone else would open it. When system suspend,
the sbsa_gwdt would not be disabled because WDOG_ACTIVE is not set. Then
the sbsa_gwdt would reach timeout since no one touch it during system
suspend.

To solve this, just test WDOG_HW_RUNNING bit in suspend and disable the
sbsa_gwdt if the bit is set, then reopen it accordingly in resume
process.
Signed-off-by: default avatarWang Wensheng <wangwensheng4@huawei.com>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20230301113702.76437-1-wangwensheng4@huawei.comSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarWim Van Sebroeck <wim@linux-watchdog.org>
parent 96c6e56d
...@@ -361,7 +361,7 @@ static int __maybe_unused sbsa_gwdt_suspend(struct device *dev) ...@@ -361,7 +361,7 @@ static int __maybe_unused sbsa_gwdt_suspend(struct device *dev)
{ {
struct sbsa_gwdt *gwdt = dev_get_drvdata(dev); struct sbsa_gwdt *gwdt = dev_get_drvdata(dev);
if (watchdog_active(&gwdt->wdd)) if (watchdog_hw_running(&gwdt->wdd))
sbsa_gwdt_stop(&gwdt->wdd); sbsa_gwdt_stop(&gwdt->wdd);
return 0; return 0;
...@@ -372,7 +372,7 @@ static int __maybe_unused sbsa_gwdt_resume(struct device *dev) ...@@ -372,7 +372,7 @@ static int __maybe_unused sbsa_gwdt_resume(struct device *dev)
{ {
struct sbsa_gwdt *gwdt = dev_get_drvdata(dev); struct sbsa_gwdt *gwdt = dev_get_drvdata(dev);
if (watchdog_active(&gwdt->wdd)) if (watchdog_hw_running(&gwdt->wdd))
sbsa_gwdt_start(&gwdt->wdd); sbsa_gwdt_start(&gwdt->wdd);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment