Linux-Watchdog Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/3] Explicit disable da9062 watchdog during suspend
@ 2020-01-08  9:57 Marco Felsch
  2020-01-08  9:57 ` [PATCH 1/3] mfd: da9062: fix watchdog compatible string Marco Felsch
                   ` (3 more replies)
  0 siblings, 4 replies; 20+ messages in thread
From: Marco Felsch @ 2020-01-08  9:57 UTC (permalink / raw)
  To: support.opensource, linux, robh+dt, lee.jones, stwiss.opensource,
	Adam.Thomson.Opensource
  Cc: linux-watchdog, devicetree, linux-kernel, kernel

Hi,

this v2 contains all review comments made on [1]. Furthermore the series
includes a fix patch which is need to parse the devicetree.

[1] https://www.spinics.net/lists/linux-watchdog/msg17044.html

Regards,
  Marco

Marco Felsch (3):
  mfd: da9062: fix watchdog compatible string
  dt-bindings: watchdog: da9062: add suspend disable option
  watchdog: da9062: add power management ops

 .../bindings/watchdog/da9062-wdt.txt          |  5 +++
 drivers/mfd/da9062-core.c                     |  2 +-
 drivers/watchdog/da9062_wdt.c                 | 37 +++++++++++++++++++
 3 files changed, 43 insertions(+), 1 deletion(-)

-- 
2.20.1


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

* [PATCH 1/3] mfd: da9062: fix watchdog compatible string
  2020-01-08  9:57 [PATCH 0/3] Explicit disable da9062 watchdog during suspend Marco Felsch
@ 2020-01-08  9:57 ` Marco Felsch
  2020-01-11 16:47   ` Guenter Roeck
                     ` (2 more replies)
  2020-01-08  9:57 ` [PATCH 2/3] dt-bindings: watchdog: da9062: add suspend disable option Marco Felsch
                   ` (2 subsequent siblings)
  3 siblings, 3 replies; 20+ messages in thread
From: Marco Felsch @ 2020-01-08  9:57 UTC (permalink / raw)
  To: support.opensource, linux, robh+dt, lee.jones, stwiss.opensource,
	Adam.Thomson.Opensource
  Cc: linux-watchdog, devicetree, linux-kernel, kernel

The watchdog driver compatible is "dlg,da9062-watchdog" and not
"dlg,da9062-wdt". Therefore the mfd-core can't populate the of_node and
fwnode. As result the watchdog driver can't parse the devicetree.

Fixes: 9b40b030c4ad ("mfd: da9062: Supply core driver")
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 drivers/mfd/da9062-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/da9062-core.c b/drivers/mfd/da9062-core.c
index e69626867c26..9143de7b77b8 100644
--- a/drivers/mfd/da9062-core.c
+++ b/drivers/mfd/da9062-core.c
@@ -248,7 +248,7 @@ static const struct mfd_cell da9062_devs[] = {
 		.name		= "da9062-watchdog",
 		.num_resources	= ARRAY_SIZE(da9062_wdt_resources),
 		.resources	= da9062_wdt_resources,
-		.of_compatible  = "dlg,da9062-wdt",
+		.of_compatible  = "dlg,da9062-watchdog",
 	},
 	{
 		.name		= "da9062-thermal",
-- 
2.20.1


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

* [PATCH 2/3] dt-bindings: watchdog: da9062: add suspend disable option
  2020-01-08  9:57 [PATCH 0/3] Explicit disable da9062 watchdog during suspend Marco Felsch
  2020-01-08  9:57 ` [PATCH 1/3] mfd: da9062: fix watchdog compatible string Marco Felsch
@ 2020-01-08  9:57 ` Marco Felsch
  2020-01-14 16:20   ` Adam Thomson
                     ` (2 more replies)
  2020-01-08  9:57 ` [PATCH 3/3] watchdog: da9062: add power management ops Marco Felsch
  2020-01-08 10:09 ` [PATCH 0/3] Explicit disable da9062 watchdog during suspend Marco Felsch
  3 siblings, 3 replies; 20+ messages in thread
From: Marco Felsch @ 2020-01-08  9:57 UTC (permalink / raw)
  To: support.opensource, linux, robh+dt, lee.jones, stwiss.opensource,
	Adam.Thomson.Opensource
  Cc: linux-watchdog, devicetree, linux-kernel, kernel

Document the watchdog disable option which can be used if the hardware
automatic suspend option is broken.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
 Documentation/devicetree/bindings/watchdog/da9062-wdt.txt | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/watchdog/da9062-wdt.txt b/Documentation/devicetree/bindings/watchdog/da9062-wdt.txt
index b935b526d2f3..950e4fba8dbc 100644
--- a/Documentation/devicetree/bindings/watchdog/da9062-wdt.txt
+++ b/Documentation/devicetree/bindings/watchdog/da9062-wdt.txt
@@ -6,6 +6,11 @@ Required properties:
 	"dlg,da9061-watchdog", "dlg,da9062-watchdog"
 	"dlg,da9062-watchdog"
 
+Optional properties:
+- dlg,use-sw-pm: Add this property to disable the watchdog during suspend.
+	Only use this option if you can't use the watchdog automatic suspend
+	function during a suspend (see register CONTROL_B).
+
 Example: DA9062
 
 	pmic0: da9062@58 {
-- 
2.20.1


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

* [PATCH 3/3] watchdog: da9062: add power management ops
  2020-01-08  9:57 [PATCH 0/3] Explicit disable da9062 watchdog during suspend Marco Felsch
  2020-01-08  9:57 ` [PATCH 1/3] mfd: da9062: fix watchdog compatible string Marco Felsch
  2020-01-08  9:57 ` [PATCH 2/3] dt-bindings: watchdog: da9062: add suspend disable option Marco Felsch
@ 2020-01-08  9:57 ` Marco Felsch
  2020-01-14 16:24   ` Adam Thomson
  2020-01-23 20:51   ` Guenter Roeck
  2020-01-08 10:09 ` [PATCH 0/3] Explicit disable da9062 watchdog during suspend Marco Felsch
  3 siblings, 2 replies; 20+ messages in thread
From: Marco Felsch @ 2020-01-08  9:57 UTC (permalink / raw)
  To: support.opensource, linux, robh+dt, lee.jones, stwiss.opensource,
	Adam.Thomson.Opensource
  Cc: linux-watchdog, devicetree, linux-kernel, kernel

Disable the watchdog during suspend if it is enabled and re-enable it on
resume. So we can sleep without the interruptions.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
v2:
- add dlg,use-sw-pm check to differentiate between automatic and manual
  disabling/enabling.
---
 drivers/watchdog/da9062_wdt.c | 37 +++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c
index e149e66a6ea9..c9b9d6394525 100644
--- a/drivers/watchdog/da9062_wdt.c
+++ b/drivers/watchdog/da9062_wdt.c
@@ -15,6 +15,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>
 
@@ -30,6 +31,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)
@@ -198,6 +200,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;
@@ -212,6 +216,7 @@ static int da9062_wdt_probe(struct platform_device *pdev)
 	watchdog_set_restart_priority(&wdt->wdtdev, 128);
 
 	watchdog_set_drvdata(&wdt->wdtdev, wdt);
+	dev_set_drvdata(dev, &wdt->wdtdev);
 
 	ret = devm_watchdog_register_device(dev, &wdt->wdtdev);
 	if (ret < 0)
@@ -220,10 +225,42 @@ static int da9062_wdt_probe(struct platform_device *pdev)
 	return da9062_wdt_ping(&wdt->wdtdev);
 }
 
+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);
+
+	return 0;
+}
+
+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);
+
+	return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(da9062_wdt_pm_ops,
+			 da9062_wdt_suspend, da9062_wdt_resume);
+
 static struct platform_driver da9062_wdt_driver = {
 	.probe = da9062_wdt_probe,
 	.driver = {
 		.name = "da9062-watchdog",
+		.pm = &da9062_wdt_pm_ops,
 		.of_match_table = da9062_compatible_id_table,
 	},
 };
-- 
2.20.1


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

* Re: [PATCH 0/3] Explicit disable da9062 watchdog during suspend
  2020-01-08  9:57 [PATCH 0/3] Explicit disable da9062 watchdog during suspend Marco Felsch
                   ` (2 preceding siblings ...)
  2020-01-08  9:57 ` [PATCH 3/3] watchdog: da9062: add power management ops Marco Felsch
@ 2020-01-08 10:09 ` Marco Felsch
  2020-02-07  6:47   ` Marco Felsch
  3 siblings, 1 reply; 20+ messages in thread
From: Marco Felsch @ 2020-01-08 10:09 UTC (permalink / raw)
  To: support.opensource, linux, robh+dt, lee.jones, stwiss.opensource,
	Adam.Thomson.Opensource
  Cc: devicetree, linux-watchdog, kernel, linux-kernel

Hi,

On 20-01-08 10:57, Marco Felsch wrote:
> Hi,
> 
> this v2 contains all review comments made on [1]. Furthermore the series
> includes a fix patch which is need to parse the devicetree.

I forgot to add the -v2 to my git command anyway this is realy a v2.
Sorry for the noise.

Regards,
  Marco

> [1] https://www.spinics.net/lists/linux-watchdog/msg17044.html
> 
> Regards,
>   Marco
> 
> Marco Felsch (3):
>   mfd: da9062: fix watchdog compatible string
>   dt-bindings: watchdog: da9062: add suspend disable option
>   watchdog: da9062: add power management ops
> 
>  .../bindings/watchdog/da9062-wdt.txt          |  5 +++
>  drivers/mfd/da9062-core.c                     |  2 +-
>  drivers/watchdog/da9062_wdt.c                 | 37 +++++++++++++++++++
>  3 files changed, 43 insertions(+), 1 deletion(-)
> 
> -- 
> 2.20.1
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* Re: [PATCH 1/3] mfd: da9062: fix watchdog compatible string
  2020-01-08  9:57 ` [PATCH 1/3] mfd: da9062: fix watchdog compatible string Marco Felsch
@ 2020-01-11 16:47   ` Guenter Roeck
  2020-01-14 16:19   ` Adam Thomson
  2020-01-16 13:35   ` Lee Jones
  2 siblings, 0 replies; 20+ messages in thread
From: Guenter Roeck @ 2020-01-11 16:47 UTC (permalink / raw)
  To: Marco Felsch
  Cc: support.opensource, robh+dt, lee.jones, stwiss.opensource,
	Adam.Thomson.Opensource, linux-watchdog, devicetree,
	linux-kernel, kernel

On Wed, Jan 08, 2020 at 10:57:02AM +0100, Marco Felsch wrote:
> The watchdog driver compatible is "dlg,da9062-watchdog" and not
> "dlg,da9062-wdt". Therefore the mfd-core can't populate the of_node and
> fwnode. As result the watchdog driver can't parse the devicetree.
> 
> Fixes: 9b40b030c4ad ("mfd: da9062: Supply core driver")
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>

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

> ---
>  drivers/mfd/da9062-core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mfd/da9062-core.c b/drivers/mfd/da9062-core.c
> index e69626867c26..9143de7b77b8 100644
> --- a/drivers/mfd/da9062-core.c
> +++ b/drivers/mfd/da9062-core.c
> @@ -248,7 +248,7 @@ static const struct mfd_cell da9062_devs[] = {
>  		.name		= "da9062-watchdog",
>  		.num_resources	= ARRAY_SIZE(da9062_wdt_resources),
>  		.resources	= da9062_wdt_resources,
> -		.of_compatible  = "dlg,da9062-wdt",
> +		.of_compatible  = "dlg,da9062-watchdog",
>  	},
>  	{
>  		.name		= "da9062-thermal",

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

* RE: [PATCH 1/3] mfd: da9062: fix watchdog compatible string
  2020-01-08  9:57 ` [PATCH 1/3] mfd: da9062: fix watchdog compatible string Marco Felsch
  2020-01-11 16:47   ` Guenter Roeck
@ 2020-01-14 16:19   ` Adam Thomson
  2020-01-14 16:23     ` Marco Felsch
  2020-01-16 13:35   ` Lee Jones
  2 siblings, 1 reply; 20+ messages in thread
From: Adam Thomson @ 2020-01-14 16:19 UTC (permalink / raw)
  To: Marco Felsch, Support Opensource, linux, robh+dt, lee.jones,
	Steve Twiss, Adam Thomson
  Cc: linux-watchdog, devicetree, linux-kernel, kernel

On 08 January 2020 09:57, Marco Felsch wrote:

> The watchdog driver compatible is "dlg,da9062-watchdog" and not
> "dlg,da9062-wdt". Therefore the mfd-core can't populate the of_node and
> fwnode. As result the watchdog driver can't parse the devicetree.
> 

I do agree there's a mismatch between the documentation and the MFD code.
So in your DT are you specifying 'dlg,da9062-watchdog' and not 'dlg,da9062-wdt'
hence the issue? Are there any existing users who are using 'dlg,da9062-wdt' in
their DT instead?

> Fixes: 9b40b030c4ad ("mfd: da9062: Supply core driver")
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
>  drivers/mfd/da9062-core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mfd/da9062-core.c b/drivers/mfd/da9062-core.c
> index e69626867c26..9143de7b77b8 100644
> --- a/drivers/mfd/da9062-core.c
> +++ b/drivers/mfd/da9062-core.c
> @@ -248,7 +248,7 @@ static const struct mfd_cell da9062_devs[] = {
>  		.name		= "da9062-watchdog",
>  		.num_resources	= ARRAY_SIZE(da9062_wdt_resources),
>  		.resources	= da9062_wdt_resources,
> -		.of_compatible  = "dlg,da9062-wdt",
> +		.of_compatible  = "dlg,da9062-watchdog",
>  	},
>  	{
>  		.name		= "da9062-thermal",
> --
> 2.20.1


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

* RE: [PATCH 2/3] dt-bindings: watchdog: da9062: add suspend disable option
  2020-01-08  9:57 ` [PATCH 2/3] dt-bindings: watchdog: da9062: add suspend disable option Marco Felsch
@ 2020-01-14 16:20   ` Adam Thomson
  2020-01-15  1:43   ` Rob Herring
  2020-01-23 20:50   ` Guenter Roeck
  2 siblings, 0 replies; 20+ messages in thread
From: Adam Thomson @ 2020-01-14 16:20 UTC (permalink / raw)
  To: Marco Felsch, Support Opensource, linux, robh+dt, lee.jones,
	Steve Twiss, Adam Thomson
  Cc: linux-watchdog, devicetree, linux-kernel, kernel

On 08 January 2020 09:57, Marco Felsch wrote:

> Document the watchdog disable option which can be used if the hardware
> automatic suspend option is broken.
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>

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

> ---
>  Documentation/devicetree/bindings/watchdog/da9062-wdt.txt | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/watchdog/da9062-wdt.txt
> b/Documentation/devicetree/bindings/watchdog/da9062-wdt.txt
> index b935b526d2f3..950e4fba8dbc 100644
> --- a/Documentation/devicetree/bindings/watchdog/da9062-wdt.txt
> +++ b/Documentation/devicetree/bindings/watchdog/da9062-wdt.txt
> @@ -6,6 +6,11 @@ Required properties:
>  	"dlg,da9061-watchdog", "dlg,da9062-watchdog"
>  	"dlg,da9062-watchdog"
> 
> +Optional properties:
> +- dlg,use-sw-pm: Add this property to disable the watchdog during suspend.
> +	Only use this option if you can't use the watchdog automatic suspend
> +	function during a suspend (see register CONTROL_B).
> +
>  Example: DA9062
> 
>  	pmic0: da9062@58 {
> --
> 2.20.1


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

* Re: [PATCH 1/3] mfd: da9062: fix watchdog compatible string
  2020-01-14 16:19   ` Adam Thomson
@ 2020-01-14 16:23     ` Marco Felsch
  2020-01-14 16:28       ` Adam Thomson
  0 siblings, 1 reply; 20+ messages in thread
From: Marco Felsch @ 2020-01-14 16:23 UTC (permalink / raw)
  To: Adam Thomson
  Cc: Support Opensource, linux, robh+dt, lee.jones, Steve Twiss,
	linux-watchdog, devicetree, linux-kernel, kernel

On 20-01-14 16:19, Adam Thomson wrote:
> On 08 January 2020 09:57, Marco Felsch wrote:
> 
> > The watchdog driver compatible is "dlg,da9062-watchdog" and not
> > "dlg,da9062-wdt". Therefore the mfd-core can't populate the of_node and
> > fwnode. As result the watchdog driver can't parse the devicetree.
> > 
> 
> I do agree there's a mismatch between the documentation and the MFD code.
> So in your DT are you specifying 'dlg,da9062-watchdog' and not 'dlg,da9062-wdt'
> hence the issue? Are there any existing users who are using 'dlg,da9062-wdt' in
> their DT instead?

Yes the upstream available DT I'm currently using is:
arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi.

I grep the code and found no _upstream_ user of 'dlg,da9062-wdt' also
using this compatible would be a missmatch with the binding
documentation. So those DT's assuming a wrong binding. Therefore I fixed
it here and not within the watchdog driver.

Regards,
  Marco

> > Fixes: 9b40b030c4ad ("mfd: da9062: Supply core driver")
> > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> > ---
> >  drivers/mfd/da9062-core.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/mfd/da9062-core.c b/drivers/mfd/da9062-core.c
> > index e69626867c26..9143de7b77b8 100644
> > --- a/drivers/mfd/da9062-core.c
> > +++ b/drivers/mfd/da9062-core.c
> > @@ -248,7 +248,7 @@ static const struct mfd_cell da9062_devs[] = {
> >  		.name		= "da9062-watchdog",
> >  		.num_resources	= ARRAY_SIZE(da9062_wdt_resources),
> >  		.resources	= da9062_wdt_resources,
> > -		.of_compatible  = "dlg,da9062-wdt",
> > +		.of_compatible  = "dlg,da9062-watchdog",
> >  	},
> >  	{
> >  		.name		= "da9062-thermal",
> > --
> > 2.20.1
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* RE: [PATCH 3/3] watchdog: da9062: add power management ops
  2020-01-08  9:57 ` [PATCH 3/3] watchdog: da9062: add power management ops Marco Felsch
@ 2020-01-14 16:24   ` Adam Thomson
  2020-01-23 20:51   ` Guenter Roeck
  1 sibling, 0 replies; 20+ messages in thread
From: Adam Thomson @ 2020-01-14 16:24 UTC (permalink / raw)
  To: Marco Felsch, Support Opensource, linux, robh+dt, lee.jones,
	Steve Twiss, Adam Thomson
  Cc: linux-watchdog, devicetree, linux-kernel, kernel

On 08 January 2020 09:57, Marco Felsch wrote:

> Disable the watchdog during suspend if it is enabled and re-enable it on
> resume. So we can sleep without the interruptions.
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>

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

> ---
> v2:
> - add dlg,use-sw-pm check to differentiate between automatic and manual
>   disabling/enabling.
> ---
>  drivers/watchdog/da9062_wdt.c | 37
> +++++++++++++++++++++++++++++++++++
>  1 file changed, 37 insertions(+)
> 
> diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c
> index e149e66a6ea9..c9b9d6394525 100644
> --- a/drivers/watchdog/da9062_wdt.c
> +++ b/drivers/watchdog/da9062_wdt.c
> @@ -15,6 +15,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>
> 
> @@ -30,6 +31,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)
> @@ -198,6 +200,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;
> @@ -212,6 +216,7 @@ static int da9062_wdt_probe(struct platform_device
> *pdev)
>  	watchdog_set_restart_priority(&wdt->wdtdev, 128);
> 
>  	watchdog_set_drvdata(&wdt->wdtdev, wdt);
> +	dev_set_drvdata(dev, &wdt->wdtdev);
> 
>  	ret = devm_watchdog_register_device(dev, &wdt->wdtdev);
>  	if (ret < 0)
> @@ -220,10 +225,42 @@ static int da9062_wdt_probe(struct platform_device
> *pdev)
>  	return da9062_wdt_ping(&wdt->wdtdev);
>  }
> 
> +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);
> +
> +	return 0;
> +}
> +
> +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);
> +
> +	return 0;
> +}
> +
> +static SIMPLE_DEV_PM_OPS(da9062_wdt_pm_ops,
> +			 da9062_wdt_suspend, da9062_wdt_resume);
> +
>  static struct platform_driver da9062_wdt_driver = {
>  	.probe = da9062_wdt_probe,
>  	.driver = {
>  		.name = "da9062-watchdog",
> +		.pm = &da9062_wdt_pm_ops,
>  		.of_match_table = da9062_compatible_id_table,
>  	},
>  };
> --
> 2.20.1


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

* RE: [PATCH 1/3] mfd: da9062: fix watchdog compatible string
  2020-01-14 16:23     ` Marco Felsch
@ 2020-01-14 16:28       ` Adam Thomson
  0 siblings, 0 replies; 20+ messages in thread
From: Adam Thomson @ 2020-01-14 16:28 UTC (permalink / raw)
  To: Marco Felsch, Adam Thomson
  Cc: Support Opensource, linux, robh+dt, lee.jones, Steve Twiss,
	linux-watchdog, devicetree, linux-kernel, kernel

On 14 January 2020 16:24, Marco Felsch wrote:

> On 20-01-14 16:19, Adam Thomson wrote:
> > On 08 January 2020 09:57, Marco Felsch wrote:
> >
> > > The watchdog driver compatible is "dlg,da9062-watchdog" and not
> > > "dlg,da9062-wdt". Therefore the mfd-core can't populate the of_node and
> > > fwnode. As result the watchdog driver can't parse the devicetree.
> > >
> >
> > I do agree there's a mismatch between the documentation and the MFD code.
> > So in your DT are you specifying 'dlg,da9062-watchdog' and not 'dlg,da9062-wdt'
> > hence the issue? Are there any existing users who are using 'dlg,da9062-wdt' in
> > their DT instead?
> 
> Yes the upstream available DT I'm currently using is:
> arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi.
> 
> I grep the code and found no _upstream_ user of 'dlg,da9062-wdt' also
> using this compatible would be a missmatch with the binding
> documentation. So those DT's assuming a wrong binding. Therefore I fixed
> it here and not within the watchdog driver.

Ok, no problem. Just wanted to be clear. In which case:

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

> 
> Regards,
>   Marco
> 
> > > Fixes: 9b40b030c4ad ("mfd: da9062: Supply core driver")
> > > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> > > ---
> > >  drivers/mfd/da9062-core.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/mfd/da9062-core.c b/drivers/mfd/da9062-core.c
> > > index e69626867c26..9143de7b77b8 100644
> > > --- a/drivers/mfd/da9062-core.c
> > > +++ b/drivers/mfd/da9062-core.c
> > > @@ -248,7 +248,7 @@ static const struct mfd_cell da9062_devs[] = {
> > >  		.name		= "da9062-watchdog",
> > >  		.num_resources	= ARRAY_SIZE(da9062_wdt_resources),
> > >  		.resources	= da9062_wdt_resources,
> > > -		.of_compatible  = "dlg,da9062-wdt",
> > > +		.of_compatible  = "dlg,da9062-watchdog",
> > >  	},
> > >  	{
> > >  		.name		= "da9062-thermal",
> > > --
> > > 2.20.1
> >
> >
> 
> --
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* Re: [PATCH 2/3] dt-bindings: watchdog: da9062: add suspend disable option
  2020-01-08  9:57 ` [PATCH 2/3] dt-bindings: watchdog: da9062: add suspend disable option Marco Felsch
  2020-01-14 16:20   ` Adam Thomson
@ 2020-01-15  1:43   ` Rob Herring
  2020-01-23 20:50   ` Guenter Roeck
  2 siblings, 0 replies; 20+ messages in thread
From: Rob Herring @ 2020-01-15  1:43 UTC (permalink / raw)
  To: Marco Felsch
  Cc: support.opensource, linux, robh+dt, lee.jones, stwiss.opensource,
	Adam.Thomson.Opensource, linux-watchdog, devicetree,
	linux-kernel, kernel

On Wed,  8 Jan 2020 10:57:03 +0100, Marco Felsch wrote:
> Document the watchdog disable option which can be used if the hardware
> automatic suspend option is broken.
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
>  Documentation/devicetree/bindings/watchdog/da9062-wdt.txt | 5 +++++
>  1 file changed, 5 insertions(+)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH 1/3] mfd: da9062: fix watchdog compatible string
  2020-01-08  9:57 ` [PATCH 1/3] mfd: da9062: fix watchdog compatible string Marco Felsch
  2020-01-11 16:47   ` Guenter Roeck
  2020-01-14 16:19   ` Adam Thomson
@ 2020-01-16 13:35   ` Lee Jones
  2 siblings, 0 replies; 20+ messages in thread
From: Lee Jones @ 2020-01-16 13:35 UTC (permalink / raw)
  To: Marco Felsch
  Cc: support.opensource, linux, robh+dt, stwiss.opensource,
	Adam.Thomson.Opensource, linux-watchdog, devicetree,
	linux-kernel, kernel

On Wed, 08 Jan 2020, Marco Felsch wrote:

> The watchdog driver compatible is "dlg,da9062-watchdog" and not
> "dlg,da9062-wdt". Therefore the mfd-core can't populate the of_node and
> fwnode. As result the watchdog driver can't parse the devicetree.
> 
> Fixes: 9b40b030c4ad ("mfd: da9062: Supply core driver")
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
>  drivers/mfd/da9062-core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 2/3] dt-bindings: watchdog: da9062: add suspend disable option
  2020-01-08  9:57 ` [PATCH 2/3] dt-bindings: watchdog: da9062: add suspend disable option Marco Felsch
  2020-01-14 16:20   ` Adam Thomson
  2020-01-15  1:43   ` Rob Herring
@ 2020-01-23 20:50   ` Guenter Roeck
  2 siblings, 0 replies; 20+ messages in thread
From: Guenter Roeck @ 2020-01-23 20:50 UTC (permalink / raw)
  To: Marco Felsch
  Cc: support.opensource, robh+dt, lee.jones, stwiss.opensource,
	Adam.Thomson.Opensource, linux-watchdog, devicetree,
	linux-kernel, kernel

On Wed, Jan 08, 2020 at 10:57:03AM +0100, Marco Felsch wrote:
> Document the watchdog disable option which can be used if the hardware
> automatic suspend option is broken.
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
> Reviewed-by: Rob Herring <robh@kernel.org>

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

> ---
>  Documentation/devicetree/bindings/watchdog/da9062-wdt.txt | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/watchdog/da9062-wdt.txt b/Documentation/devicetree/bindings/watchdog/da9062-wdt.txt
> index b935b526d2f3..950e4fba8dbc 100644
> --- a/Documentation/devicetree/bindings/watchdog/da9062-wdt.txt
> +++ b/Documentation/devicetree/bindings/watchdog/da9062-wdt.txt
> @@ -6,6 +6,11 @@ Required properties:
>  	"dlg,da9061-watchdog", "dlg,da9062-watchdog"
>  	"dlg,da9062-watchdog"
>  
> +Optional properties:
> +- dlg,use-sw-pm: Add this property to disable the watchdog during suspend.
> +	Only use this option if you can't use the watchdog automatic suspend
> +	function during a suspend (see register CONTROL_B).
> +
>  Example: DA9062
>  
>  	pmic0: da9062@58 {

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

* Re: [PATCH 3/3] watchdog: da9062: add power management ops
  2020-01-08  9:57 ` [PATCH 3/3] watchdog: da9062: add power management ops Marco Felsch
  2020-01-14 16:24   ` Adam Thomson
@ 2020-01-23 20:51   ` Guenter Roeck
  2020-02-06  9:00     ` Marco Felsch
  1 sibling, 1 reply; 20+ messages in thread
From: Guenter Roeck @ 2020-01-23 20:51 UTC (permalink / raw)
  To: Marco Felsch
  Cc: support.opensource, robh+dt, lee.jones, stwiss.opensource,
	Adam.Thomson.Opensource, linux-watchdog, devicetree,
	linux-kernel, kernel

On Wed, Jan 08, 2020 at 10:57:04AM +0100, Marco Felsch wrote:
> Disable the watchdog during suspend if it is enabled and re-enable it on
> resume. So we can sleep without the interruptions.
> 
> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

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

> ---
> v2:
> - add dlg,use-sw-pm check to differentiate between automatic and manual
>   disabling/enabling.
> ---
>  drivers/watchdog/da9062_wdt.c | 37 +++++++++++++++++++++++++++++++++++
>  1 file changed, 37 insertions(+)
> 
> diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c
> index e149e66a6ea9..c9b9d6394525 100644
> --- a/drivers/watchdog/da9062_wdt.c
> +++ b/drivers/watchdog/da9062_wdt.c
> @@ -15,6 +15,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>
>  
> @@ -30,6 +31,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)
> @@ -198,6 +200,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;
> @@ -212,6 +216,7 @@ static int da9062_wdt_probe(struct platform_device *pdev)
>  	watchdog_set_restart_priority(&wdt->wdtdev, 128);
>  
>  	watchdog_set_drvdata(&wdt->wdtdev, wdt);
> +	dev_set_drvdata(dev, &wdt->wdtdev);
>  
>  	ret = devm_watchdog_register_device(dev, &wdt->wdtdev);
>  	if (ret < 0)
> @@ -220,10 +225,42 @@ static int da9062_wdt_probe(struct platform_device *pdev)
>  	return da9062_wdt_ping(&wdt->wdtdev);
>  }
>  
> +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);
> +
> +	return 0;
> +}
> +
> +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);
> +
> +	return 0;
> +}
> +
> +static SIMPLE_DEV_PM_OPS(da9062_wdt_pm_ops,
> +			 da9062_wdt_suspend, da9062_wdt_resume);
> +
>  static struct platform_driver da9062_wdt_driver = {
>  	.probe = da9062_wdt_probe,
>  	.driver = {
>  		.name = "da9062-watchdog",
> +		.pm = &da9062_wdt_pm_ops,
>  		.of_match_table = da9062_compatible_id_table,
>  	},
>  };

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

* Re: [PATCH 3/3] watchdog: da9062: add power management ops
  2020-01-23 20:51   ` Guenter Roeck
@ 2020-02-06  9:00     ` Marco Felsch
  2020-02-06 14:28       ` Guenter Roeck
  2020-02-06 14:45       ` Guenter Roeck
  0 siblings, 2 replies; 20+ messages in thread
From: Marco Felsch @ 2020-02-06  9:00 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: support.opensource, robh+dt, lee.jones, stwiss.opensource,
	Adam.Thomson.Opensource, linux-watchdog, devicetree,
	linux-kernel, kernel

Hi Guenter,

On 20-01-23 12:51, Guenter Roeck wrote:
> On Wed, Jan 08, 2020 at 10:57:04AM +0100, Marco Felsch wrote:
> > Disable the watchdog during suspend if it is enabled and re-enable it on
> > resume. So we can sleep without the interruptions.
> > 
> > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> > Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
> 
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>

I got an kbuild email so I checked the linux-next master tree. On
linux-next this patch isn't used instead the old v1 was used...

Regards,
  Marco

> > ---
> > v2:
> > - add dlg,use-sw-pm check to differentiate between automatic and manual
> >   disabling/enabling.
> > ---
> >  drivers/watchdog/da9062_wdt.c | 37 +++++++++++++++++++++++++++++++++++
> >  1 file changed, 37 insertions(+)
> > 
> > diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c
> > index e149e66a6ea9..c9b9d6394525 100644
> > --- a/drivers/watchdog/da9062_wdt.c
> > +++ b/drivers/watchdog/da9062_wdt.c
> > @@ -15,6 +15,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>
> >  
> > @@ -30,6 +31,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)
> > @@ -198,6 +200,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;
> > @@ -212,6 +216,7 @@ static int da9062_wdt_probe(struct platform_device *pdev)
> >  	watchdog_set_restart_priority(&wdt->wdtdev, 128);
> >  
> >  	watchdog_set_drvdata(&wdt->wdtdev, wdt);
> > +	dev_set_drvdata(dev, &wdt->wdtdev);
> >  
> >  	ret = devm_watchdog_register_device(dev, &wdt->wdtdev);
> >  	if (ret < 0)
> > @@ -220,10 +225,42 @@ static int da9062_wdt_probe(struct platform_device *pdev)
> >  	return da9062_wdt_ping(&wdt->wdtdev);
> >  }
> >  
> > +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);
> > +
> > +	return 0;
> > +}
> > +
> > +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);
> > +
> > +	return 0;
> > +}
> > +
> > +static SIMPLE_DEV_PM_OPS(da9062_wdt_pm_ops,
> > +			 da9062_wdt_suspend, da9062_wdt_resume);
> > +
> >  static struct platform_driver da9062_wdt_driver = {
> >  	.probe = da9062_wdt_probe,
> >  	.driver = {
> >  		.name = "da9062-watchdog",
> > +		.pm = &da9062_wdt_pm_ops,
> >  		.of_match_table = da9062_compatible_id_table,
> >  	},
> >  };
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* Re: [PATCH 3/3] watchdog: da9062: add power management ops
  2020-02-06  9:00     ` Marco Felsch
@ 2020-02-06 14:28       ` Guenter Roeck
  2020-02-06 14:45       ` Guenter Roeck
  1 sibling, 0 replies; 20+ messages in thread
From: Guenter Roeck @ 2020-02-06 14:28 UTC (permalink / raw)
  To: Marco Felsch
  Cc: support.opensource, robh+dt, lee.jones, stwiss.opensource,
	Adam.Thomson.Opensource, linux-watchdog, devicetree,
	linux-kernel, kernel

On 2/6/20 1:00 AM, Marco Felsch wrote:
> Hi Guenter,
> 
> On 20-01-23 12:51, Guenter Roeck wrote:
>> On Wed, Jan 08, 2020 at 10:57:04AM +0100, Marco Felsch wrote:
>>> Disable the watchdog during suspend if it is enabled and re-enable it on
>>> resume. So we can sleep without the interruptions.
>>>
>>> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
>>> Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
>>
>> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> 
> I got an kbuild email so I checked the linux-next master tree. On
> linux-next this patch isn't used instead the old v1 was used...
> 

FWIW, The subject line of this patch doesn't include "v2".

Guenter

> Regards,
>    Marco
> 
>>> ---
>>> v2:
>>> - add dlg,use-sw-pm check to differentiate between automatic and manual
>>>    disabling/enabling.
>>> ---
>>>   drivers/watchdog/da9062_wdt.c | 37 +++++++++++++++++++++++++++++++++++
>>>   1 file changed, 37 insertions(+)
>>>
>>> diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c
>>> index e149e66a6ea9..c9b9d6394525 100644
>>> --- a/drivers/watchdog/da9062_wdt.c
>>> +++ b/drivers/watchdog/da9062_wdt.c
>>> @@ -15,6 +15,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>
>>>   
>>> @@ -30,6 +31,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)
>>> @@ -198,6 +200,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;
>>> @@ -212,6 +216,7 @@ static int da9062_wdt_probe(struct platform_device *pdev)
>>>   	watchdog_set_restart_priority(&wdt->wdtdev, 128);
>>>   
>>>   	watchdog_set_drvdata(&wdt->wdtdev, wdt);
>>> +	dev_set_drvdata(dev, &wdt->wdtdev);
>>>   
>>>   	ret = devm_watchdog_register_device(dev, &wdt->wdtdev);
>>>   	if (ret < 0)
>>> @@ -220,10 +225,42 @@ static int da9062_wdt_probe(struct platform_device *pdev)
>>>   	return da9062_wdt_ping(&wdt->wdtdev);
>>>   }
>>>   
>>> +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);
>>> +
>>> +	return 0;
>>> +}
>>> +
>>> +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);
>>> +
>>> +	return 0;
>>> +}
>>> +
>>> +static SIMPLE_DEV_PM_OPS(da9062_wdt_pm_ops,
>>> +			 da9062_wdt_suspend, da9062_wdt_resume);
>>> +
>>>   static struct platform_driver da9062_wdt_driver = {
>>>   	.probe = da9062_wdt_probe,
>>>   	.driver = {
>>>   		.name = "da9062-watchdog",
>>> +		.pm = &da9062_wdt_pm_ops,
>>>   		.of_match_table = da9062_compatible_id_table,
>>>   	},
>>>   };
>>
> 


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

* Re: [PATCH 3/3] watchdog: da9062: add power management ops
  2020-02-06  9:00     ` Marco Felsch
  2020-02-06 14:28       ` Guenter Roeck
@ 2020-02-06 14:45       ` Guenter Roeck
  2020-02-07  6:51         ` Marco Felsch
  1 sibling, 1 reply; 20+ messages in thread
From: Guenter Roeck @ 2020-02-06 14:45 UTC (permalink / raw)
  To: Marco Felsch
  Cc: support.opensource, robh+dt, lee.jones, stwiss.opensource,
	Adam.Thomson.Opensource, linux-watchdog, devicetree,
	linux-kernel, kernel

On 2/6/20 1:00 AM, Marco Felsch wrote:
> Hi Guenter,
> 
> On 20-01-23 12:51, Guenter Roeck wrote:
>> On Wed, Jan 08, 2020 at 10:57:04AM +0100, Marco Felsch wrote:
>>> Disable the watchdog during suspend if it is enabled and re-enable it on
>>> resume. So we can sleep without the interruptions.
>>>
>>> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
>>> Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
>>
>> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> 
> I got an kbuild email so I checked the linux-next master tree. On
> linux-next this patch isn't used instead the old v1 was used...
> 

Yes, it appears that I picked the wrong version as well, and Wim picked it
up from there. But, really, what do you expect if you don't tag your
submissions with version numbers ?

I would suggest to send a follow-up patch to fix what is in -next.

Guenter

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

* Re: [PATCH 0/3] Explicit disable da9062 watchdog during suspend
  2020-01-08 10:09 ` [PATCH 0/3] Explicit disable da9062 watchdog during suspend Marco Felsch
@ 2020-02-07  6:47   ` Marco Felsch
  0 siblings, 0 replies; 20+ messages in thread
From: Marco Felsch @ 2020-02-07  6:47 UTC (permalink / raw)
  To: support.opensource, linux, robh+dt, lee.jones, stwiss.opensource,
	Adam.Thomson.Opensource
  Cc: devicetree, linux-watchdog, kernel, linux-kernel

Hi Guenter,

On 20-01-08 11:09, Marco Felsch wrote:
> Hi,
> 
> On 20-01-08 10:57, Marco Felsch wrote:
> > Hi,
> > 
> > this v2 contains all review comments made on [1]. Furthermore the series
> > includes a fix patch which is need to parse the devicetree.
> 
> I forgot to add the -v2 to my git command anyway this is realy a v2.
> Sorry for the noise.

I said sorry here..

Regards,
  Marco

> Regards,
>   Marco
> 
> > [1] https://www.spinics.net/lists/linux-watchdog/msg17044.html
> > 
> > Regards,
> >   Marco
> > 
> > Marco Felsch (3):
> >   mfd: da9062: fix watchdog compatible string
> >   dt-bindings: watchdog: da9062: add suspend disable option
> >   watchdog: da9062: add power management ops
> > 
> >  .../bindings/watchdog/da9062-wdt.txt          |  5 +++
> >  drivers/mfd/da9062-core.c                     |  2 +-
> >  drivers/watchdog/da9062_wdt.c                 | 37 +++++++++++++++++++
> >  3 files changed, 43 insertions(+), 1 deletion(-)
> > 
> > -- 
> > 2.20.1
> > 
> > 
> > 
> 
> -- 
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* Re: [PATCH 3/3] watchdog: da9062: add power management ops
  2020-02-06 14:45       ` Guenter Roeck
@ 2020-02-07  6:51         ` Marco Felsch
  0 siblings, 0 replies; 20+ messages in thread
From: Marco Felsch @ 2020-02-07  6:51 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: support.opensource, robh+dt, lee.jones, stwiss.opensource,
	Adam.Thomson.Opensource, linux-watchdog, devicetree,
	linux-kernel, kernel

On 20-02-06 06:45, Guenter Roeck wrote:
> On 2/6/20 1:00 AM, Marco Felsch wrote:
> > Hi Guenter,
> > 
> > On 20-01-23 12:51, Guenter Roeck wrote:
> > > On Wed, Jan 08, 2020 at 10:57:04AM +0100, Marco Felsch wrote:
> > > > Disable the watchdog during suspend if it is enabled and re-enable it on
> > > > resume. So we can sleep without the interruptions.
> > > > 
> > > > Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> > > > Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
> > > 
> > > Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> > 
> > I got an kbuild email so I checked the linux-next master tree. On
> > linux-next this patch isn't used instead the old v1 was used...
> > 
> 
> Yes, it appears that I picked the wrong version as well, and Wim picked it
> up from there. But, really, what do you expect if you don't tag your
> submissions with version numbers ?

Pls check the cover-letter I said sorry their. As I said it was a
mistake.

> I would suggest to send a follow-up patch to fix what is in -next.

A 'real' patch or should I send a 'fixup!' patch?

Regards,
  Marco

> Guenter
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

end of thread, back to index

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-08  9:57 [PATCH 0/3] Explicit disable da9062 watchdog during suspend Marco Felsch
2020-01-08  9:57 ` [PATCH 1/3] mfd: da9062: fix watchdog compatible string Marco Felsch
2020-01-11 16:47   ` Guenter Roeck
2020-01-14 16:19   ` Adam Thomson
2020-01-14 16:23     ` Marco Felsch
2020-01-14 16:28       ` Adam Thomson
2020-01-16 13:35   ` Lee Jones
2020-01-08  9:57 ` [PATCH 2/3] dt-bindings: watchdog: da9062: add suspend disable option Marco Felsch
2020-01-14 16:20   ` Adam Thomson
2020-01-15  1:43   ` Rob Herring
2020-01-23 20:50   ` Guenter Roeck
2020-01-08  9:57 ` [PATCH 3/3] watchdog: da9062: add power management ops Marco Felsch
2020-01-14 16:24   ` Adam Thomson
2020-01-23 20:51   ` Guenter Roeck
2020-02-06  9:00     ` Marco Felsch
2020-02-06 14:28       ` Guenter Roeck
2020-02-06 14:45       ` Guenter Roeck
2020-02-07  6:51         ` Marco Felsch
2020-01-08 10:09 ` [PATCH 0/3] Explicit disable da9062 watchdog during suspend Marco Felsch
2020-02-07  6:47   ` Marco Felsch

Linux-Watchdog Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-watchdog/0 linux-watchdog/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-watchdog linux-watchdog/ https://lore.kernel.org/linux-watchdog \
		linux-watchdog@vger.kernel.org
	public-inbox-index linux-watchdog

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-watchdog


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git