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 --- drivers/media/platform/qcom/camss/camss-video.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/media/platform/qcom/camss/camss-video.c b/drivers/media/platform/qcom/camss/camss-video.c index 0852eb6f1..93fb9b933 100644 --- a/drivers/media/platform/qcom/camss/camss-video.c +++ b/drivers/media/platform/qcom/camss/camss-video.c @@ -284,6 +284,14 @@ 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; + + /* + * Only the sub-device bound to CAMSS has host private data set + * (to the CSIPHY). It is responsible for starting whatever is + * upstream of it, e.g. the other sub-devices of a CCS sensor. + */ + if (v4l2_get_subdev_hostdata(subdev)) + break; } return 0; @@ -325,6 +333,9 @@ static void video_stop_streaming(struct vb2_queue *q) dev_err(video->camss->dev, "Video pipeline stop failed: %d\n", ret); return; } + + if (v4l2_get_subdev_hostdata(subdev)) + break; } video_device_pipeline_stop(vdev); -- 2.56.1