Re: [PATCH v4 2/2] watchdog: dw_wdt: manage reset line during system suspend/resume

From: Artem Shimko

Date: Sun Oct 25 2026 - 10:36:48 EST


Hi Igor,


On Sat, Oct 24, 2026 at 9:46 PM Igor Velkov <iav@xxxxxx> wrote:
>
> On Sat, Oct 24, 2026 at 05:08:51PM +0300, Artem Shimko wrote:
> > err = clk_prepare_enable(dw_wdt->pclk);
> > - if (err) {
> > - clk_disable_unprepare(dw_wdt->clk);
> > - return err;
> > - }
> > + if (err)
> > + goto unprepare_clk;
> > +
> > + err = reset_control_deassert(dw_wdt->rst);
> > + if (err)
> > + goto unprepare_pclk;
>
> If clk_prepare_enable() fails in dw_wdt_resume(), we return with the reset
> still asserted. The _deasserted devres then asserts it once more at unbind,
> and on a shared control with deassert_count already at 0 that is a WARN_ON
> and -EINVAL; the next suspend hits the same. Deasserting before the clocks
> are enabled (or on the error paths) keeps every exit balanced.
> Not tested on hardware: I can't make the clock enable fail.

Agreed.

I’ve examined several drivers [1][2], and it is indeed normal for the reset
to be deasserted before the clocks are enabled during the resume.

There is also no requirement that the reset be deasserted after the
clocks for dw_wdt.

I think we can move the reset deassert before the clock enables.

Let's wait a couple of days to get comments from other folks before sending v5.

[1] drivers/usb/dwc3/core.c
[2] drivers/gpu/drm/panfrost/panfrost_device.c

Thank you for testing and review =)

--
Best regards,
Artem