mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gianluca Boiano <morf3089@gmail.com>
To: Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
	 Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>,
	 Loic Poulain <loic.poulain@oss.qualcomm.com>,
	 Mauro Carvalho Chehab <mchehab@kernel.org>,
	 Sakari Ailus <sakari.ailus@linux.intel.com>,
	 Hans Verkuil <hverkuil@kernel.org>
Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	 linux-kernel@vger.kernel.org, phone-devel@vger.kernel.org,
	 David Heidelberg <david@ixit.cz>,
	Gianluca Boiano <morf3089@gmail.com>
Subject: [PATCH 1/5] media: qcom: camss: Don't stream sub-devices upstream of the sensor
Date: Mon, 23 Nov 2026 21:33:53 +0100	[thread overview]
Message-ID: <20261123-b4-ccs-imx376-v1-1-2b26850a6f11@gmail.com> (raw)
In-Reply-To: <20261123-b4-ccs-imx376-v1-0-2b26850a6f11@gmail.com>

video_start_streaming() and video_stop_streaming() walk the media
pipeline from the video node upstream and call s_stream on every
sub-device they find, including every sub-device behind the one that is
linked to the CSIPHY. That is fine for a sensor that is a single
sub-device, but a sensor that consists of several sub-devices gets
s_stream called on each of them, not just on the one that is linked to
the CSIPHY.

The MIPI CCS driver is such a sensor: it exposes a pixel array, a binner
and a scaler sub-device, and the scaler (or the binner when there is no
scaler) is the one linked to the CSIPHY. Streaming is started by that
sub-device and covers the whole sensor. Calling s_stream also on the
binner and on the pixel array is at best redundant and, as the CCS
enable_streams operation only accepts the sensor's source pad, makes the
pixel array fail with -EINVAL, so streaming cannot be started.

This is not specific to CCS. Other drivers that have a sensor on one end
of a pipeline, e.g. ipu3-cio2, rkisp1, ti-cal, ipu6 and rcar-vin, start
only the sub-device that is directly connected to them and leave
propagating the start request upstream to that sub-device.

Do the same in CAMSS: after the first sub-device that is not part of CAMSS
(i.e. the one that was bound by the async notifier, which is the one whose
host private data points to the CSIPHY), stop walking the pipeline.

Signed-off-by: Gianluca Boiano <morf3089@gmail.com>
---
 drivers/media/platform/qcom/camss/camss-video.c | 28 +++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/drivers/media/platform/qcom/camss/camss-video.c b/drivers/media/platform/qcom/camss/camss-video.c
index 0852eb6f1315..71ca16f15dab 100644
--- a/drivers/media/platform/qcom/camss/camss-video.c
+++ b/drivers/media/platform/qcom/camss/camss-video.c
@@ -249,6 +249,28 @@ static int video_prepare_streaming(struct vb2_queue *q)
 	return ret;
 }
 
+/*
+ * video_subdev_is_external - Check if a pipeline sub-device is not part of CAMSS
+ * @subdev: Sub-device in the pipeline
+ *
+ * camss_subdev_notifier_bound() sets the host private data of every external
+ * sub-device it binds, i.e. the one that is linked to a CSIPHY, to the CSIPHY.
+ * CAMSS sub-devices never have it set.
+ *
+ * Streaming is controlled from the video node, one CAMSS sub-device at a time.
+ * The external sub-device is the end of that chain: the pipeline upstream of it
+ * is not CAMSS' business, and the sub-device is responsible for starting and
+ * stopping whatever else it is made of. Sensors that consist of several
+ * sub-devices, such as MIPI CCS ones, are not expected to be controlled
+ * separately for each of them.
+ *
+ * Return true if @subdev is not a CAMSS sub-device.
+ */
+static bool video_subdev_is_external(struct v4l2_subdev *subdev)
+{
+	return v4l2_get_subdev_hostdata(subdev);
+}
+
 static int video_start_streaming(struct vb2_queue *q, unsigned int count)
 {
 	struct camss_video *video = vb2_get_drv_priv(q);
@@ -284,6 +306,9 @@ static int video_start_streaming(struct vb2_queue *q, unsigned int count)
 		ret = v4l2_subdev_call(subdev, video, s_stream, 1);
 		if (ret < 0 && ret != -ENOIOCTLCMD)
 			goto error;
+
+		if (video_subdev_is_external(subdev))
+			break;
 	}
 
 	return 0;
@@ -325,6 +350,9 @@ static void video_stop_streaming(struct vb2_queue *q)
 			dev_err(video->camss->dev, "Video pipeline stop failed: %d\n", ret);
 			return;
 		}
+
+		if (video_subdev_is_external(subdev))
+			break;
 	}
 
 	video_device_pipeline_stop(vdev);

-- 
2.56.1


  reply	other threads:[~2026-11-23 20:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 20:33 [PATCH 0/5] media: qcom: camss, ccs: Sony IMX376 on SDM660 using the MIPI CCS driver Gianluca Boiano
2026-11-23 20:33 ` Gianluca Boiano [this message]
2026-11-23 20:33 ` [PATCH 2/5] media: qcom: camss: Look up link frequency from the sub-device on the CSI-2 link Gianluca Boiano
2026-11-23 20:33 ` [PATCH 3/5] media: ccs: Store the format set on a sink pad Gianluca Boiano
2026-11-23 20:33 ` [PATCH 4/5] media: ccs: Make the source pad format follow the crop rectangle Gianluca Boiano
2026-11-23 20:33 ` [PATCH 5/5] media: ccs: Apply rule-based manufacturer register blocks at stream start Gianluca Boiano

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=20261123-b4-ccs-imx376-v1-1-2b26850a6f11@gmail.com \
    --to=morf3089@gmail.com \
    --cc=bryan.odonoghue@linaro.org \
    --cc=david@ixit.cz \
    --cc=hverkuil@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=loic.poulain@oss.qualcomm.com \
    --cc=mchehab@kernel.org \
    --cc=phone-devel@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=vladimir.zapolskiy@linaro.org \
    /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®