2022-04-22 22:47:40

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH 3/7] watchdog: npcm: Enable clock if provided

On Fri, Apr 22, 2022 at 08:30:08PM +0200, Jonathan Neusch?fer wrote:
> On the Nuvoton WPCM450 SoC, with its upcoming clock driver, peripheral
> clocks are individually gated and ungated. Therefore, the watchdog
> driver must be able to ungate the watchdog clock.
>
> Signed-off-by: Jonathan Neusch?fer <[email protected]>
> ---
> drivers/watchdog/npcm_wdt.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/watchdog/npcm_wdt.c b/drivers/watchdog/npcm_wdt.c
> index 28a24caa2627c..6d27f0e16188e 100644
> --- a/drivers/watchdog/npcm_wdt.c
> +++ b/drivers/watchdog/npcm_wdt.c
> @@ -3,6 +3,7 @@
> // Copyright (c) 2018 IBM Corp.
>
> #include <linux/bitops.h>
> +#include <linux/clk.h>
> #include <linux/delay.h>
> #include <linux/interrupt.h>
> #include <linux/kernel.h>
> @@ -180,6 +181,7 @@ static int npcm_wdt_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> struct npcm_wdt *wdt;
> + struct clk *clk;
> int irq;
> int ret;
>
> @@ -191,6 +193,13 @@ static int npcm_wdt_probe(struct platform_device *pdev)
> if (IS_ERR(wdt->reg))
> return PTR_ERR(wdt->reg);
>
> + clk = devm_clk_get_optional(&pdev->dev, NULL);
> + if (IS_ERR(clk))
> + return PTR_ERR(clk);
> +
> + if (clk)
> + clk_prepare_enable(clk);
> +

This needs a matching clk_disable_unprepare().

Guenter


2022-04-28 13:51:38

by Jonathan Neuschäfer

[permalink] [raw]
Subject: Re: [PATCH 3/7] watchdog: npcm: Enable clock if provided

On Fri, Apr 22, 2022 at 11:34:17AM -0700, Guenter Roeck wrote:
> On Fri, Apr 22, 2022 at 08:30:08PM +0200, Jonathan Neuschäfer wrote:
> > On the Nuvoton WPCM450 SoC, with its upcoming clock driver, peripheral
> > clocks are individually gated and ungated. Therefore, the watchdog
> > driver must be able to ungate the watchdog clock.
> >
> > Signed-off-by: Jonathan Neuschäfer <[email protected]>
> > ---
> > drivers/watchdog/npcm_wdt.c | 9 +++++++++
> > 1 file changed, 9 insertions(+)
> >
> > diff --git a/drivers/watchdog/npcm_wdt.c b/drivers/watchdog/npcm_wdt.c
> > index 28a24caa2627c..6d27f0e16188e 100644
> > --- a/drivers/watchdog/npcm_wdt.c
> > +++ b/drivers/watchdog/npcm_wdt.c
> > @@ -3,6 +3,7 @@
> > // Copyright (c) 2018 IBM Corp.
> >
> > #include <linux/bitops.h>
> > +#include <linux/clk.h>
> > #include <linux/delay.h>
> > #include <linux/interrupt.h>
> > #include <linux/kernel.h>
> > @@ -180,6 +181,7 @@ static int npcm_wdt_probe(struct platform_device *pdev)
> > {
> > struct device *dev = &pdev->dev;
> > struct npcm_wdt *wdt;
> > + struct clk *clk;
> > int irq;
> > int ret;
> >
> > @@ -191,6 +193,13 @@ static int npcm_wdt_probe(struct platform_device *pdev)
> > if (IS_ERR(wdt->reg))
> > return PTR_ERR(wdt->reg);
> >
> > + clk = devm_clk_get_optional(&pdev->dev, NULL);
> > + if (IS_ERR(clk))
> > + return PTR_ERR(clk);
> > +
> > + if (clk)
> > + clk_prepare_enable(clk);
> > +
>
> This needs a matching clk_disable_unprepare().

Good point. It's probably easiest if I move the clk calls to the
watchdog start/stop callbacks, then.


Thanks,
Jonathan


Attachments:
(No filename) (1.62 kB)
signature.asc (849.00 B)
Download all attachments