public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Dikshita Agarwal <quic_dikshita@quicinc.com>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	stanimir.k.varbanov@gmail.com, quic_vgarodia@quicinc.com,
	agross@kernel.org, andersson@kernel.org,
	konrad.dybcio@linaro.org, mchehab@kernel.org,
	bryan.odonoghue@linaro.org
Cc: linux-arm-msm@vger.kernel.org, quic_abhinavk@quicinc.com
Subject: Re: [PATCH v2 06/34] media: iris: register video device to platform driver
Date: Mon, 18 Dec 2023 20:40:09 +0200	[thread overview]
Message-ID: <416be20b-d37f-4807-9ef1-e0b67f283987@linaro.org> (raw)
In-Reply-To: <1702899149-21321-7-git-send-email-quic_dikshita@quicinc.com>

On 18/12/2023 13:32, Dikshita Agarwal wrote:
> Iris is a multi pipe based video acceleration hardware
> block that offloads video stream encoding and decoding
> from the application processor (AP). It supports H.264
> and H.265 encoding and decoding, as well as VP9 decoding.
> The AP communicates with hardware through a well defined
> protocol which provides fine-grained and asynchronous
> control over individual hardware features.
> 
> This patch introduces basic probe and remove functions.

Documentation/process/submitting-patches.rst

Other than that LGTM

> It handles setting up a video device as well as registering
> it with the V4L2 subsystem.
> 
> Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
> ---
>   drivers/media/platform/qcom/Kconfig                |   1 +
>   drivers/media/platform/qcom/Makefile               |   1 +
>   drivers/media/platform/qcom/vcodec/iris/Kconfig    |  13 +++
>   drivers/media/platform/qcom/vcodec/iris/Makefile   |   3 +
>   .../media/platform/qcom/vcodec/iris/iris_core.h    |  34 +++++++
>   .../media/platform/qcom/vcodec/iris/iris_probe.c   | 111 +++++++++++++++++++++
>   6 files changed, 163 insertions(+)
>   create mode 100644 drivers/media/platform/qcom/vcodec/iris/Kconfig
>   create mode 100644 drivers/media/platform/qcom/vcodec/iris/Makefile
>   create mode 100644 drivers/media/platform/qcom/vcodec/iris/iris_core.h
>   create mode 100644 drivers/media/platform/qcom/vcodec/iris/iris_probe.c
> 
> diff --git a/drivers/media/platform/qcom/Kconfig b/drivers/media/platform/qcom/Kconfig
> index e94142f..7c88837 100644
> --- a/drivers/media/platform/qcom/Kconfig
> +++ b/drivers/media/platform/qcom/Kconfig
> @@ -4,3 +4,4 @@ comment "Qualcomm media platform drivers"
>   
>   source "drivers/media/platform/qcom/camss/Kconfig"
>   source "drivers/media/platform/qcom/vcodec/venus/Kconfig"
> +source "drivers/media/platform/qcom/vcodec/iris/Kconfig"
> diff --git a/drivers/media/platform/qcom/Makefile b/drivers/media/platform/qcom/Makefile
> index 3d2d82b..3c76969 100644
> --- a/drivers/media/platform/qcom/Makefile
> +++ b/drivers/media/platform/qcom/Makefile
> @@ -1,3 +1,4 @@
>   # SPDX-License-Identifier: GPL-2.0-only
>   obj-y += camss/
>   obj-y += vcodec/venus/
> +obj-y += vcodec/iris/
> diff --git a/drivers/media/platform/qcom/vcodec/iris/Kconfig b/drivers/media/platform/qcom/vcodec/iris/Kconfig
> new file mode 100644
> index 0000000..850a5b4
> --- /dev/null
> +++ b/drivers/media/platform/qcom/vcodec/iris/Kconfig
> @@ -0,0 +1,13 @@
> +config VIDEO_QCOM_IRIS
> +        tristate "Qualcomm Iris V4L2 encoder/decoder driver"
> +        depends on VIDEO_DEV
> +        depends on ARCH_QCOM
> +        select QCOM_MDT_LOADER if ARCH_QCOM
> +        select QCOM_SCM
> +        select DMABUF_HEAPS
> +	select DMABUF_HEAPS_SYSTEM
> +        help
> +          This is a V4L2 driver for Qualcomm Iris video accelerator
> +          hardware. It accelerates encoding and decoding operations
> +          on various Qualcomm SoCs.
> +          To compile this driver as a module choose m here.
> diff --git a/drivers/media/platform/qcom/vcodec/iris/Makefile b/drivers/media/platform/qcom/vcodec/iris/Makefile
> new file mode 100644
> index 0000000..5536ae0
> --- /dev/null
> +++ b/drivers/media/platform/qcom/vcodec/iris/Makefile
> @@ -0,0 +1,3 @@
> +iris-objs += iris_probe.o
> +
> +obj-$(CONFIG_VIDEO_QCOM_IRIS) += iris.o
> diff --git a/drivers/media/platform/qcom/vcodec/iris/iris_core.h b/drivers/media/platform/qcom/vcodec/iris/iris_core.h
> new file mode 100644
> index 0000000..ab7fcee
> --- /dev/null
> +++ b/drivers/media/platform/qcom/vcodec/iris/iris_core.h
> @@ -0,0 +1,34 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +/*
> + * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
> + */
> +
> +#ifndef _IRIS_CORE_H_
> +#define _IRIS_CORE_H_
> +
> +#include <linux/types.h>
> +#include <media/v4l2-device.h>
> +
> +/**
> + * struct iris_core - holds core parameters valid for all instances
> + *
> + * @dev: reference to device structure
> + * @reg_base: IO memory base address
> + * @irq: iris irq
> + * @v4l2_dev: a holder for v4l2 device structure
> + * @vdev_dec: iris video device structure for decoder
> + * @v4l2_file_ops: iris v4l2 file ops
> + * @v4l2_ioctl_ops: iris v4l2 ioctl ops
> + */
> +
> +struct iris_core {
> +	struct device				*dev;
> +	void __iomem				*reg_base;
> +	int					irq;
> +	struct v4l2_device			v4l2_dev;
> +	struct video_device			*vdev_dec;
> +	const struct v4l2_file_operations	*v4l2_file_ops;
> +	const struct v4l2_ioctl_ops		*v4l2_ioctl_ops;
> +};
> +
> +#endif
> diff --git a/drivers/media/platform/qcom/vcodec/iris/iris_probe.c b/drivers/media/platform/qcom/vcodec/iris/iris_probe.c
> new file mode 100644
> index 0000000..2e93118
> --- /dev/null
> +++ b/drivers/media/platform/qcom/vcodec/iris/iris_probe.c
> @@ -0,0 +1,111 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
> + */
> +
> +#include <linux/module.h>
> +#include <linux/of_device.h>
> +#include <linux/platform_device.h>
> +
> +#include "iris_core.h"
> +
> +static int iris_register_video_device(struct iris_core *core)
> +{
> +	struct video_device *vdev;
> +	int ret;
> +
> +	vdev = video_device_alloc();
> +	if (!vdev)
> +		return -ENOMEM;
> +
> +	strscpy(vdev->name, "qcom-iris-decoder", sizeof(vdev->name));
> +	vdev->release = video_device_release;
> +	vdev->fops = core->v4l2_file_ops;
> +	vdev->ioctl_ops = core->v4l2_ioctl_ops;
> +	vdev->vfl_dir = VFL_DIR_M2M;
> +	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)
> +		goto err_vdev_release;
> +
> +	core->vdev_dec = vdev;
> +	video_set_drvdata(vdev, core);
> +
> +	return ret;
> +
> +err_vdev_release:
> +	video_device_release(vdev);
> +
> +	return ret;
> +}
> +
> +static void iris_remove(struct platform_device *pdev)
> +{
> +	struct iris_core *core;
> +
> +	core = platform_get_drvdata(pdev);
> +	if (!core)
> +		return;
> +
> +	video_unregister_device(core->vdev_dec);
> +
> +	v4l2_device_unregister(&core->v4l2_dev);
> +}
> +
> +static int iris_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct iris_core *core;
> +	int ret;
> +
> +	core = devm_kzalloc(&pdev->dev, sizeof(*core), GFP_KERNEL);
> +	if (!core)
> +		return -ENOMEM;
> +	core->dev = dev;
> +
> +	core->reg_base = devm_platform_ioremap_resource(pdev, 0);
> +	if (IS_ERR(core->reg_base))
> +		return PTR_ERR(core->reg_base);
> +
> +	core->irq = platform_get_irq(pdev, 0);
> +	if (core->irq < 0)
> +		return core->irq;
> +
> +	ret = v4l2_device_register(dev, &core->v4l2_dev);
> +	if (ret)
> +		return ret;
> +
> +	ret = iris_register_video_device(core);
> +	if (ret)
> +		goto err_v4l2_unreg;
> +
> +	platform_set_drvdata(pdev, core);
> +
> +	return ret;
> +
> +err_v4l2_unreg:
> +	v4l2_device_unregister(&core->v4l2_dev);
> +
> +	return ret;
> +}
> +
> +static const struct of_device_id iris_dt_match[] = {
> +	{ .compatible = "qcom,sm8550-iris", },
> +	{ },
> +};
> +MODULE_DEVICE_TABLE(of, iris_dt_match);
> +
> +static struct platform_driver qcom_iris_driver = {
> +	.probe = iris_probe,
> +	.remove_new = iris_remove,
> +	.driver = {
> +		.name = "qcom-iris",
> +		.of_match_table = iris_dt_match,
> +	},
> +};
> +
> +module_platform_driver(qcom_iris_driver);
> +MODULE_DESCRIPTION("Qualcomm Iris video driver");
> +MODULE_LICENSE("GPL");

-- 
With best wishes
Dmitry


  reply	other threads:[~2023-12-18 18:40 UTC|newest]

Thread overview: 102+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-18 11:31 [PATCH v2 00/34] Qualcomm video encoder and decoder driver Dikshita Agarwal
2023-12-18 11:31 ` [PATCH v2 01/34] media: introduce common helpers for video firmware handling Dikshita Agarwal
2023-12-18 18:24   ` Dmitry Baryshkov
2023-12-20  8:01     ` Dikshita Agarwal
2023-12-20  8:12       ` Dmitry Baryshkov
2023-12-20 17:10         ` Abhinav Kumar
2023-12-20 20:56           ` Dmitry Baryshkov
2023-12-20 21:03             ` Abhinav Kumar
2023-12-19 11:40   ` Bryan O'Donoghue
2023-12-19 13:26     ` Dmitry Baryshkov
2023-12-20  8:01       ` Dikshita Agarwal
2023-12-18 11:31 ` [PATCH v2 02/34] media: introduce common helpers for queues handling Dikshita Agarwal
2023-12-18 18:29   ` Dmitry Baryshkov
2023-12-20  8:03     ` Dikshita Agarwal
2023-12-18 11:31 ` [PATCH v2 03/34] media: introduce common helpers for buffer size calculation Dikshita Agarwal
2023-12-18 18:32   ` Dmitry Baryshkov
2023-12-20  8:04     ` Dikshita Agarwal
2023-12-20  8:15       ` Dmitry Baryshkov
2023-12-18 11:31 ` [PATCH v2 04/34] dt-bindings: media: Add sm8550 dt schema Dikshita Agarwal
2023-12-18 16:10   ` Krzysztof Kozlowski
2023-12-18 18:17   ` Dmitry Baryshkov
2023-12-18 11:32 ` [PATCH v2 05/34] media: MAINTAINERS: Add Qualcomm Iris video accelerator driver Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 06/34] media: iris: register video device to platform driver Dikshita Agarwal
2023-12-18 18:40   ` Dmitry Baryshkov [this message]
2023-12-18 11:32 ` [PATCH v2 07/34] media: iris: initialize power resources Dikshita Agarwal
2023-12-18 15:09   ` Konrad Dybcio
2023-12-20  8:04     ` Dikshita Agarwal
2024-01-03 13:45       ` Konrad Dybcio
2023-12-18 11:32 ` [PATCH v2 08/34] media: iris: introduce state machine for iris core Dikshita Agarwal
2023-12-18 18:46   ` Dmitry Baryshkov
2023-12-20  8:05     ` Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 09/34] media: iris: initialize shared queues for host and firmware communication Dikshita Agarwal
2023-12-18 18:46   ` Dmitry Baryshkov
2023-12-20  8:05     ` Dikshita Agarwal
2023-12-18 21:33   ` Konrad Dybcio
2023-12-20  8:05     ` Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 10/34] media: iris: add PIL functionality for video firmware Dikshita Agarwal
2023-12-18 21:40   ` Konrad Dybcio
2023-12-20  8:15     ` Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 11/34] media: iris: introduce packetization layer for creating HFI packets Dikshita Agarwal
2023-12-18 21:50   ` Konrad Dybcio
2023-12-18 11:32 ` [PATCH v2 12/34] media: iris: add video processing unit(VPU) specific register handling Dikshita Agarwal
2023-12-18 16:19   ` Krzysztof Kozlowski
2023-12-18 22:00   ` Konrad Dybcio
2023-12-18 11:32 ` [PATCH v2 13/34] media: iris: introduce platform specific capabilities for core and instance Dikshita Agarwal
2023-12-18 22:08   ` Konrad Dybcio
2023-12-18 11:32 ` [PATCH v2 14/34] media: iris: implement iris v4l2 file ops Dikshita Agarwal
2023-12-19 11:57   ` Bryan O'Donoghue
2023-12-18 11:32 ` [PATCH v2 15/34] media: iris: add handling for interrupt service routine(ISR) invoked by hardware Dikshita Agarwal
2023-12-19 11:48   ` Konrad Dybcio
2023-12-18 11:32 ` [PATCH v2 16/34] media: iris: implement iris v4l2_ctrl_ops and prepare capabilities Dikshita Agarwal
2023-12-19 11:50   ` Konrad Dybcio
2023-12-18 11:32 ` [PATCH v2 17/34] media: iris: implement vb2_ops queue setup Dikshita Agarwal
2023-12-19 11:56   ` Konrad Dybcio
2023-12-20  8:37     ` Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 18/34] media: iris: introduce and implement iris vb2 mem ops Dikshita Agarwal
2023-12-19 11:58   ` Konrad Dybcio
2023-12-18 11:32 ` [PATCH v2 19/34] media: iris: implement HFI to queue and release buffers Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 20/34] media: iris: add video hardware internal buffer count and size calculation Dikshita Agarwal
2023-12-19 12:06   ` Bryan O'Donoghue
2023-12-20  8:29     ` Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 21/34] media: iris: implement internal buffer management Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 22/34] media: iris: introduce instance states Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 23/34] media: iris: implement iris v4l2 ioctl ops supported by decoder Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 24/34] media: iris: subscribe input and output properties to firmware Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 25/34] media: iris: subscribe src change and handle firmware responses Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 26/34] media: iris: implement vb2 streaming ops on capture and output planes Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 27/34] media: iris: implement vb2 ops for buf_queue and firmware response Dikshita Agarwal
2023-12-19 12:21   ` Konrad Dybcio
2023-12-20  8:25     ` Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 28/34] media: iris: add instance sub states and implement DRC and Drain sequence Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 29/34] media: iris: implement power management Dikshita Agarwal
2023-12-19 12:24   ` Konrad Dybcio
2023-12-20  8:23     ` Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 30/34] media: iris: register video encoder device to platform driver Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 31/34] media: iris: add platform specific instance capabilities for encoder Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 32/34] media: iris: implement iris v4l2 ioctl ops supported by encoder Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 33/34] media: iris: add vb2 streaming and buffer ops for encoder Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 34/34] media: iris: add power management " Dikshita Agarwal
2023-12-19 12:26   ` Konrad Dybcio
2023-12-18 12:09 ` [PATCH v2 00/34] Qualcomm video encoder and decoder driver Dikshita Agarwal
2023-12-18 14:36 ` Bryan O'Donoghue
2023-12-18 18:38 ` Dmitry Baryshkov
2023-12-19 12:10   ` Bryan O'Donoghue
2023-12-20  6:32   ` Vikash Garodia
2023-12-20  7:37     ` Dmitry Baryshkov
2023-12-20  8:14       ` Vikash Garodia
2023-12-20  8:39         ` Dmitry Baryshkov
2023-12-20  8:53           ` Vikash Garodia
2023-12-20  9:52             ` Dmitry Baryshkov
2023-12-20 18:55               ` Abhinav Kumar
2023-12-20 21:24                 ` Dmitry Baryshkov
2023-12-20  8:15     ` Krzysztof Kozlowski
2023-12-20  8:32       ` Vikash Garodia
2023-12-20 20:51 ` Nicolas Dufresne
2024-02-29 15:09 ` Vikash Garodia
2024-03-12 10:37   ` Hans Verkuil
2024-03-15 13:51     ` Vikash Garodia
2024-04-12  7:13 ` Hyunjun Ko
2024-04-12 13:52   ` Bryan O'Donoghue
2024-05-16  7:57 ` Hyunjun Ko
2024-05-16  8:06   ` Vikash Garodia

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=416be20b-d37f-4807-9ef1-e0b67f283987@linaro.org \
    --to=dmitry.baryshkov@linaro.org \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=konrad.dybcio@linaro.org \
    --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_abhinavk@quicinc.com \
    --cc=quic_dikshita@quicinc.com \
    --cc=quic_vgarodia@quicinc.com \
    --cc=stanimir.k.varbanov@gmail.com \
    /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