From: Guenter Roeck <linux@roeck-us.net>
To: Marco Felsch <m.felsch@pengutronix.de>,
support.opensource@diasemi.com, wim@linux-watchdog.org
Cc: linux-watchdog@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH] watchdog: da9062: add power management ops
Date: Thu, 28 Nov 2019 09:41:58 -0800 [thread overview]
Message-ID: <f8f7721e-5ad3-ee3d-55e6-69544438884b@roeck-us.net> (raw)
In-Reply-To: <20191128171931.22563-1-m.felsch@pengutronix.de>
On 11/28/19 9:19 AM, 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: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/da9062_wdt.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c
> index e149e66a6ea9..2a1e7de25b71 100644
> --- a/drivers/watchdog/da9062_wdt.c
> +++ b/drivers/watchdog/da9062_wdt.c
> @@ -212,6 +212,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 +221,34 @@ 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);
> +
> + 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);
> +
> + 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,
> },
> };
>
next prev parent reply other threads:[~2019-11-28 17:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-28 17:19 [PATCH] watchdog: da9062: add power management ops Marco Felsch
2019-11-28 17:41 ` Guenter Roeck [this message]
2019-12-02 10:04 ` Adam Thomson
2019-12-02 10:56 ` Marco Felsch
2019-12-02 11:11 ` Adam Thomson
2019-12-02 13:03 ` Marco Felsch
2019-12-02 13:27 ` Adam Thomson
2019-12-02 13:38 ` Guenter Roeck
2019-12-02 14:44 ` Marco Felsch
2019-12-02 14:44 ` Adam Thomson
2019-12-02 15:06 ` Marco Felsch
2019-12-02 15:17 ` Adam Thomson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f8f7721e-5ad3-ee3d-55e6-69544438884b@roeck-us.net \
--to=linux@roeck-us.net \
--cc=kernel@pengutronix.de \
--cc=linux-watchdog@vger.kernel.org \
--cc=m.felsch@pengutronix.de \
--cc=support.opensource@diasemi.com \
--cc=wim@linux-watchdog.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).