Re: [PATCH 1/2] drivers: rtc: add max313xx series rtc driver

From: Guenter Roeck
Date: Thu Oct 20 2022 - 14:57:46 EST


On 10/20/22 07:47, Tilki, Ibrahim wrote:
...

+
+static int max313xx_wdt_ping(struct watchdog_device *wdd)
+{
+ int ret;
+
+ ret = max313xx_wdt_stop(wdd);
+ if (ret)
+ return ret;
+
+ return max313xx_wdt_start(wdd);

Having to stop a watchdog just to ping it is unusual. Is this really
necessary ?


Unfortunately RTCs do not have any other way of resetting timer counter
other than restarting the timer.


That is a bit too generic. I sampled a couple of rtc drivers implementing
watchdog support, and they all support pinging the watchdog without
stopping it (or, in other words, they have explicit watchdog support).

Looking at one of the chip datasheets, I would argue that the timers
on that chip series are not really suitable (nor intended) to support
watchdog functionality. They are real time alarm timers. They don't
generate an alarm N seconds in the future, but at specific times/dates.
That means that updating the time would interfere with watchdog functionality.
That is way too fragile to be usable as watchdog timer.

I would suggest to drop watchdog support from this driver.

Thanks,
Guenter