[PATCH v12 73/86] media: ipu6: Collect IPU streams into CSI-2 receiver sub-device context

Sakari Ailus
2026-04-09T20:15:12Z

Collect the IPU streams to the CSI-2 receiver sub-device's context.

The background is that an IPU stream is bound to a CSI-2 virtual channel
but in a V4L2 pipeline there's no such assumption. Therefore a pipeline
may contain multiple virtual channels and so multiple IPU streams, too.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c | 10 +++++++++-
drivers/media/pci/intel/ipu6/ipu6-isys-csi2.h | 1 +
drivers/media/pci/intel/ipu6/ipu6-isys-video.h | 1 +
3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c b/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c
index 93ae5f767cc0..04825cdce7c0 100644
--- a/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c
+++ b/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c
@@ -362,10 +362,12 @@ static int ipu6_isys_csi2_enable_streams(struct v4l2_subdev *sd,
u64 sink_streams;
int ret;

+ list_add(&av->csi2_entry, &csi2->av_head);
+
ret = ipu6_isys_start_stream_firmware(av);
if (ret) {
dev_err(sd->dev, "start stream of firmware failed\n");
- return ret;
+ goto err_del_av;
}

remote_pad = media_pad_remote_pad_first(&sd->entity.pads[CSI2_PAD_SINK]);
@@ -397,6 +399,9 @@ static int ipu6_isys_csi2_enable_streams(struct v4l2_subdev *sd,
ipu6_isys_stop_streaming_firmware(av);
ipu6_isys_close_streaming_firmware(av);

+err_del_av:
+ list_del(&av->csi2_entry);
+
return ret;
}

@@ -426,6 +431,8 @@ static int ipu6_isys_csi2_disable_streams(struct v4l2_subdev *sd,

ipu6_isys_close_streaming_firmware(av);

+ list_del(&av->csi2_entry);
+
return 0;
}

@@ -571,6 +578,7 @@ int ipu6_isys_csi2_init(struct ipu6_isys_csi2 *csi2,
if (ret)
goto fail;

+ INIT_LIST_HEAD(&csi2->av_head);
csi2->asd.source = IPU6_FW_ISYS_STREAM_SRC_CSI2_PORT0 + index;
csi2->asd.supported_codes = csi2_supported_codes;
snprintf(csi2->asd.sd.name, sizeof(csi2->asd.sd.name),
diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.h b/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.h
index ce8eed91065c..bcddd5626531 100644
--- a/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.h
+++ b/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.h
@@ -38,6 +38,7 @@ struct ipu6_isys_csi2 {
struct ipu6_isys_subdev asd;
struct ipu6_isys *isys;
struct ipu6_isys_video av[NR_OF_CSI2_SRC_PADS];
+ struct list_head av_head;

void __iomem *base;
u32 receiver_errors;
diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys-video.h b/drivers/media/pci/intel/ipu6/ipu6-isys-video.h
index 80b9d0d001b1..c1d10a9f44f2 100644
--- a/drivers/media/pci/intel/ipu6/ipu6-isys-video.h
+++ b/drivers/media/pci/intel/ipu6/ipu6-isys-video.h
@@ -77,6 +77,7 @@ struct video_stream_watermark {

struct ipu6_isys_video {
struct ipu6_isys_queue aq;
+ struct list_head csi2_entry;
/* Serialise access to other fields in the struct. */
struct mutex mutex;
struct media_pad pad;
--
2.47.3