diff mbox series

[v2,2/2] watchdog: imx2_wdg: notify wdog core to stop ping worker on suspend

Message ID 20210618195033.3209598-3-grzegorz.jaszczyk@linaro.org
State New
Headers show
Series introduce watchdog_dev_suspend/resume | expand

Commit Message

Grzegorz Jaszczyk June 18, 2021, 7:50 p.m. UTC
Suspend routine disables wdog clk. Nevertheless, the watchdog subsystem
is not aware of that and can still try to ping wdog through
watchdog_ping_work. In order to prevent such condition and therefore
prevent from system hang (caused by the wdog register access issued
while the wdog clock is disabled) notify watchdog core that the ping
worker should be canceled during watchdog core suspend and restored
during resume.

Signed-off-by: Michal Koziel <michal.koziel@emlogic.no>

Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>

---
v1->v2:
- Do not use watchdog_dev_suspend/resume directly, instead notify the
watchdog core that the ping worker should be canceled during watchdog
core suspend and restored during resume.
- Commit log was updated accordingly.
---
 drivers/watchdog/imx2_wdt.c | 1 +
 1 file changed, 1 insertion(+)

-- 
2.29.0

Comments

Guenter Roeck June 28, 2021, 2:02 p.m. UTC | #1
On Fri, Jun 18, 2021 at 09:50:33PM +0200, Grzegorz Jaszczyk wrote:
> Suspend routine disables wdog clk. Nevertheless, the watchdog subsystem

> is not aware of that and can still try to ping wdog through

> watchdog_ping_work. In order to prevent such condition and therefore

> prevent from system hang (caused by the wdog register access issued

> while the wdog clock is disabled) notify watchdog core that the ping

> worker should be canceled during watchdog core suspend and restored

> during resume.

> 

> Signed-off-by: Michal Koziel <michal.koziel@emlogic.no>

> Signed-off-by: Grzegorz Jaszczyk <grzegorz.jaszczyk@linaro.org>


Reviewed-by: Guenter Roeck <linux@roeck-us.net>


> ---

> v1->v2:

> - Do not use watchdog_dev_suspend/resume directly, instead notify the

> watchdog core that the ping worker should be canceled during watchdog

> core suspend and restored during resume.

> - Commit log was updated accordingly.

> ---

>  drivers/watchdog/imx2_wdt.c | 1 +

>  1 file changed, 1 insertion(+)

> 

> diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c

> index b84f80f7d342..3e8d9c3b6386 100644

> --- a/drivers/watchdog/imx2_wdt.c

> +++ b/drivers/watchdog/imx2_wdt.c

> @@ -311,6 +311,7 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)

>  	watchdog_set_nowayout(wdog, nowayout);

>  	watchdog_set_restart_priority(wdog, 128);

>  	watchdog_init_timeout(wdog, timeout, dev);

> +	watchdog_stop_ping_on_suspend(wdog);

>  

>  	if (imx2_wdt_is_running(wdev)) {

>  		imx2_wdt_set_timeout(wdog, wdog->timeout);
diff mbox series

Patch

diff --git a/drivers/watchdog/imx2_wdt.c b/drivers/watchdog/imx2_wdt.c
index b84f80f7d342..3e8d9c3b6386 100644
--- a/drivers/watchdog/imx2_wdt.c
+++ b/drivers/watchdog/imx2_wdt.c
@@ -311,6 +311,7 @@  static int __init imx2_wdt_probe(struct platform_device *pdev)
 	watchdog_set_nowayout(wdog, nowayout);
 	watchdog_set_restart_priority(wdog, 128);
 	watchdog_init_timeout(wdog, timeout, dev);
+	watchdog_stop_ping_on_suspend(wdog);
 
 	if (imx2_wdt_is_running(wdev)) {
 		imx2_wdt_set_timeout(wdog, wdog->timeout);