On Tue, 5 Jul 2022 at 21:56, Rob Herring <robh@xxxxxxxxxx> wrote: > > On Mon, Jul 04, 2022 at 01:05:04PM +0200, Isaac True wrote: > > On Fri, 1 Jul 2022 at 19:48, Guenter Roeck <linux@xxxxxxxxxxxx> wrote: > > > > > > On 7/1/22 10:18, Rob Herring wrote: > > > > On Wed, Jun 29, 2022 at 01:06:26PM +0200, Isaac True wrote: > > > >> Add the "min_hw_margin_ms" parameter to gpio_wdt devices, allowing a > > > >> minimum interval to be specified, stopping watchdog devices from being > > > >> fed too quickly if they require a certain interval between feeds. > > > > > > > > I assume there is some real platform with a real problem you are trying > > > > to solve? Details please. > > > > > > > > > > Agreed, this should be explained in more detail. > > > > Yes this is a real platform using a TI TPS3850 watchdog chip. With > > this chip you can configure a "window" which can detect early faults > > (i.e. too frequent) in addition to the standard watchdog features. I > > needed to add this minimum timeout to avoid watchdog resets in > > situations such as where first U-Boot and then the Linux kernel feed > > the watchdog with too short of an interval between them, or when > > systemd was configured to use the watchdog device and was feeding it > > too soon after taking over from the kernel. > > > > > > Can you just hardcode some min? Maybe 10% of the max or something. Is > > > > there a downside to a larger than necessary min? > > > > > > > > > > That would result in extra overhead in the watchdog core which would not > > > be required for all other hardware using this driver. I'd rather avoid that. > > > > > > > In the case of the TI TPS3850, the minimum timeout is configurable, so > > I didn't want to add a hard-coded value to the driver. > > > > > > Wouldn't be better to fix this without requiring a DT change and that > > > > could work on stable kernels if needed. > > > > > > > > > > Presumably that is some new hardware. Most of the watchdog drivers > > > needing this value can derive it from the compatible property. The > > > gpio watchdog driver is a bit different since it is supposed to work > > > on a variety of hardware using gpio pins for watchdog control. > > > > > > > Yes this is new hardware. This use case is also not very common as > > most watchdog chips don't have this window function or a minimum > > interval, at least in my experience, so I did not want to make it the > > default for everything. > > Okay. However the existing property you copied has 2 problems. It uses > underscores rather than hypens and doesn't use a standard unit suffix. > So 'min-hw-margin-ms'. > > Though maybe a new property instead: > > timeout-range-ms = <min max>; > > That's somewhat aligned to 'timeout-sec', and IMO, clearer meaning than > 'hw margin'. > > Rob I agree that both the original property name and the new one aren't great, but I didn't want to go changing the existing property for everyone. I could definitely add a new "timeout-range-ms" property - should that be added in parallel to the original hw_margin_ms (i.e. you can use one or the other), or completely replace the original?