From: Eugen Hristev <eugen.hristev@microchip.com>
To: <linux-kernel@vger.kernel.org>, <linux-media@vger.kernel.org>,
<hverkuil-cisco@xs4all.nl>, <jacopo@jmondi.org>
Cc: <linux-arm-kernel@lists.infradead.org>,
<linux-staging@lists.linux.dev>,
Eugen Hristev <eugen.hristev@microchip.com>
Subject: [PATCH v11 6/6] media: microchip: microchip-isc: move media_pipeline_* to (un)prepare cb
Date: Wed, 2 Nov 2022 15:15:00 +0200 [thread overview]
Message-ID: <20221102131500.476024-7-eugen.hristev@microchip.com> (raw)
In-Reply-To: <20221102131500.476024-1-eugen.hristev@microchip.com>
Move the media_pipeline_start/stop calls from start/stop streaming to
the new prepare_streaming and unprepare_streaming callbacks.
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
---
.../platform/microchip/microchip-isc-base.c | 27 ++++++++++++-------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/drivers/media/platform/microchip/microchip-isc-base.c
index 00651c313e9d..eed96e2a6a00 100644
--- a/drivers/media/platform/microchip/microchip-isc-base.c
+++ b/drivers/media/platform/microchip/microchip-isc-base.c
@@ -328,6 +328,13 @@ static int isc_configure(struct isc_device *isc)
return isc_update_profile(isc);
}
+static int isc_prepare_streaming(struct vb2_queue *vq)
+{
+ struct isc_device *isc = vb2_get_drv_priv(vq);
+
+ return media_pipeline_start(isc->video_dev.entity.pads, &isc->mpipe);
+}
+
static int isc_start_streaming(struct vb2_queue *vq, unsigned int count)
{
struct isc_device *isc = vb2_get_drv_priv(vq);
@@ -336,10 +343,6 @@ static int isc_start_streaming(struct vb2_queue *vq, unsigned int count)
unsigned long flags;
int ret;
- ret = media_pipeline_start(isc->video_dev.entity.pads, &isc->mpipe);
- if (ret)
- goto err_pipeline_start;
-
/* Enable stream on the sub device */
ret = v4l2_subdev_call(isc->current_subdev->sd, video, s_stream, 1);
if (ret && ret != -ENOIOCTLCMD) {
@@ -389,9 +392,6 @@ static int isc_start_streaming(struct vb2_queue *vq, unsigned int count)
v4l2_subdev_call(isc->current_subdev->sd, video, s_stream, 0);
err_start_stream:
- media_pipeline_stop(isc->video_dev.entity.pads);
-
-err_pipeline_start:
spin_lock_irqsave(&isc->dma_queue_lock, flags);
list_for_each_entry(buf, &isc->dma_queue, list)
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_QUEUED);
@@ -401,6 +401,14 @@ static int isc_start_streaming(struct vb2_queue *vq, unsigned int count)
return ret;
}
+static void isc_unprepare_streaming(struct vb2_queue *vq)
+{
+ struct isc_device *isc = vb2_get_drv_priv(vq);
+
+ /* Stop media pipeline */
+ media_pipeline_stop(isc->video_dev.entity.pads);
+}
+
static void isc_stop_streaming(struct vb2_queue *vq)
{
struct isc_device *isc = vb2_get_drv_priv(vq);
@@ -430,9 +438,6 @@ static void isc_stop_streaming(struct vb2_queue *vq)
if (ret && ret != -ENOIOCTLCMD)
v4l2_err(&isc->v4l2_dev, "stream off failed in subdev\n");
- /* Stop media pipeline */
- media_pipeline_stop(isc->video_dev.entity.pads);
-
/* Release all active buffers */
spin_lock_irqsave(&isc->dma_queue_lock, flags);
if (unlikely(isc->cur_frm)) {
@@ -472,6 +477,8 @@ static const struct vb2_ops isc_vb2_ops = {
.start_streaming = isc_start_streaming,
.stop_streaming = isc_stop_streaming,
.buf_queue = isc_buffer_queue,
+ .prepare_streaming = isc_prepare_streaming,
+ .unprepare_streaming = isc_unprepare_streaming,
};
static int isc_querycap(struct file *file, void *priv,
--
2.25.1
next prev parent reply other threads:[~2022-11-02 13:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-02 13:14 [PATCH v11 0/6] media: atmel: atmel-isc: driver redesign Eugen Hristev
2022-11-02 13:14 ` [PATCH v11 1/6] media: atmel: atmel-isc: move to staging Eugen Hristev
2022-11-04 9:26 ` Hans Verkuil
2022-11-04 14:30 ` Eugen.Hristev
2022-11-02 13:14 ` [PATCH v11 2/6] media: atmel: move microchip_csi2dc to dedicated microchip platform Eugen Hristev
2022-11-02 13:14 ` [PATCH v11 3/6] media: microchip: re-add ISC driver as Microchip ISC Eugen Hristev
2022-11-02 13:14 ` [PATCH v11 4/6] media: microchip: microchip-isc: prepare for media controller support Eugen Hristev
2022-11-02 13:14 ` [PATCH v11 5/6] media: microchip: microchip-isc: implement media controller Eugen Hristev
2022-11-02 13:15 ` Eugen Hristev [this message]
2022-11-02 16:54 ` [PATCH v11 6/6] media: microchip: microchip-isc: move media_pipeline_* to (un)prepare cb kernel test robot
2022-11-02 23:59 ` kernel test robot
2022-11-03 5:13 ` kernel test robot
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=20221102131500.476024-7-eugen.hristev@microchip.com \
--to=eugen.hristev@microchip.com \
--cc=hverkuil-cisco@xs4all.nl \
--cc=jacopo@jmondi.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
/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