RE: [PATCH v1] watchdog: imx2_wdt: clear WDOG_HW_RUNNING before suspend

From: Robin Gong
Date: Wed May 12 2021 - 23:49:32 EST


On 5/12/21 22:15 Guenter Roeck <groeck7@xxxxxxxxx> wrote:
> We can not assume that the situation is exactly the same for all drivers and
> use a core flag to indicate some driver specific state just to avoid a
> driver-internal flag.
>
> Either case, it looks like you are saying that the watchdog can be stopped after
> all, by disabling its clock.
>
> > BTW, for i.mx2_wdt which watchdog can't be stop unless kernel enter
> > into suspend, that seems like watchdog stop after suspend and clear
> > WDOG_HW_RUNNING makes sense?
> >
>
> Yes, if you make it official and add a stop function which disables the
> watchdog by stopping its clock. Then the driver should not set
> WDOG_HW_RUNNING in the first place, and use the normal mechanisms to
> start and stop the watchdog.
> That would include starting the clock in the start function, and stopping it in
> the stop function.
>
Sorry, watchdog can't be stopped by disabling clock. The only way to stop watchdog
is SOC enter Deep Sleep Mode(suspend) and stopped by HW, so the suspend flow
looks like 'watchdog stop' which I though WDOG_HW_RUNNING makes sense.
Okay, I will use internal flag instead of WDOG_HW_RUNNING in v2, thanks.