[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d8e64561-f2bf-0486-f607-7c1203e4df43@quicinc.com>
Date: Thu, 14 Aug 2025 19:41:49 +0530
From: Vikash Garodia <quic_vgarodia@...cinc.com>
To: Dikshita Agarwal <quic_dikshita@...cinc.com>,
Abhinav Kumar
<abhinav.kumar@...ux.dev>,
Bryan O'Donoghue <bryan.odonoghue@...aro.org>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Hans Verkuil
<hverkuil@...all.nl>,
Stefan Schmidt <stefan.schmidt@...aro.org>,
"Vedang
Nagar" <quic_vnagar@...cinc.com>
CC: <linux-media@...r.kernel.org>, <linux-arm-msm@...r.kernel.org>,
<linux-kernel@...r.kernel.org>,
Renjiang Han <quic_renjiang@...cinc.com>,
Wangao Wang <quic_wangaow@...cinc.com>
Subject: Re: [PATCH v2 11/24] media: iris: Add support for video encoder
device
On 8/13/2025 3:08 PM, Dikshita Agarwal wrote:
> Add support for registering a V4L2 encoder video device to the iris
> driver. The encoder device is registered with the name
> "qcom-iris-encoder".
>
> Tested-by: Vikash Garodia <quic_vgarodia@...cinc.com> # X1E80100
> Signed-off-by: Dikshita Agarwal <quic_dikshita@...cinc.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);
>
Reviewed-by: Vikash Garodia <quic_vgarodia@...cinc.com>
Powered by blists - more mailing lists