From: Guenter Roeck <linux@roeck-us.net>
To: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>,
Simon Horman <horms@verge.net.au>,
Wim Van Sebroeck <wim@iguana.be>,
Wolfram Sang <wsa+renesas@sang-engineering.com>,
linux-watchdog@vger.kernel.org,
Chris Paterson <Chris.Paterson2@renesas.com>,
Biju Das <biju.das@bp.renesas.com>,
Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>,
linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH v7 1/3] watchdog: renesas_wdt: Add suspend/resume support
Date: Thu, 1 Mar 2018 11:41:01 -0800 [thread overview]
Message-ID: <20180301194101.GB29927@roeck-us.net> (raw)
In-Reply-To: <1519928243-28596-2-git-send-email-fabrizio.castro@bp.renesas.com>
On Thu, Mar 01, 2018 at 06:17:21PM +0000, Fabrizio Castro wrote:
> On R-Car Gen2 and RZ/G1 the watchdog IP clock needs to be always ON,
> on R-Car Gen3 we power the IP down during suspend.
>
> This commit adds suspend/resume support, so that the watchdog counting
> "pauses" during suspend on all of the SoCs compatible with this driver
> and on those we are now adding support for (R-Car Gen2 and RZ/G1).
>
> Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
> Signed-off-by: Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>
Usually, on resume, we just restart the watchdog, with the expectation in mind
that there may be some delay in userspace before it gets to send the next ping.
Presumably that is not a concern here, so
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> v6->v7:
> * backup and restore register RWTCNT instead of using rwdt_get_timeleft and
> rwdt_set_timeleft
>
> drivers/watchdog/renesas_wdt.c | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/drivers/watchdog/renesas_wdt.c b/drivers/watchdog/renesas_wdt.c
> index 831ef83..024d54e 100644
> --- a/drivers/watchdog/renesas_wdt.c
> +++ b/drivers/watchdog/renesas_wdt.c
> @@ -49,6 +49,7 @@ struct rwdt_priv {
> void __iomem *base;
> struct watchdog_device wdev;
> unsigned long clk_rate;
> + u16 time_left;
> u8 cks;
> };
>
> @@ -203,6 +204,30 @@ static int rwdt_remove(struct platform_device *pdev)
> return 0;
> }
>
> +static int __maybe_unused rwdt_suspend(struct device *dev)
> +{
> + struct rwdt_priv *priv = dev_get_drvdata(dev);
> +
> + if (watchdog_active(&priv->wdev)) {
> + priv->time_left = readw(priv->base + RWTCNT);
> + rwdt_stop(&priv->wdev);
> + }
> + return 0;
> +}
> +
> +static int __maybe_unused rwdt_resume(struct device *dev)
> +{
> + struct rwdt_priv *priv = dev_get_drvdata(dev);
> +
> + if (watchdog_active(&priv->wdev)) {
> + rwdt_start(&priv->wdev);
> + rwdt_write(priv, priv->time_left, RWTCNT);
> + }
> + return 0;
> +}
> +
> +static SIMPLE_DEV_PM_OPS(rwdt_pm_ops, rwdt_suspend, rwdt_resume);
> +
> /*
> * This driver does also fit for R-Car Gen2 (r8a779[0-4]) WDT. However, for SMP
> * to work there, one also needs a RESET (RST) driver which does not exist yet
> @@ -218,6 +243,7 @@ static struct platform_driver rwdt_driver = {
> .driver = {
> .name = "renesas_wdt",
> .of_match_table = rwdt_ids,
> + .pm = &rwdt_pm_ops,
> },
> .probe = rwdt_probe,
> .remove = rwdt_remove,
> --
> 2.7.4
>
next prev parent reply other threads:[~2018-03-01 19:41 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-01 18:17 [PATCH v7 0/3] Add Gen2 support to rwdt driver Fabrizio Castro
2018-03-01 18:17 ` [PATCH v7 1/3] watchdog: renesas_wdt: Add suspend/resume support Fabrizio Castro
2018-03-01 18:51 ` Wolfram Sang
2018-03-01 19:41 ` Guenter Roeck [this message]
2018-03-01 19:55 ` Wolfram Sang
2018-03-01 20:18 ` Geert Uytterhoeven
2018-03-02 10:45 ` Fabrizio Castro
2018-03-02 14:23 ` Guenter Roeck
2018-03-02 14:51 ` Fabrizio Castro
2018-03-02 8:28 ` Sergei Shtylyov
2018-03-05 14:08 ` Fabrizio Castro
2018-03-05 14:39 ` Sergei Shtylyov
2018-03-01 18:17 ` [PATCH v7 2/3] watchdog: renesas_wdt: Add R-Car Gen2 support Fabrizio Castro
2018-03-01 19:41 ` Guenter Roeck
2018-03-01 20:22 ` Geert Uytterhoeven
2018-03-05 14:02 ` Fabrizio Castro
2018-03-01 18:17 ` [PATCH v7 3/3] watchdog: renesas_wdt: Add restart handler Fabrizio Castro
2018-03-01 20:19 ` Geert Uytterhoeven
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=20180301194101.GB29927@roeck-us.net \
--to=linux@roeck-us.net \
--cc=Chris.Paterson2@renesas.com \
--cc=biju.das@bp.renesas.com \
--cc=fabrizio.castro@bp.renesas.com \
--cc=geert+renesas@glider.be \
--cc=horms@verge.net.au \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=ramesh.shanmugasundaram@bp.renesas.com \
--cc=wim@iguana.be \
--cc=wsa+renesas@sang-engineering.com \
/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