diff mbox series

[v4,8/9] watchdog: max77620: add comment to clarify set_timeout procedure

Message ID 20211120155707.4019487-9-luca@lucaceresoli.net (mailing list archive)
State Changes Requested
Headers show
Series Add MAX77714 PMIC minimal driver (RTC and watchdog only) | expand

Commit Message

Luca Ceresoli Nov. 20, 2021, 3:57 p.m. UTC
Clarify why we need to ping the watchdog before changing the timeout by
quoting the MAX77714 datasheet.

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>

---

This patch is new in v4. It adds a clarification comment to the max77620
driver taken from v3 patch 7.
---
 drivers/watchdog/max77620_wdt.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Guenter Roeck Nov. 29, 2021, 4:04 p.m. UTC | #1
On Sat, Nov 20, 2021 at 04:57:06PM +0100, Luca Ceresoli wrote:
> Clarify why we need to ping the watchdog before changing the timeout by
> quoting the MAX77714 datasheet.
> 

Unless I am missing something, this adds confusion instead of clarifying
anything, and it is misleading. The added comment in the code makes it
sound like clearing the watchdog timer is only needed for MAX77614.
However, the code was in place for MAX77620, suggesting that it was needed
for that chip as well and is not MAX77614 specific.

Please either drop this patch or rephrase it to clarify that it applies
to both chips.

Guenter

> Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
> ---
> 
> This patch is new in v4. It adds a clarification comment to the max77620
> driver taken from v3 patch 7.
> ---
>  drivers/watchdog/max77620_wdt.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/watchdog/max77620_wdt.c b/drivers/watchdog/max77620_wdt.c
> index 06b48295fab6..f082a4ea2c03 100644
> --- a/drivers/watchdog/max77620_wdt.c
> +++ b/drivers/watchdog/max77620_wdt.c
> @@ -132,6 +132,11 @@ static int max77620_wdt_set_timeout(struct watchdog_device *wdt_dev,
>  		break;
>  	}
>  
> +	/*
> +	 * "If the value of TWD needs to be changed, clear the system
> +	 * watchdog timer first [...], then change the value of TWD."
> +	 * (MAX77714 datasheet)
> +	 */
>  	ret = regmap_update_bits(wdt->rmap, wdt->drv_data->reg_cnfg_glbl3,
>  				 wdt->drv_data->wdtc_mask, 0x1);
>  	if (ret < 0)
Luca Ceresoli Nov. 29, 2021, 4:08 p.m. UTC | #2
Hi Guenter,

On 29/11/21 17:04, Guenter Roeck wrote:
> On Sat, Nov 20, 2021 at 04:57:06PM +0100, Luca Ceresoli wrote:
>> Clarify why we need to ping the watchdog before changing the timeout by
>> quoting the MAX77714 datasheet.
>>
> 
> Unless I am missing something, this adds confusion instead of clarifying
> anything, and it is misleading. The added comment in the code makes it
> sound like clearing the watchdog timer is only needed for MAX77614.
> However, the code was in place for MAX77620, suggesting that it was needed
> for that chip as well and is not MAX77614 specific.

You're right, the comment comes from the max77714-only driver, but now
that it is in a multi-chip  driver the confusion started to exist.

> Please either drop this patch or rephrase it to clarify that it applies
> to both chips.

What if I rephrase to:

	/*
	 * "If the value of TWD needs to be changed, clear the system
	 * watchdog timer first [...], then change the value of TWD."
-	 * (MAX77714 datasheet)
+	 * (MAX77714 datasheet but applies to MAX77620 too)
	 */

?
Guenter Roeck Nov. 29, 2021, 4:18 p.m. UTC | #3
On 11/29/21 8:08 AM, Luca Ceresoli wrote:
> Hi Guenter,
> 
> On 29/11/21 17:04, Guenter Roeck wrote:
>> On Sat, Nov 20, 2021 at 04:57:06PM +0100, Luca Ceresoli wrote:
>>> Clarify why we need to ping the watchdog before changing the timeout by
>>> quoting the MAX77714 datasheet.
>>>
>>
>> Unless I am missing something, this adds confusion instead of clarifying
>> anything, and it is misleading. The added comment in the code makes it
>> sound like clearing the watchdog timer is only needed for MAX77614.
>> However, the code was in place for MAX77620, suggesting that it was needed
>> for that chip as well and is not MAX77614 specific.
> 
> You're right, the comment comes from the max77714-only driver, but now
> that it is in a multi-chip  driver the confusion started to exist.
> 
>> Please either drop this patch or rephrase it to clarify that it applies
>> to both chips.
> 
> What if I rephrase to:
> 
> 	/*
> 	 * "If the value of TWD needs to be changed, clear the system
> 	 * watchdog timer first [...], then change the value of TWD."
> -	 * (MAX77714 datasheet)
> +	 * (MAX77714 datasheet but applies to MAX77620 too)
> 	 */
> 

Sounds good.

Guenter
diff mbox series

Patch

diff --git a/drivers/watchdog/max77620_wdt.c b/drivers/watchdog/max77620_wdt.c
index 06b48295fab6..f082a4ea2c03 100644
--- a/drivers/watchdog/max77620_wdt.c
+++ b/drivers/watchdog/max77620_wdt.c
@@ -132,6 +132,11 @@  static int max77620_wdt_set_timeout(struct watchdog_device *wdt_dev,
 		break;
 	}
 
+	/*
+	 * "If the value of TWD needs to be changed, clear the system
+	 * watchdog timer first [...], then change the value of TWD."
+	 * (MAX77714 datasheet)
+	 */
 	ret = regmap_update_bits(wdt->rmap, wdt->drv_data->reg_cnfg_glbl3,
 				 wdt->drv_data->wdtc_mask, 0x1);
 	if (ret < 0)