From: Dikshita Agarwal <quic_dikshita@quicinc.com>
To: Vikash Garodia <quic_vgarodia@quicinc.com>,
Abhinav Kumar <abhinav.kumar@linux.dev>,
Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Hans Verkuil <hverkuil@xs4all.nl>,
Stefan Schmidt <stefan.schmidt@linaro.org>,
"Vedang Nagar" <quic_vnagar@quicinc.com>
Cc: <linux-media@vger.kernel.org>, <linux-arm-msm@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
Dikshita Agarwal <quic_dikshita@quicinc.com>
Subject: [PATCH 12/25] media: iris: Add support for video encoder device
Date: Fri, 4 Jul 2025 13:23:12 +0530 [thread overview]
Message-ID: <20250704-iris-video-encoder-v1-12-b6ce24e273cf@quicinc.com> (raw)
In-Reply-To: <20250704-iris-video-encoder-v1-0-b6ce24e273cf@quicinc.com>
Add support for registering a V4L2 encoder video device to the iris
driver. The encoder device is registered with the name
"qcom-iris-encoder".
Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
---
drivers/media/platform/qcom/iris/iris_core.h | 7 ++++++
drivers/media/platform/qcom/iris/iris_probe.c | 36 ++++++++++++++++++++-------
2 files changed, 34 insertions(+), 9 deletions(-)
diff --git a/drivers/media/platform/qcom/iris/iris_core.h b/drivers/media/platform/qcom/iris/iris_core.h
index aeeac32a1f6d9a9fa7027e8e3db4d95f021c552e..09e83be4e00efb456b7098a499b6cce850134a06 100644
--- a/drivers/media/platform/qcom/iris/iris_core.h
+++ b/drivers/media/platform/qcom/iris/iris_core.h
@@ -25,6 +25,11 @@ struct icc_info {
#define IRIS_FW_VERSION_LENGTH 128
#define IFACEQ_CORE_PKT_SIZE (1024 * 4)
+enum domain_type {
+ ENCODER = BIT(0),
+ DECODER = BIT(1),
+};
+
/**
* struct iris_core - holds core parameters valid for all instances
*
@@ -33,6 +38,7 @@ struct icc_info {
* @irq: iris irq
* @v4l2_dev: a holder for v4l2 device structure
* @vdev_dec: iris video device structure for decoder
+ * @vdev_enc: iris video device structure for encoder
* @iris_v4l2_file_ops: iris v4l2 file ops
* @iris_v4l2_ioctl_ops: iris v4l2 ioctl ops
* @iris_vb2_ops: iris vb2 ops
@@ -73,6 +79,7 @@ struct iris_core {
int irq;
struct v4l2_device v4l2_dev;
struct video_device *vdev_dec;
+ struct video_device *vdev_enc;
const struct v4l2_file_operations *iris_v4l2_file_ops;
const struct v4l2_ioctl_ops *iris_v4l2_ioctl_ops;
const struct vb2_ops *iris_vb2_ops;
diff --git a/drivers/media/platform/qcom/iris/iris_probe.c b/drivers/media/platform/qcom/iris/iris_probe.c
index 4e6e92357968d7419f114cc0ffa9b571bad19e46..c3be9deb0a57cc2cf25d69784d54be5e4a5fe06c 100644
--- a/drivers/media/platform/qcom/iris/iris_probe.c
+++ b/drivers/media/platform/qcom/iris/iris_probe.c
@@ -146,7 +146,7 @@ static int iris_init_resources(struct iris_core *core)
return iris_init_resets(core);
}
-static int iris_register_video_device(struct iris_core *core)
+static int iris_register_video_device(struct iris_core *core, enum domain_type type)
{
struct video_device *vdev;
int ret;
@@ -155,7 +155,6 @@ static int iris_register_video_device(struct iris_core *core)
if (!vdev)
return -ENOMEM;
- strscpy(vdev->name, "qcom-iris-decoder", sizeof(vdev->name));
vdev->release = video_device_release;
vdev->fops = core->iris_v4l2_file_ops;
vdev->ioctl_ops = core->iris_v4l2_ioctl_ops;
@@ -163,11 +162,23 @@ static int iris_register_video_device(struct iris_core *core)
vdev->v4l2_dev = &core->v4l2_dev;
vdev->device_caps = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_STREAMING;
- ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1);
- if (ret)
+ if (type == DECODER) {
+ strscpy(vdev->name, "qcom-iris-decoder", sizeof(vdev->name));
+ ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1);
+ if (ret)
+ goto err_vdev_release;
+ core->vdev_dec = vdev;
+ } else if (type == ENCODER) {
+ strscpy(vdev->name, "qcom-iris-encoder", sizeof(vdev->name));
+ ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1);
+ if (ret)
+ goto err_vdev_release;
+ core->vdev_enc = vdev;
+ } else {
+ ret = -EINVAL;
goto err_vdev_release;
+ }
- core->vdev_dec = vdev;
video_set_drvdata(vdev, core);
return 0;
@@ -189,6 +200,7 @@ static void iris_remove(struct platform_device *pdev)
iris_core_deinit(core);
video_unregister_device(core->vdev_dec);
+ video_unregister_device(core->vdev_enc);
v4l2_device_unregister(&core->v4l2_dev);
@@ -258,17 +270,21 @@ static int iris_probe(struct platform_device *pdev)
if (ret)
return ret;
- ret = iris_register_video_device(core);
+ ret = iris_register_video_device(core, DECODER);
if (ret)
goto err_v4l2_unreg;
+ ret = iris_register_video_device(core, ENCODER);
+ if (ret)
+ goto err_vdev_unreg_dec;
+
platform_set_drvdata(pdev, core);
dma_mask = core->iris_platform_data->dma_mask;
ret = dma_set_mask_and_coherent(dev, dma_mask);
if (ret)
- goto err_vdev_unreg;
+ goto err_vdev_unreg_enc;
dma_set_max_seg_size(&pdev->dev, DMA_BIT_MASK(32));
dma_set_seg_boundary(&pdev->dev, DMA_BIT_MASK(32));
@@ -277,11 +293,13 @@ static int iris_probe(struct platform_device *pdev)
pm_runtime_use_autosuspend(core->dev);
ret = devm_pm_runtime_enable(core->dev);
if (ret)
- goto err_vdev_unreg;
+ goto err_vdev_unreg_enc;
return 0;
-err_vdev_unreg:
+err_vdev_unreg_enc:
+ video_unregister_device(core->vdev_enc);
+err_vdev_unreg_dec:
video_unregister_device(core->vdev_dec);
err_v4l2_unreg:
v4l2_device_unregister(&core->v4l2_dev);
--
2.34.1
next prev parent reply other threads:[~2025-07-04 7:54 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-04 7:53 [PATCH 00/25] Enable H.264/H.265 encoder support and fixes in common code Dikshita Agarwal
2025-07-04 7:53 ` [PATCH 01/25] media: iris: Fix buffer count reporting in internal buffer check Dikshita Agarwal
2025-07-16 6:04 ` Vikash Garodia
2025-08-11 9:54 ` Bryan O'Donoghue
2025-07-04 7:53 ` [PATCH 02/25] media: iris: Report unreleased PERSIST buffers on session close Dikshita Agarwal
2025-07-16 6:06 ` Vikash Garodia
2025-07-04 7:53 ` [PATCH 03/25] media: iris: Fix memory leak by freeing untracked persist buffer Dikshita Agarwal
2025-07-16 6:07 ` Vikash Garodia
2025-07-04 7:53 ` [PATCH 04/25] media: iris: Fix buffer timestamp handling Dikshita Agarwal
2025-07-16 6:08 ` Vikash Garodia
2025-07-04 7:53 ` [PATCH 05/25] media: iris: Fix port streaming handling Dikshita Agarwal
2025-07-16 6:48 ` Vikash Garodia
2025-07-04 7:53 ` [PATCH 06/25] media: iris: Allow substate transition to load resources during output streaming Dikshita Agarwal
2025-07-16 6:52 ` Vikash Garodia
2025-07-04 7:53 ` [PATCH 07/25] media: iris: Always destroy internal buffers on firmware release response Dikshita Agarwal
2025-07-16 6:56 ` Vikash Garodia
2025-07-04 7:53 ` [PATCH 08/25] media: iris: Update vbuf flags before v4l2_m2m_buf_done Dikshita Agarwal
2025-07-16 6:56 ` Vikash Garodia
2025-07-04 7:53 ` [PATCH 09/25] media: iris: Allow stop on firmware only if start was issued Dikshita Agarwal
2025-07-16 7:13 ` Vikash Garodia
2025-07-04 7:53 ` [PATCH 10/25] media: iris: Send dummy buffer address for all codecs during drain Dikshita Agarwal
2025-07-16 7:14 ` Vikash Garodia
2025-07-04 7:53 ` [PATCH 11/25] media: iris: Fix missing LAST flag handling " Dikshita Agarwal
2025-07-16 7:26 ` Vikash Garodia
2025-07-04 7:53 ` Dikshita Agarwal [this message]
2025-07-04 7:53 ` [PATCH 13/25] media: iris: Initialize and deinitialize encoder instance structure Dikshita Agarwal
2025-07-04 7:53 ` [PATCH 14/25] media: iris: Add support for ENUM_FMT, S/G/TRY_FMT encoder Dikshita Agarwal
2025-07-04 7:53 ` [PATCH 15/25] media: iris: Add support for ENUM_FRAMESIZES/FRAMEINTERVALS for encoder Dikshita Agarwal
2025-07-04 7:53 ` [PATCH 16/25] media: iris: Add support for VIDIOC_QUERYCAP for encoder video device Dikshita Agarwal
2025-07-04 7:53 ` [PATCH 17/25] media: iris: Add encoder support for V4L2 event subscription Dikshita Agarwal
2025-07-04 7:53 ` [PATCH 18/25] media: iris: Add support for G/S_SELECTION for encoder video device Dikshita Agarwal
2025-07-04 7:53 ` [PATCH 19/25] media: iris: Add support for G/S_PARM " Dikshita Agarwal
2025-07-04 7:53 ` [PATCH 20/25] media: iris: Add platform-specific capabilities " Dikshita Agarwal
2025-07-04 7:53 ` [PATCH 21/25] media: iris: Add V4L2 streaming support " Dikshita Agarwal
2025-07-04 7:53 ` [PATCH 22/25] media: iris: Set platform capabilities to firmware " Dikshita Agarwal
2025-07-04 7:53 ` [PATCH 23/25] media: iris: Allocate and queue internal buffers " Dikshita Agarwal
2025-07-04 7:53 ` [PATCH 24/25] media: iris: Add support for buffer management ioctls for encoder device Dikshita Agarwal
2025-07-04 7:53 ` [PATCH 25/25] media: iris: Add support for drain sequence in encoder video device Dikshita Agarwal
2025-07-17 5:35 ` [PATCH 00/25] Enable H.264/H.265 encoder support and fixes in common code Vikash Garodia
2025-07-23 6:40 ` Dikshita Agarwal
2025-07-23 8:34 ` Bryan O'Donoghue
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=20250704-iris-video-encoder-v1-12-b6ce24e273cf@quicinc.com \
--to=quic_dikshita@quicinc.com \
--cc=abhinav.kumar@linux.dev \
--cc=bryan.odonoghue@linaro.org \
--cc=hverkuil@xs4all.nl \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=quic_vgarodia@quicinc.com \
--cc=quic_vnagar@quicinc.com \
--cc=stefan.schmidt@linaro.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 NNTP newsgroup(s).