Re: [PATCH v2 2/3] watchdog: Add ChromeOS EC-based watchdog driver
From: Tzung-Bi Shih
Date: Fri Jan 19 2024 - 00:28:49 EST
On Thu, Jan 18, 2024 at 07:55:39PM -0800, Guenter Roeck wrote:
> On 1/18/24 19:42, Tzung-Bi Shih wrote:
> > On Thu, Jan 18, 2024 at 07:53:23PM +0000, Lukasz Majczak wrote:
> > > diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> > > index 7d22051b15a2..4700b218340f 100644
> > > --- a/drivers/watchdog/Kconfig
> > > +++ b/drivers/watchdog/Kconfig
> > > @@ -181,6 +181,17 @@ config BD957XMUF_WATCHDOG
> > > watchdog. Alternatively say M to compile the driver as a module,
> > > which will be called bd9576_wdt.
> > > +config CROS_EC_WATCHDOG
> > > + tristate "ChromeOS EC-based watchdog"
> > > + select WATCHDOG_CORE
> > > + depends on CROS_EC
> > > + help
> > > + Watchdog driver for Chromebook devices equipped with embedded controller.
> > > + Trigger event is recorded in EC and checked on the subsequent boot.
> >
> > Perhaps unrelated to the patch, but I'm curious what the mechanism is. Does
> > it use any existing paths for checking the saved events in EC? What it does
> > if there is a saved WDT reset event?
> >
>
> Reporting the reason of the previous reset/restart is part of the watchdog API.
Oh, I see. It is in cros_ec_wdt_probe(): `wdd->bootstatus`.
+static int cros_ec_wdt_probe(struct platform_device *pdev)
+{
[...]
+ arg.req.command = EC_HANG_DETECT_CMD_GET_STATUS;
+ ret = cros_ec_wdt_send_cmd(cros_ec, &arg);
[...]
+ if (arg.resp.status == EC_HANG_DETECT_AP_BOOT_EC_WDT)
+ wdd->bootstatus = WDIOF_CARDRESET;