Linux kernel staging patches
 help / color / mirror / Atom feed
From: Changhuang Liang <changhuang.liang@starfivetech.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Jack Zhu <jack.zhu@starfivetech.com>,
	Changhuang Liang <changhuang.liang@starfivetech.com>,
	Dan Carpenter <dan.carpenter@linaro.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-staging@lists.linux.dev
Subject: [PATCH v2 4/8] staging: media: starfive: Introduce isp_stream
Date: Wed, 10 Apr 2024 02:10:22 -0700	[thread overview]
Message-ID: <20240410091026.50272-5-changhuang.liang@starfivetech.com> (raw)
In-Reply-To: <20240410091026.50272-1-changhuang.liang@starfivetech.com>

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

Signed-off-by: Changhuang Liang <changhuang.liang@starfivetech.com>
---
 .../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


  parent reply	other threads:[~2024-04-10  9:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-10  9:10 [PATCH v2 0/8] Add ISP Bayer for StarFive Changhuang Liang
2024-04-10  9:10 ` [PATCH v2 1/8] staging: media: starfive: Get rid of current_fmt Changhuang Liang
2024-04-10  9:10 ` [PATCH v2 2/8] staging: media: starfive: Add bayer pad for ISP Changhuang Liang
2024-04-10  9:10 ` [PATCH v2 3/8] staging: media: starfive: Use PAD_SINK instead of PAD_SRC for crop Changhuang Liang
2024-04-10  9:10 ` Changhuang Liang [this message]
2024-04-10  9:10 ` [PATCH v2 5/8] staging: media: starfive: Add ISP bayer video device Changhuang Liang
2024-04-10  9:10 ` [PATCH v2 6/8] staging: media: starfive: Fix bayer output stride configuration Changhuang Liang
2024-04-10  9:10 ` [PATCH v2 7/8] staging: media: starfive: Move the struct media_pipeline position Changhuang Liang
2024-04-10  9:10 ` [PATCH v2 8/8] admin-guide: media: Update documents for StarFive Camera Subsystem Changhuang Liang

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=20240410091026.50272-5-changhuang.liang@starfivetech.com \
    --to=changhuang.liang@starfivetech.com \
    --cc=bryan.odonoghue@linaro.org \
    --cc=dan.carpenter@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=jack.zhu@starfivetech.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=mchehab@kernel.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).