All of lore.kernel.org
 help / color / mirror / Atom feed
From: Janusz Krzysztofik <jmkrzyszt@gmail.com>
To: linux-media@vger.kernel.org, Hans Verkuil <hverkuil@xs4all.nl>,
	Ezequiel Garcia <ezequiel@collabora.com>
Cc: kernel@collabora.com, Arnd Bergmann <arnd@arndb.de>,
	Robert Jarzmik <robert.jarzmik@free.fr>,
	Petr Cvek <petrcvekcz@gmail.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Ezequiel Garcia <ezequiel@collabora.com>
Subject: Re: [PATCH 5/6] media: ov6650: Use the generic clock framework
Date: Fri, 08 Jan 2021 12:42:34 +0100	[thread overview]
Message-ID: <12035174.VsHLxoZxqI@z50> (raw)
In-Reply-To: <20210104165739.116404-6-ezequiel@collabora.com>

On Monday, January 4, 2021 5:57:38 P.M. CET Ezequiel Garcia wrote:
> Commit ce548396a433 ("media: mach-omap1: board-ams-delta.c: remove soc_camera dependencies")
> removed the last in-tree user of this sensor. New users
> will be required to use the generic clock framework,
> so it's possible to convert the driver to use it.
> 
> Convert the driver to use the CCF, and drop the legacy
> v4l2-clk API.
> 
> Cc: Janusz Krzysztofik <jmkrzyszt@gmail.com>
> Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
> ---
>  drivers/media/i2c/ov6650.c | 26 +++++++++++---------------
>  1 file changed, 11 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/media/i2c/ov6650.c b/drivers/media/i2c/ov6650.c
> index d73f9f540932..0f8242054603 100644
> --- a/drivers/media/i2c/ov6650.c
> +++ b/drivers/media/i2c/ov6650.c
> @@ -22,13 +22,13 @@
>   */
>  
>  #include <linux/bitops.h>
> +#include <linux/clk.h>
>  #include <linux/delay.h>
>  #include <linux/i2c.h>
>  #include <linux/slab.h>
>  #include <linux/v4l2-mediabus.h>
>  #include <linux/module.h>
>  
> -#include <media/v4l2-clk.h>
>  #include <media/v4l2-ctrls.h>
>  #include <media/v4l2-device.h>
>  
> @@ -194,7 +194,7 @@ struct ov6650 {
>  		struct v4l2_ctrl *blue;
>  		struct v4l2_ctrl *red;
>  	};
> -	struct v4l2_clk		*clk;
> +	struct clk		*clk;
>  	bool			half_scale;	/* scale down output by 2 */
>  	struct v4l2_rect	rect;		/* sensor cropping window */
>  	struct v4l2_fract	tpf;		/* as requested with s_frame_interval */
> @@ -459,9 +459,9 @@ static int ov6650_s_power(struct v4l2_subdev *sd, int on)
>  	int ret = 0;
>  
>  	if (on)
> -		ret = v4l2_clk_enable(priv->clk);
> +		ret = clk_prepare_enable(priv->clk);
>  	else
> -		v4l2_clk_disable(priv->clk);
> +		clk_disable_unprepare(priv->clk);
>  
>  	return ret;
>  }
> @@ -821,14 +821,14 @@ static int ov6650_video_probe(struct v4l2_subdev *sd)
>  	u8 pidh, pidl, midh, midl;
>  	int i, ret = 0;
>  
> -	priv->clk = v4l2_clk_get(&client->dev, NULL);
> +	priv->clk = devm_clk_get(&client->dev, NULL);
>  	if (IS_ERR(priv->clk)) {
>  		ret = PTR_ERR(priv->clk);
> -		dev_err(&client->dev, "v4l2_clk request err: %d\n", ret);
> +		dev_err(&client->dev, "clk request err: %d\n", ret);
>  		return ret;
>  	}
>  
> -	rate = v4l2_clk_get_rate(priv->clk);
> +	rate = clk_get_rate(priv->clk);
>  	for (i = 0; rate && i < ARRAY_SIZE(ov6650_xclk); i++) {
>  		if (rate != ov6650_xclk[i].rate)
>  			continue;
> @@ -839,8 +839,8 @@ static int ov6650_video_probe(struct v4l2_subdev *sd)
>  		break;
>  	}
>  	for (i = 0; !xclk && i < ARRAY_SIZE(ov6650_xclk); i++) {
> -		ret = v4l2_clk_set_rate(priv->clk, ov6650_xclk[i].rate);
> -		if (ret || v4l2_clk_get_rate(priv->clk) != ov6650_xclk[i].rate)
> +		ret = clk_set_rate(priv->clk, ov6650_xclk[i].rate);
> +		if (ret || clk_get_rate(priv->clk) != ov6650_xclk[i].rate)
>  			continue;
>  
>  		xclk = &ov6650_xclk[i];
> @@ -852,12 +852,12 @@ static int ov6650_video_probe(struct v4l2_subdev *sd)
>  		dev_err(&client->dev, "unable to get supported clock rate\n");
>  		if (!ret)
>  			ret = -EINVAL;
> -		goto eclkput;
> +		return ret;
>  	}
>  
>  	ret = ov6650_s_power(sd, 1);
>  	if (ret < 0)
> -		goto eclkput;
> +		return ret;
>  
>  	msleep(20);
>  
> @@ -901,9 +901,6 @@ static int ov6650_video_probe(struct v4l2_subdev *sd)
>  	ov6650_s_power(sd, 0);
>  	if (!ret)
>  		return 0;

I think the above two lines are no longer needed and should be removed.  
Anyway,

Reviewed-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>

Thanks,
Janusz

> -eclkput:
> -	v4l2_clk_put(priv->clk);
> -
>  	return ret;
>  }
>  
> @@ -1089,7 +1086,6 @@ static int ov6650_remove(struct i2c_client *client)
>  {
>  	struct ov6650 *priv = to_ov6650(client);
>  
> -	v4l2_clk_put(priv->clk);
>  	v4l2_async_unregister_subdev(&priv->subdev);
>  	v4l2_ctrl_handler_free(&priv->hdl);
>  	return 0;
> 





  reply	other threads:[~2021-01-08 11:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-04 16:57 [PATCH 0/6] Remove last users of v4l2-clk and remove v4l2-clk Ezequiel Garcia
2021-01-04 16:57 ` [PATCH 1/6] media: mach-pxa: Register the camera sensor fixed-rate clock Ezequiel Garcia
2021-01-05 16:41   ` Petr Cvek
2021-01-06 15:53     ` Ezequiel Garcia
2021-01-08 11:02       ` Petr Cvek
2021-01-08 12:51         ` Ezequiel Garcia
2021-01-08 12:59   ` Arnd Bergmann
2021-01-04 16:57 ` [PATCH 2/6] media: pxa_camera: Drop the v4l2-clk clock register Ezequiel Garcia
2021-01-04 16:57 ` [PATCH 3/6] media: ov9640: Use the generic clock framework Ezequiel Garcia
2021-01-05 16:18   ` Petr Cvek
2021-01-06 14:18     ` Ezequiel Garcia
2021-01-04 16:57 ` [PATCH 4/6] media: mt9m111: " Ezequiel Garcia
2021-01-04 16:57 ` [PATCH 5/6] media: ov6650: " Ezequiel Garcia
2021-01-08 11:42   ` Janusz Krzysztofik [this message]
2021-01-04 16:57 ` [PATCH 6/6] media: Remove the legacy v4l2-clk API Ezequiel Garcia
2021-01-04 20:51 ` [PATCH 0/6] Remove last users of v4l2-clk and remove v4l2-clk Ezequiel Garcia
2021-01-05 16:08 ` Petr Cvek
2021-01-06 14:24   ` Ezequiel Garcia
2021-01-08 11:04     ` Petr Cvek

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=12035174.VsHLxoZxqI@z50 \
    --to=jmkrzyszt@gmail.com \
    --cc=arnd@arndb.de \
    --cc=ezequiel@collabora.com \
    --cc=hverkuil@xs4all.nl \
    --cc=kernel@collabora.com \
    --cc=linux-media@vger.kernel.org \
    --cc=petrcvekcz@gmail.com \
    --cc=robert.jarzmik@free.fr \
    --cc=sakari.ailus@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.