All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: linux-media@vger.kernel.org, bingbu.cao@linux.intel.com,
	stanislaw.gruszka@linux.intel.com, tian.shu.qiu@intel.com,
	tomi.valkeinen@ideasonboard.com
Subject: Re: [PATCH 07/13] media: ipu6: Set up CSI-2 receiver at correct moment
Date: Thu, 19 Jun 2025 20:00:30 +0300	[thread overview]
Message-ID: <20250619170030.GI32166@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20250619081546.1582969-8-sakari.ailus@linux.intel.com>

Hi Sakari,

Thank you for the patch.

On Thu, Jun 19, 2025 at 11:15:40AM +0300, Sakari Ailus wrote:
> Enable the CSI-2 receiver before the first stream is started and disable
> it when the last stream is stopped. Before this patch, every time a stream
> was started, the CSI-2 receiver was enabled and similarly, it was disabled
> when any stream was stopped.

You mentioned in 03/13 that we should only enable the source when all
video capture devices have been started. Shouldn't you enable the CSI-2
receiver when *all* streams are enabled, not when the first one is
enabled (and similarly when stopping) ?

> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---
>  drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c | 25 ++++++++++++-------
>  1 file changed, 16 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c b/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c
> index 6030bd23b4b9..3b837e9ccffe 100644
> --- a/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c
> +++ b/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c
> @@ -348,7 +348,7 @@ static int ipu6_isys_csi2_enable_streams(struct v4l2_subdev *sd,
>  	struct ipu6_isys_csi2_timing timing = { };
>  	struct v4l2_subdev *remote_sd;
>  	struct media_pad *remote_pad;
> -	u64 sink_streams;
> +	u64 sink_streams, already_enabled;
>  	int ret;
>  
>  	remote_pad = media_pad_remote_pad_first(&sd->entity.pads[CSI2_PAD_SINK]);
> @@ -358,13 +358,17 @@ static int ipu6_isys_csi2_enable_streams(struct v4l2_subdev *sd,
>  		v4l2_subdev_state_xlate_streams(state, pad, CSI2_PAD_SINK,
>  						&streams_mask);
>  
> -	ret = ipu6_isys_csi2_calc_timing(csi2, &timing, CSI2_ACCINV);
> -	if (ret)
> -		return ret;
> +	already_enabled = v4l2_subdev_state_streams_enabled(sd, state,
> +							    CSI2_PAD_SINK);

It would be cheaper to store a bitmask of enabled streams on the csi2
structure.

> +	if (!already_enabled) {
> +		ret = ipu6_isys_csi2_calc_timing(csi2, &timing, CSI2_ACCINV);
> +		if (ret)
> +			return ret;
>  
> -	ret = ipu6_isys_csi2_set_stream(sd, &timing, csi2->nlanes, true);
> -	if (ret)
> -		return ret;
> +		ret = ipu6_isys_csi2_set_stream(sd, &timing, csi2->nlanes, true);
> +		if (ret)
> +			return ret;
> +	}
>  
>  	ret = v4l2_subdev_enable_streams(remote_sd, remote_pad->index,
>  					 sink_streams);
> @@ -382,7 +386,7 @@ static int ipu6_isys_csi2_disable_streams(struct v4l2_subdev *sd,
>  {
>  	struct v4l2_subdev *remote_sd;
>  	struct media_pad *remote_pad;
> -	u64 sink_streams;
> +	u64 sink_streams, still_enabled;
>  
>  	sink_streams =
>  		v4l2_subdev_state_xlate_streams(state, pad, CSI2_PAD_SINK,
> @@ -391,7 +395,10 @@ static int ipu6_isys_csi2_disable_streams(struct v4l2_subdev *sd,
>  	remote_pad = media_pad_remote_pad_first(&sd->entity.pads[CSI2_PAD_SINK]);
>  	remote_sd = media_entity_to_v4l2_subdev(remote_pad->entity);
>  
> -	ipu6_isys_csi2_set_stream(sd, NULL, 0, false);
> +	still_enabled = v4l2_subdev_state_streams_enabled(sd, state,
> +							  CSI2_PAD_SINK);
> +	if (still_enabled == sink_streams)
> +		ipu6_isys_csi2_set_stream(sd, NULL, 0, false);
>  
>  	v4l2_subdev_disable_streams(remote_sd, remote_pad->index, sink_streams);
>  

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2025-06-19 17:00 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-19  8:15 [PATCH 00/13] Streaming control for MC with metadata or streams otherwise Sakari Ailus
2025-06-19  8:15 ` [PATCH 01/13] media: ipu6: Use correct pads for xlate_streams() Sakari Ailus
2025-06-19 13:27   ` Laurent Pinchart
2025-06-19 13:55     ` Sakari Ailus
2025-06-19 14:15       ` Laurent Pinchart
2025-06-19 14:28         ` Sakari Ailus
2025-06-19 15:08           ` Laurent Pinchart
2025-06-19  8:15 ` [PATCH 02/13] media: ipu6: Set minimum height to 1 Sakari Ailus
2025-06-19 13:27   ` Laurent Pinchart
2025-06-19  8:15 ` [PATCH 03/13] media: ipu6: Enable and disable each stream at CSI-2 subdev source pad Sakari Ailus
2025-06-19 12:23   ` kernel test robot
2025-06-19 12:48   ` Laurent Pinchart
2025-06-19 13:10     ` Sakari Ailus
2025-06-19 13:19       ` Laurent Pinchart
2025-06-19 13:52         ` Sakari Ailus
2025-06-19  8:15 ` [PATCH 04/13] media: v4l2-subdev: Add a helper to figure out the pad streaming state Sakari Ailus
2025-06-19 13:37   ` Laurent Pinchart
2025-06-19  8:15 ` [PATCH 05/13] media: v4l: Make media_entity_to_video_device() NULL-safe Sakari Ailus
2025-06-19 15:20   ` Laurent Pinchart
2025-06-19 16:14     ` Sakari Ailus
2025-07-08 11:56       ` Laurent Pinchart
2025-07-08 12:02         ` Sakari Ailus
2025-07-08 16:17           ` Laurent Pinchart
2025-07-09 20:03             ` Sakari Ailus
2025-07-09 20:54               ` Laurent Pinchart
2025-07-10  6:57                 ` Sakari Ailus
2025-06-19  8:15 ` [PATCH 06/13] media: v4l2-subdev: Mark both streams of a route enabled Sakari Ailus
2025-06-19 16:56   ` Laurent Pinchart
2025-06-19 18:34     ` Sakari Ailus
2025-06-19 22:18       ` Laurent Pinchart
2025-06-25 16:10         ` Sakari Ailus
2025-06-26 15:22       ` Tomi Valkeinen
2025-06-26 19:13         ` Laurent Pinchart
2025-06-26 15:17   ` Tomi Valkeinen
2025-06-27  6:09     ` Sakari Ailus
2025-06-30  0:47       ` Laurent Pinchart
2025-06-19  8:15 ` [PATCH 07/13] media: ipu6: Set up CSI-2 receiver at correct moment Sakari Ailus
2025-06-19 17:00   ` Laurent Pinchart [this message]
2025-06-19 17:20     ` Sakari Ailus
2025-06-19  8:15 ` [PATCH 08/13] media: v4l2-subdev: Print early in v4l2_subdev_{enable,disable}_streams() Sakari Ailus
2025-06-19 17:03   ` Laurent Pinchart
2025-06-25 16:12     ` Sakari Ailus
2025-06-19  8:15 ` [PATCH 09/13] media: v4l2-subdev: Collect streams on source pads only Sakari Ailus
2025-06-19 17:07   ` Laurent Pinchart
2025-06-25 16:14     ` Sakari Ailus
2025-06-19  8:15 ` [PATCH 10/13] media: v4l2-subdev: Add debug prints to v4l2_subdev_collect_streams() Sakari Ailus
2025-06-19 22:23   ` Laurent Pinchart
2025-06-25 16:28     ` Sakari Ailus
2025-06-19  8:15 ` [PATCH 11/13] media: v4l2-subdev: Introduce v4l2_subdev_find_route() Sakari Ailus
2025-06-20  8:14   ` Jacopo Mondi
2025-06-25 16:53     ` Sakari Ailus
2025-06-26 22:20       ` Laurent Pinchart
2025-07-15 14:09         ` Sakari Ailus
2025-06-19  8:15 ` [PATCH 12/13] media: v4l2-mc: Introduce v4l2_mc_pipeline_enabled() Sakari Ailus
2025-06-19 11:42   ` kernel test robot
2025-06-20  3:58   ` Dan Carpenter
2025-06-20  8:53   ` Jacopo Mondi
2025-06-21  8:10     ` Sakari Ailus
2025-07-15 10:49     ` Sakari Ailus
2025-07-15 11:25       ` Laurent Pinchart
2025-07-15 11:32         ` Sakari Ailus
2025-07-15 18:18           ` Laurent Pinchart
2025-06-23  9:48   ` kernel test robot
2025-06-26 23:07   ` Laurent Pinchart
2025-08-04 11:32     ` Sakari Ailus
2025-08-04 11:46       ` Laurent Pinchart
2025-06-19  8:15 ` [PATCH 13/13] media: ipu6: isys: Rework stream starting and stopping Sakari Ailus

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=20250619170030.GI32166@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=bingbu.cao@linux.intel.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=stanislaw.gruszka@linux.intel.com \
    --cc=tian.shu.qiu@intel.com \
    --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 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.