From: Guenter Roeck <linux@roeck-us.net>
To: j@jannau.net
Cc: Hector Martin <marcan@marcan.st>, Sven Peter <sven@svenpeter.dev>,
Alyssa Rosenzweig <alyssa@rosenzweig.io>,
Wim Van Sebroeck <wim@linux-watchdog.org>,
asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] watchdog: apple: Deactivate on suspend
Date: Sat, 30 Sep 2023 04:58:15 -0700 [thread overview]
Message-ID: <e0a6f9f3-b472-4fda-829c-5d8f29234a4f@roeck-us.net> (raw)
In-Reply-To: <20230930-apple-watchdog-suspend-v1-1-1998c0be9fd7@jannau.net>
On Sat, Sep 30, 2023 at 10:19:26AM +0200, Janne Grunau via B4 Relay wrote:
> From: Janne Grunau <j@jannau.net>
>
> The watchdog remains active after putting the system into suspend. Add
> PM callbacks to deactivate the watchdog on suspend an re-activate it on
> resume.
>
> Signed-off-by: Janne Grunau <j@jannau.net>
> ---
> drivers/watchdog/apple_wdt.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/drivers/watchdog/apple_wdt.c b/drivers/watchdog/apple_wdt.c
> index eddeb0fede89..2167e0ba705e 100644
> --- a/drivers/watchdog/apple_wdt.c
> +++ b/drivers/watchdog/apple_wdt.c
> @@ -173,6 +173,8 @@ static int apple_wdt_probe(struct platform_device *pdev)
> if (!wdt->clk_rate)
> return -EINVAL;
>
> + platform_set_drvdata(pdev, wdt);
> +
> wdt->wdd.ops = &apple_wdt_ops;
> wdt->wdd.info = &apple_wdt_info;
> wdt->wdd.max_timeout = U32_MAX / wdt->clk_rate;
> @@ -190,6 +192,28 @@ static int apple_wdt_probe(struct platform_device *pdev)
> return devm_watchdog_register_device(dev, &wdt->wdd);
> }
>
> +static int __maybe_unused apple_wdt_resume(struct device *dev)
> +{
> + struct apple_wdt *wdt = dev_get_drvdata(dev);
> +
> + if (watchdog_active(&wdt->wdd) || watchdog_hw_running(&wdt->wdd))
> + apple_wdt_start(&wdt->wdd);
> +
> + return 0;
> +}
> +
> +static int __maybe_unused apple_wdt_suspend(struct device *dev)
> +{
> + struct apple_wdt *wdt = dev_get_drvdata(dev);
> +
> + if (watchdog_active(&wdt->wdd) || watchdog_hw_running(&wdt->wdd))
> + apple_wdt_stop(&wdt->wdd);
> +
> + return 0;
> +}
> +
> +static SIMPLE_DEV_PM_OPS(apple_wdt_pm_ops, apple_wdt_suspend, apple_wdt_resume);
Comments above that define say
/* Deprecated. Use DEFINE_SIMPLE_DEV_PM_OPS() instead. */
and with that the __maybe_unused is no longer necessary.
> +
> static const struct of_device_id apple_wdt_of_match[] = {
> { .compatible = "apple,wdt" },
> {},
> @@ -200,6 +224,7 @@ static struct platform_driver apple_wdt_driver = {
> .driver = {
> .name = "apple-watchdog",
> .of_match_table = apple_wdt_of_match,
> + .pm = pm_sleep_ptr(&apple_wdt_pm_ops),
> },
> .probe = apple_wdt_probe,
> };
>
> ---
> base-commit: 0bb80ecc33a8fb5a682236443c1e740d5c917d1d
> change-id: 20230930-apple-watchdog-suspend-7f73831130fb
>
> Best regards,
> --
> Janne Grunau <j@jannau.net>
>
prev parent reply other threads:[~2023-09-30 11:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-30 8:19 [PATCH] watchdog: apple: Deactivate on suspend Janne Grunau via B4 Relay
2023-09-30 11:58 ` Guenter Roeck [this message]
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=e0a6f9f3-b472-4fda-829c-5d8f29234a4f@roeck-us.net \
--to=linux@roeck-us.net \
--cc=alyssa@rosenzweig.io \
--cc=asahi@lists.linux.dev \
--cc=j@jannau.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=marcan@marcan.st \
--cc=sven@svenpeter.dev \
--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 read-only IMAP folder(s) and NNTP newsgroup(s).