Skip to content

Commit

Permalink
Merge tag 'linux-watchdog-5.6-rc3' of git://www.linux-watchdog.org/li…
Browse files Browse the repository at this point in the history
…nux-watchdog

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
  • Loading branch information
Linus Torvalds committed Feb 21, 2020
2 parents bb65619 + 44144c8 commit 0c0ddd6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 2 additions & 0 deletions drivers/watchdog/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
19 changes: 12 additions & 7 deletions drivers/watchdog/da9062_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand All @@ -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)
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 0c0ddd6

Please sign in to comment.