mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Tarang Raval <tarang.raval@siliconsignals.io>
Cc: kieran.bingham@ideasonboard.com,
	Dave Stevenson <dave.stevenson@raspberrypi.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/2] media: i2c: imx219: switch to {enable,disable}_streams
Date: Wed, 5 Mar 2025 14:46:35 +0000	[thread overview]
Message-ID: <Z8hjy8CiM-QcjTME@kekkonen.localdomain> (raw)
In-Reply-To: <20250305142117.29182-2-tarang.raval@siliconsignals.io>

Hi Tarang,

Thanks for the update.

On Wed, Mar 05, 2025 at 07:51:15PM +0530, Tarang Raval wrote:
> Switch from s_stream to enable_streams and disable_streams callbacks.
> 
> Signed-off-by: Tarang Raval <tarang.raval@siliconsignals.io>
> ---
>  drivers/media/i2c/imx219.c | 36 +++++++++++++++++-------------------
>  1 file changed, 17 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c
> index f662c9d75511..12f1aa8824fe 100644
> --- a/drivers/media/i2c/imx219.c
> +++ b/drivers/media/i2c/imx219.c
> @@ -723,12 +723,17 @@ static int imx219_configure_lanes(struct imx219 *imx219)
>  				  ARRAY_SIZE(imx219_4lane_regs), NULL);
>  };
>  
> -static int imx219_start_streaming(struct imx219 *imx219,
> -				  struct v4l2_subdev_state *state)
> +static int imx219_enable_streams(struct v4l2_subdev *sd,
> +				 struct v4l2_subdev_state *state, u32 pad,
> +				 u64 streams_mask)
>  {
> +	struct imx219 *imx219 = to_imx219(sd);
>  	struct i2c_client *client = v4l2_get_subdevdata(&imx219->sd);
>  	int ret;
>  
> +	if (pad != 0)
> +		return -EINVAL;

There's no need to check for the pad argument: {enable,disable}_streams may
be called on source pads only.

> +
>  	ret = pm_runtime_resume_and_get(&client->dev);
>  	if (ret < 0)
>  		return ret;
> @@ -778,11 +783,17 @@ static int imx219_start_streaming(struct imx219 *imx219,
>  	return ret;
>  }
>  
> -static void imx219_stop_streaming(struct imx219 *imx219)
> +static int imx219_disable_streams(struct v4l2_subdev *sd,
> +				  struct v4l2_subdev_state *state, u32 pad,
> +				  u64 streams_mask)
>  {
> +	struct imx219 *imx219 = to_imx219(sd);
>  	struct i2c_client *client = v4l2_get_subdevdata(&imx219->sd);
>  	int ret;
>  
> +	if (pad != 0)
> +		return -EINVAL;

Ditto.

> +
>  	/* set stream off register */
>  	ret = cci_write(imx219->regmap, IMX219_REG_MODE_SELECT,
>  			IMX219_MODE_STANDBY, NULL);
> @@ -793,22 +804,7 @@ static void imx219_stop_streaming(struct imx219 *imx219)
>  	__v4l2_ctrl_grab(imx219->hflip, false);
>  
>  	pm_runtime_put(&client->dev);
> -}
> -
> -static int imx219_set_stream(struct v4l2_subdev *sd, int enable)
> -{
> -	struct imx219 *imx219 = to_imx219(sd);
> -	struct v4l2_subdev_state *state;
> -	int ret = 0;
> -
> -	state = v4l2_subdev_lock_and_get_active_state(sd);
> -
> -	if (enable)
> -		ret = imx219_start_streaming(imx219, state);
> -	else
> -		imx219_stop_streaming(imx219);
>  
> -	v4l2_subdev_unlock_state(state);
>  	return ret;
>  }
>  
> @@ -992,7 +988,7 @@ static int imx219_init_state(struct v4l2_subdev *sd,
>  }
>  
>  static const struct v4l2_subdev_video_ops imx219_video_ops = {
> -	.s_stream = imx219_set_stream,
> +	.s_stream = v4l2_subdev_s_stream_helper,
>  };
>  
>  static const struct v4l2_subdev_pad_ops imx219_pad_ops = {
> @@ -1001,6 +997,8 @@ static const struct v4l2_subdev_pad_ops imx219_pad_ops = {
>  	.set_fmt = imx219_set_pad_format,
>  	.get_selection = imx219_get_selection,
>  	.enum_frame_size = imx219_enum_frame_size,
> +	.enable_streams = imx219_enable_streams,
> +	.disable_streams = imx219_disable_streams,
>  };
>  
>  static const struct v4l2_subdev_ops imx219_subdev_ops = {

-- 
Regards,

Sakari Ailus

  reply	other threads:[~2025-03-05 14:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-05 14:21 [PATCH v3 0/2] media: i2c: imx219: Minor improvements for runtime PM and stream handling Tarang Raval
2025-03-05 14:21 ` [PATCH v3 1/2] media: i2c: imx219: switch to {enable,disable}_streams Tarang Raval
2025-03-05 14:46   ` Sakari Ailus [this message]
2025-03-05 14:21 ` [PATCH v3 2/2] media: i2c: imx219: Enable runtime PM autosuspend Tarang Raval

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=Z8hjy8CiM-QcjTME@kekkonen.localdomain \
    --to=sakari.ailus@linux.intel.com \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=tarang.raval@siliconsignals.io \
    /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®