mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Cc: Kieran Bingham <kieran.bingham@ideasonboard.com>,
	Rui Miguel Silva <rmfrfs@gmail.com>,
	Martin Kepplinger <martink@posteo.de>,
	Purism Kernel Team <kernel@puri.sm>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	NXP Linux Team <linux-imx@nxp.com>,
	linux-media@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] media: imx-mipi-csis: Drop extra clock enable at probe()
Date: Wed, 22 Nov 2023 17:04:10 +0200	[thread overview]
Message-ID: <20231122150410.GF8627@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20231122-imx-csis-v1-2-0617368eb996@ideasonboard.com>

Hi Tomi,

Thank you for the patch.

On Wed, Nov 22, 2023 at 03:13:49PM +0200, Tomi Valkeinen wrote:
> The driver always enables the clocks at probe() and disables them only
> at remove(). It is not clear why the driver does this, as it supports
> runtime PM, and enables and disables the clocks in the runtime resume
> and suspend callbacks. Also, in the case runtime PM is not available,
> the driver calls the resume and suspend callbacks manually from probe()
> and remove().

Probably a historical mistake. It predates my involvement with the
driver :-)

> Drop the unnecessary clock enable, thus enabling the clocks only when
> actually needed.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/media/platform/nxp/imx-mipi-csis.c | 13 ++-----------
>  1 file changed, 2 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c
> index b39d7aeba750..b08f6d2e7516 100644
> --- a/drivers/media/platform/nxp/imx-mipi-csis.c
> +++ b/drivers/media/platform/nxp/imx-mipi-csis.c
> @@ -1435,24 +1435,18 @@ static int mipi_csis_probe(struct platform_device *pdev)
>  	/* Reset PHY and enable the clocks. */
>  	mipi_csis_phy_reset(csis);
>  
> -	ret = mipi_csis_clk_enable(csis);
> -	if (ret < 0) {
> -		dev_err(csis->dev, "failed to enable clocks: %d\n", ret);
> -		return ret;
> -	}
> -
>  	/* Now that the hardware is initialized, request the interrupt. */
>  	ret = devm_request_irq(dev, irq, mipi_csis_irq_handler, 0,
>  			       dev_name(dev), csis);
>  	if (ret) {
>  		dev_err(dev, "Interrupt request failed\n");
> -		goto err_disable_clock;
> +		return ret;
>  	}
>  
>  	/* Initialize and register the subdev. */
>  	ret = mipi_csis_subdev_init(csis);
>  	if (ret < 0)
> -		goto err_disable_clock;
> +		return ret;
>  
>  	platform_set_drvdata(pdev, &csis->sd);
>  
> @@ -1486,8 +1480,6 @@ static int mipi_csis_probe(struct platform_device *pdev)
>  	v4l2_async_nf_unregister(&csis->notifier);
>  	v4l2_async_nf_cleanup(&csis->notifier);
>  	v4l2_async_unregister_subdev(&csis->sd);
> -err_disable_clock:
> -	mipi_csis_clk_disable(csis);
>  
>  	return ret;
>  }
> @@ -1506,7 +1498,6 @@ static void mipi_csis_remove(struct platform_device *pdev)
>  		mipi_csis_runtime_suspend(&pdev->dev);
>  
>  	pm_runtime_disable(&pdev->dev);
> -	mipi_csis_clk_disable(csis);
>  	v4l2_subdev_cleanup(&csis->sd);
>  	media_entity_cleanup(&csis->sd.entity);
>  	pm_runtime_set_suspended(&pdev->dev);
> 

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2023-11-22 15:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-22 13:13 [PATCH 0/2] media: imx-mipi-csis: csis clock fixes Tomi Valkeinen
2023-11-22 13:13 ` [PATCH 1/2] media: imx-mipi-csis: Fix clock handling in remove() Tomi Valkeinen
2023-11-22 14:56   ` Laurent Pinchart
2023-11-22 13:13 ` [PATCH 2/2] media: imx-mipi-csis: Drop extra clock enable at probe() Tomi Valkeinen
2023-11-22 15:04   ` Laurent Pinchart [this message]
2023-11-22 13:21 ` [PATCH 0/2] media: imx-mipi-csis: csis clock fixes Fabio Estevam
2023-11-22 13:22   ` Tomi Valkeinen
2023-11-22 13:44   ` Tomi Valkeinen
2023-11-22 15:05     ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231122150410.GF8627@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=kernel@puri.sm \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=martink@posteo.de \
    --cc=mchehab@kernel.org \
    --cc=rmfrfs@gmail.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=tomi.valkeinen@ideasonboard.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®