Skip to content

Commit cef6bc9

Browse files
Jason LiuWim Van Sebroeck
authored andcommitted
watchdog: imx7ulp_wdt: init wdog when it was active
Paired with suspend, we can only init wdog again when it was active and ping it once to avoid the watchdog timeout after it resumed. Signed-off-by: Jason Liu <[email protected]> Signed-off-by: Alice Guo <[email protected]> Reviewed-by: Ye Li <[email protected]> Reviewed-by: Jacky Bai <[email protected]> Tested-by: Jacky Bai <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: Wim Van Sebroeck <[email protected]>
1 parent c32b53f commit cef6bc9

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

drivers/watchdog/imx7ulp_wdt.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,6 @@ static int imx7ulp_wdt_enable(struct watchdog_device *wdog, bool enable)
136136
return ret;
137137
}
138138

139-
static bool imx7ulp_wdt_is_enabled(void __iomem *base)
140-
{
141-
u32 val = readl(base + WDOG_CS);
142-
143-
return val & WDOG_CS_EN;
144-
}
145-
146139
static int imx7ulp_wdt_ping(struct watchdog_device *wdog)
147140
{
148141
struct imx7ulp_wdt_device *wdt = watchdog_get_drvdata(wdog);
@@ -382,11 +375,11 @@ static int __maybe_unused imx7ulp_wdt_resume_noirq(struct device *dev)
382375
if (ret)
383376
return ret;
384377

385-
if (imx7ulp_wdt_is_enabled(imx7ulp_wdt->base))
378+
if (watchdog_active(&imx7ulp_wdt->wdd)) {
386379
imx7ulp_wdt_init(imx7ulp_wdt, timeout);
387-
388-
if (watchdog_active(&imx7ulp_wdt->wdd))
389380
imx7ulp_wdt_start(&imx7ulp_wdt->wdd);
381+
imx7ulp_wdt_ping(&imx7ulp_wdt->wdd);
382+
}
390383

391384
return 0;
392385
}

0 commit comments

Comments
 (0)