stmp3xxx_rtc_wdt: Add suspend/resume PM support
authorJanusz Uzycki <j.uzycki@elproma.com.pl>
Mon, 22 Sep 2014 20:55:47 +0000 (22:55 +0200)
committerWim Van Sebroeck <wim@iguana.be>
Mon, 20 Oct 2014 18:55:54 +0000 (20:55 +0200)
There is no conflict with rtc/rtc-stmp3xxx.c parent
because modified registers in PM functions of stmp3xxx_rtc_wdt
are different.

Signed-off-by: Janusz Uzycki <j.uzycki@elproma.com.pl>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
drivers/watchdog/stmp3xxx_rtc_wdt.c

index 3804d5e9baea694f8e0c10c3240f7610a5d55db5..a62b1b6decf472ac2b35cf7e663da7e704f9e005 100644 (file)
@@ -94,9 +94,33 @@ static int stmp3xxx_wdt_remove(struct platform_device *pdev)
        return 0;
 }
 
+static int __maybe_unused stmp3xxx_wdt_suspend(struct device *dev)
+{
+       struct watchdog_device *wdd = &stmp3xxx_wdd;
+
+       if (watchdog_active(wdd))
+               return wdt_stop(wdd);
+
+       return 0;
+}
+
+static int __maybe_unused stmp3xxx_wdt_resume(struct device *dev)
+{
+       struct watchdog_device *wdd = &stmp3xxx_wdd;
+
+       if (watchdog_active(wdd))
+               return wdt_start(wdd);
+
+       return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(stmp3xxx_wdt_pm_ops,
+                        stmp3xxx_wdt_suspend, stmp3xxx_wdt_resume);
+
 static struct platform_driver stmp3xxx_wdt_driver = {
        .driver = {
                .name = "stmp3xxx_rtc_wdt",
+               .pm = &stmp3xxx_wdt_pm_ops,
        },
        .probe = stmp3xxx_wdt_probe,
        .remove = stmp3xxx_wdt_remove,