linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* watchdog: davinci_wdt: add possibility to configure watchdog period
@ 2018-07-16 12:19 michele.dionisio
  2018-07-16 12:19 ` michele.dionisio
  0 siblings, 1 reply; 5+ messages in thread
From: michele.dionisio @ 2018-07-16 12:19 UTC (permalink / raw)
  To: wim, linux, linux-watchdog, linux-kernel


Hi all, 
in davinci_wdt it is not possible to configure watchdog period. It is also
impossible to stop the watchdog so it is usefull to configure the watchdog 
before start it the first time. This patch add a module parameter to configure
the starting period before stat the watchdog (default behaviour is not changed).

I think it is a good idea to integrate this patch in mainline.

Many thanks for any comment/review and 
regards
Michele Dionisio


^ permalink raw reply	[flat|nested] 5+ messages in thread

* watchdog: davinci_wdt: add possibility to configure watchdog period
  2018-07-16 12:19 watchdog: davinci_wdt: add possibility to configure watchdog period michele.dionisio
@ 2018-07-16 12:19 ` michele.dionisio
  2018-07-16 13:31   ` Guenter Roeck
  0 siblings, 1 reply; 5+ messages in thread
From: michele.dionisio @ 2018-07-16 12:19 UTC (permalink / raw)
  To: wim, linux, linux-watchdog, linux-kernel
  Cc: Michele Dionisio, Michele Dionisio

From: Michele Dionisio <michele.dionisio@powersoft.com>

It is not possible to implement setting of watchdog period because it is
not possible to stop watchdog so it is nice to have possibility to
configure watchdog period at module loading.

Signed-off-by: Michele Dionisio <michele.dionisio@gmail.com>

diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c
index 6c6594261cb7..5f95afa20fee 100644
--- a/drivers/watchdog/davinci_wdt.c
+++ b/drivers/watchdog/davinci_wdt.c
@@ -54,6 +54,10 @@
 #define WDKEY_SEQ0		(0xa5c6 << 16)
 #define WDKEY_SEQ1		(0xda7e << 16)
 
+static unsigned int init_timeout;
+module_param(init_timeout, uint, 0);
+MODULE_PARM_DESC(init_timeout, "initial watchdog timeout (in seconds)");
+
 static int heartbeat;
 
 /*
@@ -223,8 +227,10 @@ static int davinci_wdt_probe(struct platform_device *pdev)
 	wdd->ops		= &davinci_wdt_ops;
 	wdd->min_timeout	= 1;
 	wdd->max_timeout	= MAX_HEARTBEAT;
-	wdd->timeout		= DEFAULT_HEARTBEAT;
-	wdd->parent		= &pdev->dev;
+	if ((init_timeout >= 1) && (init_timeout <= MAX_HEARTBEAT))
+		wdd->timeout = init_timeout;
+	else
+		wdd->timeout = DEFAULT_HEARTBEAT;
 
 	watchdog_init_timeout(wdd, heartbeat, dev);
 

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: watchdog: davinci_wdt: add possibility to configure watchdog period
  2018-07-16 12:19 ` michele.dionisio
@ 2018-07-16 13:31   ` Guenter Roeck
  2018-07-16 14:04     ` Michele Dionisio
  0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2018-07-16 13:31 UTC (permalink / raw)
  To: michele.dionisio, wim, linux-watchdog, linux-kernel; +Cc: Michele Dionisio

On 07/16/2018 05:19 AM, michele.dionisio@gmail.com wrote:
> From: Michele Dionisio <michele.dionisio@powersoft.com>
> 
> It is not possible to implement setting of watchdog period because it is
> not possible to stop watchdog so it is nice to have possibility to
> configure watchdog period at module loading.
> 
> Signed-off-by: Michele Dionisio <michele.dionisio@gmail.com>
> 
> diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c
> index 6c6594261cb7..5f95afa20fee 100644
> --- a/drivers/watchdog/davinci_wdt.c
> +++ b/drivers/watchdog/davinci_wdt.c
> @@ -54,6 +54,10 @@
>   #define WDKEY_SEQ0		(0xa5c6 << 16)
>   #define WDKEY_SEQ1		(0xda7e << 16)
>   
> +static unsigned int init_timeout;
> +module_param(init_timeout, uint, 0);
> +MODULE_PARM_DESC(init_timeout, "initial watchdog timeout (in seconds)");
> +
>   static int heartbeat;
>   
>   /*
> @@ -223,8 +227,10 @@ static int davinci_wdt_probe(struct platform_device *pdev)
>   	wdd->ops		= &davinci_wdt_ops;
>   	wdd->min_timeout	= 1;
>   	wdd->max_timeout	= MAX_HEARTBEAT;
> -	wdd->timeout		= DEFAULT_HEARTBEAT;
> -	wdd->parent		= &pdev->dev;
> +	if ((init_timeout >= 1) && (init_timeout <= MAX_HEARTBEAT))
> +		wdd->timeout = init_timeout;
> +	else
> +		wdd->timeout = DEFAULT_HEARTBEAT;
>   
>   	watchdog_init_timeout(wdd, heartbeat, dev);
>   

NACK. This is done with the 'heartbeat' module parameter already.

Guenter



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: watchdog: davinci_wdt: add possibility to configure watchdog period
  2018-07-16 13:31   ` Guenter Roeck
@ 2018-07-16 14:04     ` Michele Dionisio
  2018-07-16 14:12       ` Guenter Roeck
  0 siblings, 1 reply; 5+ messages in thread
From: Michele Dionisio @ 2018-07-16 14:04 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: wim, linux-watchdog, linux-kernel, Michele Dionisio

I have done what are already done in:
omap_wdt.c with parameter timer_margin
softdog.c with parameter softMargin
...

the same feature is missing in davinci_wdt and I think is quite usefull.

if you NACK because I don't use watchdog_init_timeout I can rewrite
the code but I do that to reduce the number of changes done in one
commit
Il giorno lun 16 lug 2018 alle ore 15:31 Guenter Roeck
<linux@roeck-us.net> ha scritto:
>
> On 07/16/2018 05:19 AM, michele.dionisio@gmail.com wrote:
> > From: Michele Dionisio <michele.dionisio@powersoft.com>
> >
> > It is not possible to implement setting of watchdog period because it is
> > not possible to stop watchdog so it is nice to have possibility to
> > configure watchdog period at module loading.
> >
> > Signed-off-by: Michele Dionisio <michele.dionisio@gmail.com>
> >
> > diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c
> > index 6c6594261cb7..5f95afa20fee 100644
> > --- a/drivers/watchdog/davinci_wdt.c
> > +++ b/drivers/watchdog/davinci_wdt.c
> > @@ -54,6 +54,10 @@
> >   #define WDKEY_SEQ0          (0xa5c6 << 16)
> >   #define WDKEY_SEQ1          (0xda7e << 16)
> >
> > +static unsigned int init_timeout;
> > +module_param(init_timeout, uint, 0);
> > +MODULE_PARM_DESC(init_timeout, "initial watchdog timeout (in seconds)");
> > +
> >   static int heartbeat;
> >
> >   /*
> > @@ -223,8 +227,10 @@ static int davinci_wdt_probe(struct platform_device *pdev)
> >       wdd->ops                = &davinci_wdt_ops;
> >       wdd->min_timeout        = 1;
> >       wdd->max_timeout        = MAX_HEARTBEAT;
> > -     wdd->timeout            = DEFAULT_HEARTBEAT;
> > -     wdd->parent             = &pdev->dev;
> > +     if ((init_timeout >= 1) && (init_timeout <= MAX_HEARTBEAT))
> > +             wdd->timeout = init_timeout;
> > +     else
> > +             wdd->timeout = DEFAULT_HEARTBEAT;
> >
> >       watchdog_init_timeout(wdd, heartbeat, dev);
> >
>
> NACK. This is done with the 'heartbeat' module parameter already.
>
> Guenter
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: watchdog: davinci_wdt: add possibility to configure watchdog period
  2018-07-16 14:04     ` Michele Dionisio
@ 2018-07-16 14:12       ` Guenter Roeck
  0 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2018-07-16 14:12 UTC (permalink / raw)
  To: Michele Dionisio; +Cc: wim, linux-watchdog, linux-kernel, Michele Dionisio

On 07/16/2018 07:04 AM, Michele Dionisio wrote:
> I have done what are already done in:
> omap_wdt.c with parameter timer_margin
> softdog.c with parameter softMargin
> ...
> 
> the same feature is missing in davinci_wdt and I think is quite usefull.
> 
> if you NACK because I don't use watchdog_init_timeout I can rewrite
> the code but I do that to reduce the number of changes done in one
> commit

Did you read my comment ? Did you try to use the existing "heartbeat"
module parameter ?

If that doesn't work for some reason, lets fix it. Introducing another
module parameter with a different name because the first one doesn't work
simply does not make sense.

Guenter

> Il giorno lun 16 lug 2018 alle ore 15:31 Guenter Roeck
> <linux@roeck-us.net> ha scritto:
>>
>> On 07/16/2018 05:19 AM, michele.dionisio@gmail.com wrote:
>>> From: Michele Dionisio <michele.dionisio@powersoft.com>
>>>
>>> It is not possible to implement setting of watchdog period because it is
>>> not possible to stop watchdog so it is nice to have possibility to
>>> configure watchdog period at module loading.
>>>
>>> Signed-off-by: Michele Dionisio <michele.dionisio@gmail.com>
>>>
>>> diff --git a/drivers/watchdog/davinci_wdt.c b/drivers/watchdog/davinci_wdt.c
>>> index 6c6594261cb7..5f95afa20fee 100644
>>> --- a/drivers/watchdog/davinci_wdt.c
>>> +++ b/drivers/watchdog/davinci_wdt.c
>>> @@ -54,6 +54,10 @@
>>>    #define WDKEY_SEQ0          (0xa5c6 << 16)
>>>    #define WDKEY_SEQ1          (0xda7e << 16)
>>>
>>> +static unsigned int init_timeout;
>>> +module_param(init_timeout, uint, 0);
>>> +MODULE_PARM_DESC(init_timeout, "initial watchdog timeout (in seconds)");
>>> +
>>>    static int heartbeat;
>>>
>>>    /*
>>> @@ -223,8 +227,10 @@ static int davinci_wdt_probe(struct platform_device *pdev)
>>>        wdd->ops                = &davinci_wdt_ops;
>>>        wdd->min_timeout        = 1;
>>>        wdd->max_timeout        = MAX_HEARTBEAT;
>>> -     wdd->timeout            = DEFAULT_HEARTBEAT;
>>> -     wdd->parent             = &pdev->dev;
>>> +     if ((init_timeout >= 1) && (init_timeout <= MAX_HEARTBEAT))
>>> +             wdd->timeout = init_timeout;
>>> +     else
>>> +             wdd->timeout = DEFAULT_HEARTBEAT;
>>>
>>>        watchdog_init_timeout(wdd, heartbeat, dev);
>>>
>>
>> NACK. This is done with the 'heartbeat' module parameter already.
>>
>> Guenter
>>
>>
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-07-16 14:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-16 12:19 watchdog: davinci_wdt: add possibility to configure watchdog period michele.dionisio
2018-07-16 12:19 ` michele.dionisio
2018-07-16 13:31   ` Guenter Roeck
2018-07-16 14:04     ` Michele Dionisio
2018-07-16 14:12       ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).