[PATCH RESEND 14/45] media: qcom: camss: video: add managed streaming callbacks
From: Gjorgji . Rosikopulos . gjorgji . rosikopulos
Date: Wed Oct 07 2026 - 05:17:53 EST
From: Atanas Filipov <atanas.filipov@xxxxxxxxxxxxxxxx>
Allow a CAMSS video node to start and stop streaming and select its
buffer type. Keep the existing path when callbacks are absent.
Signed-off-by: Atanas Filipov <atanas.filipov@xxxxxxxxxxxxxxxx>
---
drivers/media/platform/qcom/camss/camss-video.c | 17 ++++++++++++++++-
drivers/media/platform/qcom/camss/camss-video.h | 2 ++
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/qcom/camss/camss-video.c b/drivers/media/platform/qcom/camss/camss-video.c
index 803e5ce9b9fd..cb9e08e9ff7e 100644
--- a/drivers/media/platform/qcom/camss/camss-video.c
+++ b/drivers/media/platform/qcom/camss/camss-video.c
@@ -159,6 +159,7 @@ static int video_buf_init(struct vb2_buffer *vb)
struct sg_table *sgt;
unsigned int i;
+ memset(buffer->addr, 0, sizeof(buffer->addr));
for (i = 0; i < format->num_planes; i++) {
sgt = vb2_dma_sg_plane_desc(vb, i);
if (!sgt)
@@ -303,6 +304,14 @@ static int video_start_streaming(struct vb2_queue *q, unsigned int count)
if (ret < 0)
goto error;
+ if (video->ops->start_streaming) {
+ ret = video->ops->start_streaming(video, count);
+ if (ret < 0)
+ goto error;
+
+ return 0;
+ }
+
src_pad = media_pad_remote_pad_first(sink_pad);
if (src_pad && is_media_entity_v4l2_subdev(src_pad->entity))
subdev = media_entity_to_v4l2_subdev(src_pad->entity);
@@ -370,6 +379,11 @@ static void video_stop_streaming(struct vb2_queue *q)
struct v4l2_subdev *subdev = NULL;
int ret;
+ if (video->ops->stop_streaming) {
+ video->ops->stop_streaming(video);
+ goto stop_pipeline;
+ }
+
src_pad = media_pad_remote_pad_first(sink_pad);
if (src_pad && is_media_entity_v4l2_subdev(src_pad->entity))
subdev = media_entity_to_v4l2_subdev(src_pad->entity);
@@ -382,6 +396,7 @@ static void video_stop_streaming(struct vb2_queue *q)
if (ret)
dev_err(video->camss->dev, "Video pipeline stop failed: %d\n", ret);
+stop_pipeline:
video_device_pipeline_stop(vdev);
video->ops->flush_buffers(video, VB2_BUF_STATE_ERROR);
@@ -766,7 +781,7 @@ int msm_video_register(struct camss_video *video, struct v4l2_device *v4l2_dev,
q->drv_priv = video;
q->mem_ops = &vb2_dma_sg_memops;
q->ops = &msm_video_vb2_q_ops;
- q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
+ q->type = video->type;
q->io_modes = VB2_DMABUF | VB2_MMAP | VB2_READ;
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
q->buf_struct_size = sizeof(struct camss_buffer);
diff --git a/drivers/media/platform/qcom/camss/camss-video.h b/drivers/media/platform/qcom/camss/camss-video.h
index d3e56e240a88..f62a72c29a5a 100644
--- a/drivers/media/platform/qcom/camss/camss-video.h
+++ b/drivers/media/platform/qcom/camss/camss-video.h
@@ -31,6 +31,8 @@ struct camss_video_ops {
int (*queue_buffer)(struct camss_video *vid, struct camss_buffer *buf);
int (*flush_buffers)(struct camss_video *vid,
enum vb2_buffer_state state);
+ int (*start_streaming)(struct camss_video *vid, unsigned int count);
+ void (*stop_streaming)(struct camss_video *vid);
};
struct camss_video {
--
2.34.1