linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: peter.fordham@gmail.com (Peter Fordham)
To: linux-arm-kernel@lists.infradead.org
Subject: [MPCore Watchdog]: Add suspend/resume support.
Date: Wed, 15 Jun 2011 13:18:32 -0700	[thread overview]
Message-ID: <BANLkTimy_X3EmefqtLRNy_NswzekXVXj6A@mail.gmail.com> (raw)

Add support for suspend and resume to the MPCore watchdog driver.

---
 drivers/watchdog/mpcore_wdt.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/drivers/watchdog/mpcore_wdt.c b/drivers/watchdog/mpcore_wdt.c
index 2b4af22..5f63a74 100644
--- a/drivers/watchdog/mpcore_wdt.c
+++ b/drivers/watchdog/mpcore_wdt.c
@@ -407,12 +407,36 @@ static int __devexit mpcore_wdt_remove(struct
platform_device *dev)
 	return 0;
 }

+#ifdef CONFIG_PM
+static int mpcore_wdt_suspend(struct platform_device *dev, pm_message_t msg)
+{
+        struct mpcore_wdt *wdt = platform_get_drvdata(dev);
+        mpcore_wdt_stop(wdt);		/* Turn the WDT off */
+        return 0;
+}
+
+static int mpcore_wdt_resume(struct platform_device *dev)
+{
+        struct mpcore_wdt *wdt = platform_get_drvdata(dev);
+        /* re-activate timer */
+        if (test_bit(0, &wdt->timer_alive)) {
+                mpcore_wdt_start(wdt);
+        }
+        return 0;
+}
+#else
+#define mpcore_wdt_suspend    NULL
+#define mpcore_wdt_resume     NULL
+#endif
+
 /* work with hotplug and coldplug */
 MODULE_ALIAS("platform:mpcore_wdt");

 static struct platform_driver mpcore_wdt_driver = {
 	.probe		= mpcore_wdt_probe,
 	.remove		= __devexit_p(mpcore_wdt_remove),
+        .suspend        = mpcore_wdt_suspend,
+        .resume         = mpcore_wdt_resume,
 	.shutdown	= mpcore_wdt_shutdown,
 	.driver		= {
 		.owner	= THIS_MODULE,
-- 
1.7.0.4

                 reply	other threads:[~2011-06-15 20:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=BANLkTimy_X3EmefqtLRNy_NswzekXVXj6A@mail.gmail.com \
    --to=peter.fordham@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).