From 14bf6228e09b869b15378385c9b5bc8444033a89 Mon Sep 17 00:00:00 2001 From: Changki Kim Date: Mon, 6 Mar 2017 14:42:41 +0900 Subject: [PATCH] [COMMON] watchdog: s3c2410_wdt: Only watchdog kicking for suspend When the system is stuck, it must be reset. This patch gurantees the reset before entering the suspend. Change-Id: Ic31244748fc9e8232faa7837e7bbb9ed7c52f209 Signed-off-by: Changki Kim --- drivers/watchdog/s3c2410_wdt.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c index dcd29dc8c27f..eb338f049026 100644 --- a/drivers/watchdog/s3c2410_wdt.c +++ b/drivers/watchdog/s3c2410_wdt.c @@ -381,7 +381,7 @@ static int s3c2410wdt_set_heartbeat(struct watchdog_device *wdd, if (divisor > 0x100) { dev_err(wdt->dev, "timeout %d too big\n", timeout); - return -EINVAL; + divisor = 0x100; } } @@ -578,13 +578,18 @@ int s3c2410wdt_set_emergency_stop(void) return 0; } -int s3c2410wdt_keepalive_emergency(void) +int s3c2410wdt_keepalive_emergency(bool reset) { struct s3c2410_wdt *wdt = s3c_wdt; if (!wdt) return -ENODEV; + if (reset) { + pr_emerg("watchdog reset is started to 30secs\n"); + s3c2410wdt_set_heartbeat(&wdt->wdt_device, 30); + s3c2410wdt_start(&wdt->wdt_device); + } /* This Function must be called during panic sequence only */ writel(wdt->count, wdt->reg_base + S3C2410_WTCNT); return 0; @@ -646,22 +651,17 @@ static struct notifier_block nb_panic_block = { #ifdef CONFIG_PM static int s3c2410wdt_suspend(void) { - int ret = 0; struct s3c2410_wdt *wdt = s3c_wdt; if (!wdt) - return ret; + return 0; + s3c2410wdt_keepalive(&wdt->wdt_device); /* Save watchdog state, and turn it off. */ wdt->wtcon_save = readl(wdt->reg_base + S3C2410_WTCON); wdt->wtdat_save = readl(wdt->reg_base + S3C2410_WTDAT); - /* Note that WTCNT doesn't need to be saved. */ - s3c2410wdt_stop(&wdt->wdt_device); - - ret = s3c2410wdt_mask_wdt_reset(wdt, true); - - return ret; + return 0; } static void s3c2410wdt_resume(void) -- 2.20.1