wdt: max77620: add support to disable wdt on suspend at boottime
Venkat Reddy Talla [Mon, 11 Apr 2016 10:12:22 +0000 (15:12 +0530)]
Adding support to disable watchdog on suspend at boottime
and enable or disable watchdog on suspend using sysfs node
interface.

Change-Id: If9f0aac8dc2fe083fb07bfe87969956c232ff897
Signed-off-by: Venkat Reddy Talla <vreddytalla@nvidia.com>
Reviewed-on: http://git-master/r/1123571
GVS: Gerrit_Virtual_Submit
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>

Documentation/devicetree/bindings/mfd/max77620.txt
drivers/watchdog/max77620_wdt.c

index 77addc0..7935535 100644 (file)
@@ -230,6 +230,8 @@ Optinal properties:
                        timeout.
        -maxim,otp-wdtt: Boolean, OTP wdt.
        -maxim,otp-wdten: Boolean, OTP WDT enable.
+       -maxim,maxim,wdt-suspend-enable-from-user: Boolean, disable wdt on suspend at bootime and
+       enable/disable wdt on suspend from sysfs interface.
 
        This node status can be disabled and if it is disabled then WDT will
 be OFF on system.
index 088e389..37fa868 100644 (file)
@@ -50,6 +50,7 @@ struct max77620_wdt {
        bool                            otp_wdtt;
        bool                            otp_wdten;
        bool                            enable_on_off;
+       bool                            wdt_suspend_enable;
        int                             suspend_timeout;
        int                             org_suspend_timeout;
        int                             current_timeout;
@@ -405,7 +406,9 @@ static int max77620_wdt_probe(struct platform_device *pdev)
                wdt->enable_on_off = of_property_read_bool(np,
                                        "maxim,enable-wdt-on-off");
                of_property_read_u32(np, "maxim,wdt-suspend-timeout",
-                               &wdt->suspend_timeout);
+                               &wdt->org_suspend_timeout);
+               wdt->wdt_suspend_enable = of_property_read_bool(np,
+                                       "maxim,wdt-suspend-enable-from-user");
        } else {
                wdt->boot_timeout = 0;
                wdt->otp_wdtt = 0;
@@ -420,7 +423,8 @@ static int max77620_wdt_probe(struct platform_device *pdev)
        wdt_dev->min_timeout = 2;
        wdt_dev->max_timeout = 128;
 
-       wdt->org_suspend_timeout = wdt->suspend_timeout;
+       if (!wdt->wdt_suspend_enable)
+               wdt->suspend_timeout = wdt->org_suspend_timeout;
        wdt->org_boot_timeout = wdt->boot_timeout;
 
        watchdog_set_nowayout(wdt_dev, nowayout);