Re: [PATCH v2] watchdog: qcom: fine tune the max timeout value calculation

From: gituser
Date: Sun Mar 03 2024 - 08:36:05 EST


Ji Kathiravan,

>
> On 2/3/2024 12:07 PM, Kathiravan Thirumoorthy wrote:
> >
> >
> >On 1/16/2024 8:32 PM, Guenter Roeck wrote:
> >>On 1/16/24 00:22, Kathiravan Thirumoorthy wrote:
> >>>To determine the max_timeout value, the below calculation is used.
> >>>
> >>>    max_timeout = 0x10000000 / clk_rate
> >>>
> >>>cat /sys/devices/platform/soc@0/b017000.watchdog/watchdog/watchdog0/max_timeout
> >>>8388
> >>>
> >>>However, this is not valid for all the platforms. IPQ SoCs starting from
> >>>IPQ40xx and recent Snapdragron SoCs also has the bark and bite
> >>>time field
> >>>length of 20bits, which can hold max up to 32 seconds if the clk_rate is
> >>>32KHz.
> >>>
> >>>If the user tries to configure the timeout more than 32s, then the value
> >>>will be truncated and the actual value will not be reflected in the HW.
> >>>
> >>>To avoid this, lets add a variable called max_tick_count in
> >>>the device data,
> >>>which defines max counter value of the WDT controller. Using
> >>>this, max-timeout
> >>>will be calculated in runtime for various WDT contorllers.
> >>>
> >>>With this change, we get the proper max_timeout as below and restricts
> >>>the user from configuring the timeout higher than this.
> >>>
> >>>cat /sys/devices/platform/soc@0/b017000.watchdog/watchdog/watchdog0/max_timeout
> >>>32
> >>>
> >>>Signed-off-by: Kathiravan Thirumoorthy <quic_kathirav@xxxxxxxxxxx>
> >>
> >>Reviewed-by: Guenter Roeck <linux@xxxxxxxxxxxx>
> >
> >
> >Guenter / Will, Can this be picked for v6.9? I don't see this in
> >linux- next yet, so please consider this as a gentle reminder!
>
>
> Guenter / Will, Gentle Reminder... is this change queued for v6.9?

Yes, it is.

Kind regards,
Wim.