[PATCH v2 4/8] staging: media: starfive: Introduce isp_stream

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The ISP can support multiple output streams. Introduce isp_stream to
store the number of streams.

Signed-off-by: Changhuang Liang <changhuang.liang@xxxxxxxxxxxxxxxx>
---
 .../staging/media/starfive/camss/stf-camss.h  |  1 +
 .../staging/media/starfive/camss/stf-video.c  | 28 +++++++++++++++----
 2 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/media/starfive/camss/stf-camss.h b/drivers/staging/media/starfive/camss/stf-camss.h
index 328318d61c6b..6b9215c92cfa 100644
--- a/drivers/staging/media/starfive/camss/stf-camss.h
+++ b/drivers/staging/media/starfive/camss/stf-camss.h
@@ -55,6 +55,7 @@ struct stfcamss {
 	struct media_pipeline pipe;
 	struct device *dev;
 	struct stf_isp_dev isp_dev;
+	unsigned int isp_stream;
 	struct stf_capture captures[STF_CAPTURE_NUM];
 	struct stf_output output;
 	struct v4l2_async_notifier notifier;
diff --git a/drivers/staging/media/starfive/camss/stf-video.c b/drivers/staging/media/starfive/camss/stf-video.c
index 4ca889a7b757..69e3e4f9e56b 100644
--- a/drivers/staging/media/starfive/camss/stf-video.c
+++ b/drivers/staging/media/starfive/camss/stf-video.c
@@ -295,10 +295,22 @@ static int video_start_streaming(struct vb2_queue *q, unsigned int count)
 
 	video->ops->start_streaming(video);
 
-	ret = v4l2_subdev_call(video->source_subdev, video, s_stream, true);
-	if (ret) {
-		dev_err(video->stfcamss->dev, "stream on failed\n");
-		goto err_pm_put;
+	if (video->source_subdev != &video->stfcamss->isp_dev.subdev) {
+		ret = v4l2_subdev_call(video->source_subdev, video, s_stream, true);
+		if (ret) {
+			dev_err(video->stfcamss->dev, "stream on failed\n");
+			goto err_pm_put;
+		}
+	} else {
+		if (!video->stfcamss->isp_stream) {
+			ret = v4l2_subdev_call(video->source_subdev, video, s_stream, true);
+			if (ret) {
+				dev_err(video->stfcamss->dev, "stream on failed\n");
+				goto err_pm_put;
+			}
+		}
+
+		video->stfcamss->isp_stream++;
 	}
 
 	return 0;
@@ -319,7 +331,13 @@ static void video_stop_streaming(struct vb2_queue *q)
 
 	video->ops->stop_streaming(video);
 
-	v4l2_subdev_call(video->source_subdev, video, s_stream, false);
+	if (video->source_subdev != &video->stfcamss->isp_dev.subdev) {
+		v4l2_subdev_call(video->source_subdev, video, s_stream, false);
+	} else {
+		video->stfcamss->isp_stream--;
+		if (!video->stfcamss->isp_stream)
+			v4l2_subdev_call(video->source_subdev, video, s_stream, false);
+	}
 
 	pm_runtime_put(video->stfcamss->dev);
 
-- 
2.25.1





[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux