mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-28 21:02:43 +01:00
watchdog: da9062: fix power management ops
This fixes commitf6c98b0838("watchdog: da9062: add power management ops"). During discussion [1] we agreed that this should be configurable because it is a device quirk if we can't use the hw watchdog auto suspend function. [1] https://lore.kernel.org/linux-watchdog/[email protected]/ Signed-off-by: Marco Felsch <[email protected]> Fixes:f6c98b0838("watchdog: da9062: add power management ops") Reviewed-by: Guenter Roeck <[email protected]> Reviewed-by: Adam Thomson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: Wim Van Sebroeck <[email protected]>
This commit is contained in:
1 parent
e9a0e65eda
commit
8541673d2a
1 file changed
+12
@@ -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)
|
||||
@@ -193,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;
|
||||
@@ -219,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);
|
||||
@@ -229,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);
|
||||
|
||||
Reference in new issue
Block a user