[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZQQr8LdOpALMIant@aptenodytes>
Date: Fri, 15 Sep 2023 12:03:28 +0200
From: Paul Kocialkowski <paul.kocialkowski@...tlin.com>
To: Jernej Skrabec <jernej.skrabec@...il.com>
Cc: mripard@...nel.org, mchehab@...nel.org, gregkh@...uxfoundation.org,
wens@...e.org, samuel@...lland.org, linux-media@...r.kernel.org,
linux-staging@...ts.linux.dev,
linux-arm-kernel@...ts.infradead.org, linux-sunxi@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] media: cedrus: Fix clock/reset sequence
Hi Jernej,
On Mon 11 Sep 23, 20:46, Jernej Skrabec wrote:
> According to H6 user manual, resets should always be de-asserted before
> clocks are enabled. This is also consistent with vendor driver.
You're right, thanks for the patch!
Acked-by: Paul Kocialkowski <paul.kocialkowski@...tlin.com>
Cheers,
Paul
> Fixes: d5aecd289bab ("media: cedrus: Implement runtime PM")
> Signed-off-by: Jernej Skrabec <jernej.skrabec@...il.com>
> ---
> .../staging/media/sunxi/cedrus/cedrus_hw.c | 24 +++++++++----------
> 1 file changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
> index b696bf884cbd..32af0e96e762 100644
> --- a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
> +++ b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
> @@ -172,12 +172,12 @@ int cedrus_hw_suspend(struct device *device)
> {
> struct cedrus_dev *dev = dev_get_drvdata(device);
>
> - reset_control_assert(dev->rstc);
> -
> clk_disable_unprepare(dev->ram_clk);
> clk_disable_unprepare(dev->mod_clk);
> clk_disable_unprepare(dev->ahb_clk);
>
> + reset_control_assert(dev->rstc);
> +
> return 0;
> }
>
> @@ -186,11 +186,18 @@ int cedrus_hw_resume(struct device *device)
> struct cedrus_dev *dev = dev_get_drvdata(device);
> int ret;
>
> + ret = reset_control_reset(dev->rstc);
> + if (ret) {
> + dev_err(dev->dev, "Failed to apply reset\n");
> +
> + return ret;
> + }
> +
> ret = clk_prepare_enable(dev->ahb_clk);
> if (ret) {
> dev_err(dev->dev, "Failed to enable AHB clock\n");
>
> - return ret;
> + goto err_rst;
> }
>
> ret = clk_prepare_enable(dev->mod_clk);
> @@ -207,21 +214,14 @@ int cedrus_hw_resume(struct device *device)
> goto err_mod_clk;
> }
>
> - ret = reset_control_reset(dev->rstc);
> - if (ret) {
> - dev_err(dev->dev, "Failed to apply reset\n");
> -
> - goto err_ram_clk;
> - }
> -
> return 0;
>
> -err_ram_clk:
> - clk_disable_unprepare(dev->ram_clk);
> err_mod_clk:
> clk_disable_unprepare(dev->mod_clk);
> err_ahb_clk:
> clk_disable_unprepare(dev->ahb_clk);
> +err_rst:
> + reset_control_assert(dev->rstc);
>
> return ret;
> }
> --
> 2.42.0
>
--
Paul Kocialkowski, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists