linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] watchdog: da9062: fix power management ops
@ 2020-02-07  7:15 Marco Felsch
  2020-02-07 14:56 ` Guenter Roeck
  0 siblings, 1 reply; 3+ messages in thread
From: Marco Felsch @ 2020-02-07  7:15 UTC (permalink / raw)
  To: support.opensource, linux, stwiss.opensource, Adam.Thomson.Opensource
  Cc: linux-watchdog, kernel

This fixes commit f6c98b08381c ("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/20191128171931.22563-1-m.felsch@pengutronix.de/

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
Hi,

unfortunately I forgot to add an v2 tag [2] and Guenter took the
wrong patch version. It is completely my fault anyway this should be
part of the next rc tag for 5.6. The device property should be applied
already so this patch adds only the usage and therefore don't include
the dt-folks in the to: and cc:.

Regards,
  Marco

[2] https://lkml.org/lkml/2020/1/8/210

 drivers/watchdog/da9062_wdt.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c
index 47eefe072b40..77b6b5336067 100644
--- a/drivers/watchdog/da9062_wdt.c
+++ b/drivers/watchdog/da9062_wdt.c
@@ -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)
@@ -200,6 +202,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 +230,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 +244,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);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] watchdog: da9062: fix power management ops
  2020-02-07  7:15 [PATCH] watchdog: da9062: fix power management ops Marco Felsch
@ 2020-02-07 14:56 ` Guenter Roeck
  2020-02-10 11:29   ` Adam Thomson
  0 siblings, 1 reply; 3+ messages in thread
From: Guenter Roeck @ 2020-02-07 14:56 UTC (permalink / raw)
  To: Marco Felsch
  Cc: support.opensource, stwiss.opensource, Adam.Thomson.Opensource,
	linux-watchdog, kernel

On Fri, Feb 07, 2020 at 08:15:18AM +0100, Marco Felsch wrote:
> This fixes commit f6c98b08381c ("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/20191128171931.22563-1-m.felsch@pengutronix.de/
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
> Hi,
> 
> unfortunately I forgot to add an v2 tag [2] and Guenter took the
> wrong patch version. It is completely my fault anyway this should be
> part of the next rc tag for 5.6. The device property should be applied
> already so this patch adds only the usage and therefore don't include
> the dt-folks in the to: and cc:.
> 
> Regards,
>   Marco
> 
> [2] https://lkml.org/lkml/2020/1/8/210
> 
>  drivers/watchdog/da9062_wdt.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c
> index 47eefe072b40..77b6b5336067 100644
> --- a/drivers/watchdog/da9062_wdt.c
> +++ b/drivers/watchdog/da9062_wdt.c
> @@ -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)
> @@ -200,6 +202,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 +230,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 +244,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);
> -- 
> 2.20.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] watchdog: da9062: fix power management ops
  2020-02-07 14:56 ` Guenter Roeck
@ 2020-02-10 11:29   ` Adam Thomson
  0 siblings, 0 replies; 3+ messages in thread
From: Adam Thomson @ 2020-02-10 11:29 UTC (permalink / raw)
  To: Guenter Roeck, Marco Felsch
  Cc: Support Opensource, Steve Twiss, Adam Thomson, linux-watchdog, kernel

On 07 February 2020 14:56, Guenter Roeck wrote:

> On Fri, Feb 07, 2020 at 08:15:18AM +0100, Marco Felsch wrote:
> > This fixes commit f6c98b08381c ("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/20191128171931.22563-1-
> m.felsch@pengutronix.de/
> >
> > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> 
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>

Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

> 
> > ---
> > Hi,
> >
> > unfortunately I forgot to add an v2 tag [2] and Guenter took the
> > wrong patch version. It is completely my fault anyway this should be
> > part of the next rc tag for 5.6. The device property should be applied
> > already so this patch adds only the usage and therefore don't include
> > the dt-folks in the to: and cc:.
> >
> > Regards,
> >   Marco
> >
> > [2] https://lkml.org/lkml/2020/1/8/210
> >
> >  drivers/watchdog/da9062_wdt.c | 12 ++++++++++++
> >  1 file changed, 12 insertions(+)
> >
> > diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c
> > index 47eefe072b40..77b6b5336067 100644
> > --- a/drivers/watchdog/da9062_wdt.c
> > +++ b/drivers/watchdog/da9062_wdt.c
> > @@ -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)
> > @@ -200,6 +202,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 +230,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 +244,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);
> > --
> > 2.20.1
> >

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-02-10 11:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-07  7:15 [PATCH] watchdog: da9062: fix power management ops Marco Felsch
2020-02-07 14:56 ` Guenter Roeck
2020-02-10 11:29   ` Adam Thomson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).