]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commit
watchdog: imx2_wdt: restore previous timeout after suspend+resume
authorMartin Kaiser <martin@kaiser.cx>
Mon, 1 Jan 2018 17:26:47 +0000 (18:26 +0100)
committerWim Van Sebroeck <wim@iguana.be>
Sun, 21 Jan 2018 11:44:58 +0000 (12:44 +0100)
commit0be267255cef64e1c58475baa7b25568355a3816
tree42446ccbad62cc19f04213eb4b479bb4ba739dbf
parent38a1222ae4f364d5bd5221fe305dbb0889f45d15
watchdog: imx2_wdt: restore previous timeout after suspend+resume

When the watchdog device is suspended, its timeout is set to the maximum
value. During resume, the previously set timeout should be restored.
This does not work at the moment.

The suspend function calls

imx2_wdt_set_timeout(wdog, IMX2_WDT_MAX_TIME);

and resume reverts this by calling

imx2_wdt_set_timeout(wdog, wdog->timeout);

However, imx2_wdt_set_timeout() updates wdog->timeout. Therefore,
wdog->timeout is set to IMX2_WDT_MAX_TIME when we enter the resume
function.

Fix this by adding a new function __imx2_wdt_set_timeout() which
only updates the hardware settings. imx2_wdt_set_timeout() now calls
__imx2_wdt_set_timeout() and then saves the new timeout to
wdog->timeout.

During suspend, we call __imx2_wdt_set_timeout() directly so that
wdog->timeout won't be updated and we can restore the previous value
during resume. This approach makes wdog->timeout different from the
actual setting in the hardware which is usually not a good thing.
However, the two differ only while we're suspended and no kernel code is
running, so it should be ok in this case.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Cc: stable@vger.kernel.org
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
drivers/watchdog/imx2_wdt.c