From: Guenter Roeck <linux@roeck-us.net>
To: Brian Norris <briannorris@chromium.org>,
Wim Van Sebroeck <wim@linux-watchdog.org>
Cc: linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org,
Doug Anderson <dianders@chromium.org>,
Matthias Kaehlcke <mka@chromium.org>
Subject: Re: [PATCH 2/2] watchdog: dw: save/restore control and timeout across suspend/resume
Date: Fri, 9 Mar 2018 19:22:46 -0800 [thread overview]
Message-ID: <9a79920c-71a6-d609-aefc-15b92802a3ed@roeck-us.net> (raw)
In-Reply-To: <20180310024431.160195-2-briannorris@chromium.org>
On 03/09/2018 06:44 PM, Brian Norris wrote:
> Some platforms lose this state in suspend. It should be safe to do this
> unconditionally.
>
> Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/dw_wdt.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
> index 6925d3e6c6b3..094986047194 100644
> --- a/drivers/watchdog/dw_wdt.c
> +++ b/drivers/watchdog/dw_wdt.c
> @@ -57,6 +57,9 @@ struct dw_wdt {
> unsigned long rate;
> struct watchdog_device wdd;
> struct reset_control *rst;
> + /* Save/restore */
> + u32 control;
> + u32 timeout;
> };
>
> #define to_dw_wdt(wdd) container_of(wdd, struct dw_wdt, wdd)
> @@ -204,6 +207,9 @@ static int dw_wdt_suspend(struct device *dev)
> {
> struct dw_wdt *dw_wdt = dev_get_drvdata(dev);
>
> + dw_wdt->control = readl(dw_wdt->regs + WDOG_CONTROL_REG_OFFSET);
> + dw_wdt->timeout = readl(dw_wdt->regs + WDOG_TIMEOUT_RANGE_REG_OFFSET);
> +
> clk_disable_unprepare(dw_wdt->clk);
>
> return 0;
> @@ -217,6 +223,9 @@ static int dw_wdt_resume(struct device *dev)
> if (err)
> return err;
>
> + writel(dw_wdt->timeout, dw_wdt->regs + WDOG_TIMEOUT_RANGE_REG_OFFSET);
> + writel(dw_wdt->control, dw_wdt->regs + WDOG_CONTROL_REG_OFFSET);
> +
> dw_wdt_ping(&dw_wdt->wdd);
>
> return 0;
>
next prev parent reply other threads:[~2018-03-10 3:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-10 2:44 [PATCH 1/2] watchdog: dw: RMW the control register Brian Norris
2018-03-10 2:44 ` [PATCH 2/2] watchdog: dw: save/restore control and timeout across suspend/resume Brian Norris
2018-03-10 3:22 ` Guenter Roeck [this message]
2018-03-10 2:47 ` [PATCH 1/2] watchdog: dw: RMW the control register Brian Norris
2018-03-10 3:20 ` Guenter Roeck
2018-03-10 3:28 ` Brian Norris
2018-03-10 4:02 ` Guenter Roeck
2018-03-10 5:04 ` Brian Norris
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=9a79920c-71a6-d609-aefc-15b92802a3ed@roeck-us.net \
--to=linux@roeck-us.net \
--cc=briannorris@chromium.org \
--cc=dianders@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=mka@chromium.org \
--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
all inboxes | Powered by JetHome®