[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5d6aaac5-0ce2-cf54-61fa-cfbc3f6bc0b3@roeck-us.net>
Date: Fri, 24 Jul 2020 07:32:43 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Chris Packham <chris.packham@...iedtelesis.co.nz>,
a.zummo@...ertech.it, alexandre.belloni@...tlin.com
Cc: linux-rtc@...r.kernel.org, linux-watchdog@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] rtc: ds1307: provide an indication that the watchdog has
fired
On 7/23/20 9:50 PM, Chris Packham wrote:
> There's not much feedback when the ds1388 watchdog fires. Generally it
> yanks on the reset line and the board reboots. To provide some feedback
> indicate that the watchdog has fired in the past. This should help
> distinguish a watchdog triggered reset from a power interruption.
>
> Signed-off-by: Chris Packham <chris.packham@...iedtelesis.co.nz>
> ---
> drivers/rtc/rtc-ds1307.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
> index 49702942bb08..431b1a50c483 100644
> --- a/drivers/rtc/rtc-ds1307.c
> +++ b/drivers/rtc/rtc-ds1307.c
> @@ -868,6 +868,14 @@ static int ds1388_wdt_start(struct watchdog_device *wdt_dev)
> struct ds1307 *ds1307 = watchdog_get_drvdata(wdt_dev);
> u8 regs[2];
> int ret;
> + int val;
> +
> + ret = regmap_read(ds1307->regmap, DS1388_REG_FLAG, &val);
> + if (ret)
> + return ret;
> +
> + if (val & DS1388_BIT_WF)
> + dev_notice(ds1307->dev, "detected watchdog alarm flag\n");
>
> ret = regmap_update_bits(ds1307->regmap, DS1388_REG_FLAG,
> DS1388_BIT_WF, 0);
>
This should be reported with WDIOC_GETBOOTSTATUS / WDIOF_CARDRESET,
not as log message when starting the watchdog.
Guenter
Powered by blists - more mailing lists