Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1569935

[PATCH 2/2] watchdog: sama5d4: Implement resume hook

From Alexandre Belloni <alexandre.belloni@free-electrons.com>
Newsgroups linux.kernel
Subject [PATCH 2/2] watchdog: sama5d4: Implement resume hook
Date 2017-01-30 18:30 +0100
Message-ID <t5nWa-6Jm-23@gated-at.bofh.it> (permalink)
References <t5nWa-6Jm-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


When resuming for the deepest state on sama5d2, it is necessary to restore
MR as the registers are lost.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 drivers/watchdog/sama5d4_wdt.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/watchdog/sama5d4_wdt.c b/drivers/watchdog/sama5d4_wdt.c
index 6dd07bef515a..de8ff10a032e 100644
--- a/drivers/watchdog/sama5d4_wdt.c
+++ b/drivers/watchdog/sama5d4_wdt.c
@@ -258,11 +258,28 @@ static const struct of_device_id sama5d4_wdt_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, sama5d4_wdt_of_match);
 
+#ifdef CONFIG_PM_SLEEP
+static int sama5d4_wdt_resume(struct device *dev)
+{
+	struct sama5d4_wdt *wdt = dev_get_drvdata(dev);
+
+	wdt_write(wdt, AT91_WDT_MR, wdt->mr & ~AT91_WDT_WDDIS);
+	if (wdt->mr & AT91_WDT_WDDIS)
+		wdt_write(wdt, AT91_WDT_MR, wdt->mr);
+
+	return 0;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(sama5d4_wdt_pm_ops, NULL,
+			 sama5d4_wdt_resume);
+
 static struct platform_driver sama5d4_wdt_driver = {
 	.probe		= sama5d4_wdt_probe,
 	.remove		= sama5d4_wdt_remove,
 	.driver		= {
 		.name	= "sama5d4_wdt",
+		.pm	= &sama5d4_wdt_pm_ops,
 		.of_match_table = sama5d4_wdt_of_match,
 	}
 };
-- 
2.11.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] watchdog: sama5d4: Cache MR instead of a partial config Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2017-01-30 18:30 +0100
  [PATCH 2/2] watchdog: sama5d4: Implement resume hook Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2017-01-30 18:30 +0100
    Re: [PATCH 2/2] watchdog: sama5d4: Implement resume hook Guenter Roeck <linux@roeck-us.net> - 2017-02-05 01:00 +0100
  Re: [PATCH 1/2] watchdog: sama5d4: Cache MR instead of a partial  config Guenter Roeck <linux@roeck-us.net> - 2017-01-30 19:20 +0100
    Re: [PATCH 1/2] watchdog: sama5d4: Cache MR instead of a partial  config Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2017-02-01 18:00 +0100
  Re: [PATCH 1/2] watchdog: sama5d4: Cache MR instead of a partial  config Guenter Roeck <linux@roeck-us.net> - 2017-02-05 02:10 +0100

csiph-web