All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Jacopo Mondi <jacopo@jmondi.org>
Cc: Chiranjeevi Rapolu <chiranjeevi.rapolu@intel.com>,
	krzysztof.kozlowski@canonical.com,
	jeanmichel.hautbois@ideasonboard.com,
	paul.kocialkowski@bootlin.com, sakari.ailus@iki.fi,
	paul.elder@ideasonboard.com,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	"open list:OMNIVISION OV5670 SENSOR DRIVER" 
	<linux-media@vger.kernel.org>
Subject: Re: [PATCH v2 7/8] media: i2c: ov5670: Implement init_cfg
Date: Tue, 15 Mar 2022 10:13:43 +0200	[thread overview]
Message-ID: <YjBKtxTdwrf8cp+O@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20220314162714.153970-8-jacopo@jmondi.org>

Hi Jacopo,

Thank you for the patch.

On Mon, Mar 14, 2022 at 05:27:13PM +0100, Jacopo Mondi wrote:
> Implement the .init_cfg() pad operation and initialize the default
> format.
> 
> With .init_cfg() pad operation implemented the deprecated .open()
> internal operation can now be dropped.
> 
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>

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

> ---
>  drivers/media/i2c/ov5670.c | 46 +++++++++++++++++---------------------
>  1 file changed, 20 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/media/i2c/ov5670.c b/drivers/media/i2c/ov5670.c
> index c3f773524d5f..9aa82774f8a6 100644
> --- a/drivers/media/i2c/ov5670.c
> +++ b/drivers/media/i2c/ov5670.c
> @@ -1958,27 +1958,6 @@ static int ov5670_write_reg_list(struct ov5670 *ov5670,
>  	return ov5670_write_regs(ov5670, r_list->regs, r_list->num_of_regs);
>  }
>  
> -/* Open sub-device */
> -static int ov5670_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
> -{
> -	struct ov5670 *ov5670 = to_ov5670(sd);
> -	struct v4l2_mbus_framefmt *try_fmt =
> -				v4l2_subdev_get_try_format(sd, fh->state, 0);
> -
> -	mutex_lock(&ov5670->mutex);
> -
> -	/* Initialize try_fmt */
> -	try_fmt->width = ov5670->cur_mode->width;
> -	try_fmt->height = ov5670->cur_mode->height;
> -	try_fmt->code = MEDIA_BUS_FMT_SGRBG10_1X10;
> -	try_fmt->field = V4L2_FIELD_NONE;
> -
> -	/* No crop or compose */
> -	mutex_unlock(&ov5670->mutex);
> -
> -	return 0;
> -}
> -
>  static int ov5670_update_digital_gain(struct ov5670 *ov5670, u32 d_gain)
>  {
>  	int ret;
> @@ -2178,6 +2157,25 @@ static int ov5670_init_controls(struct ov5670 *ov5670)
>  	return ret;
>  }
>  
> +static int ov5670_init_cfg(struct v4l2_subdev *sd,
> +			   struct v4l2_subdev_state *state)
> +{
> +	struct v4l2_mbus_framefmt *fmt =
> +				v4l2_subdev_get_try_format(sd, state, 0);
> +	const struct ov5670_mode *default_mode = &supported_modes[0];
> +
> +	fmt->width = default_mode->width;
> +	fmt->height = default_mode->height;
> +	fmt->code = MEDIA_BUS_FMT_SGRBG10_1X10;
> +	fmt->field = V4L2_FIELD_NONE;
> +	fmt->colorspace = V4L2_COLORSPACE_SRGB;
> +	fmt->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(V4L2_COLORSPACE_SRGB);
> +	fmt->quantization = V4L2_QUANTIZATION_FULL_RANGE;
> +	fmt->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(V4L2_COLORSPACE_SRGB);
> +
> +	return 0;
> +}
> +
>  static int ov5670_enum_mbus_code(struct v4l2_subdev *sd,
>  				 struct v4l2_subdev_state *sd_state,
>  				 struct v4l2_subdev_mbus_code_enum *code)
> @@ -2499,6 +2497,7 @@ static const struct v4l2_subdev_video_ops ov5670_video_ops = {
>  };
>  
>  static const struct v4l2_subdev_pad_ops ov5670_pad_ops = {
> +	.init_cfg = ov5670_init_cfg,
>  	.enum_mbus_code = ov5670_enum_mbus_code,
>  	.get_fmt = ov5670_get_pad_format,
>  	.set_fmt = ov5670_set_pad_format,
> @@ -2520,10 +2519,6 @@ static const struct media_entity_operations ov5670_subdev_entity_ops = {
>  	.link_validate = v4l2_subdev_link_validate,
>  };
>  
> -static const struct v4l2_subdev_internal_ops ov5670_internal_ops = {
> -	.open = ov5670_open,
> -};
> -
>  static int ov5670_regulators_probe(struct ov5670 *ov5670)
>  {
>  	struct i2c_client *client = v4l2_get_subdevdata(&ov5670->sd);
> @@ -2629,7 +2624,6 @@ static int ov5670_probe(struct i2c_client *client)
>  		goto error_mutex_destroy;
>  	}
>  
> -	ov5670->sd.internal_ops = &ov5670_internal_ops;
>  	ov5670->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
>  			    V4L2_SUBDEV_FL_HAS_EVENTS;
>  	ov5670->sd.entity.ops = &ov5670_subdev_entity_ops;

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2022-03-15  8:14 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-14 16:27 [PATCH v2 0/8] media: i2c: ov5670: OF support, runtime_pm, regulators Jacopo Mondi
2022-03-14 16:27 ` [PATCH v2 1/8] media: dt-bindings: i2c: Document ov5670 Jacopo Mondi
2022-03-15  7:32   ` Krzysztof Kozlowski
2022-03-15  7:59     ` Sakari Ailus
2022-03-15  8:03       ` Krzysztof Kozlowski
2022-03-15 12:47         ` Sakari Ailus
2022-03-15 12:57           ` Krzysztof Kozlowski
2022-03-15 13:01           ` Laurent Pinchart
2022-03-15 20:30             ` Sakari Ailus
2022-03-15  8:09       ` Laurent Pinchart
2022-03-15  8:41     ` Jacopo Mondi
2022-03-14 16:27 ` [PATCH v2 2/8] media: i2c: ov5670: Allow probing with OF Jacopo Mondi
2022-03-14 16:27 ` [PATCH v2 3/8] media: i2c: ov5670: Probe clocks " Jacopo Mondi
2022-03-15  8:11   ` Laurent Pinchart
2022-03-15  8:46     ` Jacopo Mondi
2022-03-15  8:52       ` Krzysztof Kozlowski
2022-03-15  8:56       ` Laurent Pinchart
2022-03-16  8:04         ` Sakari Ailus
2022-03-14 16:27 ` [PATCH v2 4/8] media: i2c: ov5670: Probe regulators Jacopo Mondi
2022-03-14 16:27 ` [PATCH v2 5/8] media: i2c: ov5670: Probe GPIOs Jacopo Mondi
2022-03-14 16:27 ` [PATCH v2 6/8] media: i2c: ov5670: Add runtime_pm operations Jacopo Mondi
2022-03-14 16:27 ` [PATCH v2 7/8] media: i2c: ov5670: Implement init_cfg Jacopo Mondi
2022-03-15  8:13   ` Laurent Pinchart [this message]
2022-03-14 16:27 ` [PATCH v2 8/8] media: i2c: ov5670: Add .get_selection() support Jacopo Mondi
2022-03-15  4:18   ` kernel test robot
2022-03-15 16:55     ` Nathan Chancellor
2022-03-15 16:55       ` Nathan Chancellor
2022-03-15  8:19   ` 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=YjBKtxTdwrf8cp+O@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=chiranjeevi.rapolu@intel.com \
    --cc=jacopo@jmondi.org \
    --cc=jeanmichel.hautbois@ideasonboard.com \
    --cc=krzysztof.kozlowski@canonical.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=paul.elder@ideasonboard.com \
    --cc=paul.kocialkowski@bootlin.com \
    --cc=sakari.ailus@iki.fi \
    /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.