]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
Merge tag 'linux-watchdog-5.6-rc3' of git://www.linux-watchdog.org/linux-watchdog
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 21 Feb 2020 21:02:49 +0000 (13:02 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 21 Feb 2020 21:02:49 +0000 (13:02 -0800)
Pull watchdog fixes from Wim Van Sebroeck:

 - mtk_wdt needs RESET_CONTROLLER to build

 - da9062 driver fixes:
     - fix power management ops
     - do not ping the hw during stop()
     - add dependency on I2C

* tag 'linux-watchdog-5.6-rc3' of git://www.linux-watchdog.org/linux-watchdog:
  watchdog: da9062: Add dependency on I2C
  watchdog: da9062: fix power management ops
  watchdog: da9062: do not ping the hw during stop()
  watchdog: fix mtk_wdt.c RESET_CONTROLLER build error

drivers/watchdog/Kconfig
drivers/watchdog/da9062_wdt.c

index cec868f8db3f9645ac9bd7741f7f60e28c86bbb6..9ea2b43d4b012aebc8571b3b713011733e3d332c 100644 (file)
@@ -207,6 +207,7 @@ config DA9063_WATCHDOG
 config DA9062_WATCHDOG
        tristate "Dialog DA9062/61 Watchdog"
        depends on MFD_DA9062 || COMPILE_TEST
+       depends on I2C
        select WATCHDOG_CORE
        help
          Support for the watchdog in the DA9062 and DA9061 PMICs.
@@ -841,6 +842,7 @@ config MEDIATEK_WATCHDOG
        tristate "Mediatek SoCs watchdog support"
        depends on ARCH_MEDIATEK || COMPILE_TEST
        select WATCHDOG_CORE
+       select RESET_CONTROLLER
        help
          Say Y here to include support for the watchdog timer
          in Mediatek SoCs.
index 47eefe072b405ff055ef830e6c831464d39de6e4..0ad15d55071ce5931f8c5b381c29add6017e9683 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/jiffies.h>
 #include <linux/mfd/da9062/registers.h>
 #include <linux/mfd/da9062/core.h>
+#include <linux/property.h>
 #include <linux/regmap.h>
 #include <linux/of.h>
 
@@ -31,6 +32,7 @@ static const unsigned int wdt_timeout[] = { 0, 2, 4, 8, 16, 32, 65, 131 };
 struct da9062_watchdog {
        struct da9062 *hw;
        struct watchdog_device wdtdev;
+       bool use_sw_pm;
 };
 
 static unsigned int da9062_wdt_timeout_to_sel(unsigned int secs)
@@ -95,13 +97,6 @@ static int da9062_wdt_stop(struct watchdog_device *wdd)
        struct da9062_watchdog *wdt = watchdog_get_drvdata(wdd);
        int ret;
 
-       ret = da9062_reset_watchdog_timer(wdt);
-       if (ret) {
-               dev_err(wdt->hw->dev, "Failed to ping the watchdog (err = %d)\n",
-                       ret);
-               return ret;
-       }
-
        ret = regmap_update_bits(wdt->hw->regmap,
                                 DA9062AA_CONTROL_D,
                                 DA9062AA_TWDSCALE_MASK,
@@ -200,6 +195,8 @@ static int da9062_wdt_probe(struct platform_device *pdev)
        if (!wdt)
                return -ENOMEM;
 
+       wdt->use_sw_pm = device_property_present(dev, "dlg,use-sw-pm");
+
        wdt->hw = chip;
 
        wdt->wdtdev.info = &da9062_watchdog_info;
@@ -226,6 +223,10 @@ static int da9062_wdt_probe(struct platform_device *pdev)
 static int __maybe_unused da9062_wdt_suspend(struct device *dev)
 {
        struct watchdog_device *wdd = dev_get_drvdata(dev);
+       struct da9062_watchdog *wdt = watchdog_get_drvdata(wdd);
+
+       if (!wdt->use_sw_pm)
+               return 0;
 
        if (watchdog_active(wdd))
                return da9062_wdt_stop(wdd);
@@ -236,6 +237,10 @@ static int __maybe_unused da9062_wdt_suspend(struct device *dev)
 static int __maybe_unused da9062_wdt_resume(struct device *dev)
 {
        struct watchdog_device *wdd = dev_get_drvdata(dev);
+       struct da9062_watchdog *wdt = watchdog_get_drvdata(wdd);
+
+       if (!wdt->use_sw_pm)
+               return 0;
 
        if (watchdog_active(wdd))
                return da9062_wdt_start(wdd);