mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "winton.liu" <18502523564@163.com>
To: a.zummo@towertech.it, alexandre.belloni@free-electrons.com,
	linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: "winton.liu" <18502523564@163.com>
Subject: [PATCH] rtc: ds1374: wdt:support suspend/resume for watchdog
Date: Mon, 25 Sep 2017 19:58:44 +0800	[thread overview]
Message-ID: <1506340724-18108-1-git-send-email-18502523564@163.com> (raw)

When enable CONFIG_RTC_DRV_DS1374_WDT use as watchdog,
in suspend mode, watchdog is still working but no daemon
patting the watchdog. The system will reboot if timeout.
So disable watchdog in suspend  and recover it in resume.

Signed-off-by: winton.liu <18502523564@163.com>
---
 drivers/rtc/rtc-ds1374.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c
index 38a2e9e..e990773 100644
--- a/drivers/rtc/rtc-ds1374.c
+++ b/drivers/rtc/rtc-ds1374.c
@@ -690,6 +690,10 @@ static int ds1374_suspend(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
 
+#ifdef CONFIG_RTC_DRV_DS1374_WDT
+	ds1374_wdt_disable();
+#endif
+
 	if (client->irq > 0 && device_may_wakeup(&client->dev))
 		enable_irq_wake(client->irq);
 	return 0;
@@ -699,6 +703,10 @@ static int ds1374_resume(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
 
+#ifdef CONFIG_RTC_DRV_DS1374_WDT
+	ds1374_wdt_settimeout(131072);
+#endif
+
 	if (client->irq > 0 && device_may_wakeup(&client->dev))
 		disable_irq_wake(client->irq);
 	return 0;
-- 
1.9.1

             reply	other threads:[~2017-09-25 12:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-25 11:58 winton.liu [this message]
2017-09-25 12:07 ` Alexandre Belloni
     [not found]   ` <tencent_BD3706918C1500105699D4E6@qq.com>
2017-09-26 10:22     ` Alexandre Belloni
2017-09-26 13:52       ` Guenter Roeck
2017-10-10 13:36         ` 刘稳
2017-10-10 13:12 winton.liu
2017-10-10 13:41 ` Guenter Roeck
2017-10-10 13:51   ` Alexandre Belloni
2017-10-10 15:05     ` Guenter Roeck
2017-10-12 13:40       ` 刘稳
2017-10-12 14:12         ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1506340724-18108-1-git-send-email-18502523564@163.com \
    --to=18502523564@163.com \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®