devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vikash Garodia <quic_vgarodia@quicinc.com>
To: Dikshita Agarwal <quic_dikshita@quicinc.com>,
	Abhinav Kumar <abhinav.kumar@linux.dev>,
	Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>
Cc: <linux-media@vger.kernel.org>, <linux-arm-msm@vger.kernel.org>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Vikash Garodia <quic_vgarodia@quicinc.com>
Subject: [PATCH v3 2/5] media: iris: register and configure non-pixel node as platform device
Date: Fri, 27 Jun 2025 21:18:08 +0530	[thread overview]
Message-ID: <20250627-video_cb-v3-2-51e18c0ffbce@quicinc.com> (raw)
In-Reply-To: <20250627-video_cb-v3-0-51e18c0ffbce@quicinc.com>

Register "non_pixel" child node as a platform device, and configure its
DMA via of_dma_configure(). This ensures proper IOMMU attachment and DMA
setup for the "non_pixel" device.
All non pixel memory, i.e bitstream buffers, HFI queues and internal
buffers related to bitstream processing, would be managed by non_pixel
device.

Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
---
 drivers/media/platform/qcom/iris/iris_core.h  |  2 ++
 drivers/media/platform/qcom/iris/iris_probe.c | 50 ++++++++++++++++++++++++++-
 2 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/qcom/iris/iris_core.h b/drivers/media/platform/qcom/iris/iris_core.h
index aeeac32a1f6d9a9fa7027e8e3db4d95f021c552e..757efd16870876bd2b1d5b1e4103b2d2326b5f49 100644
--- a/drivers/media/platform/qcom/iris/iris_core.h
+++ b/drivers/media/platform/qcom/iris/iris_core.h
@@ -65,6 +65,7 @@ struct icc_info {
  * @sys_error_handler: a delayed work for handling system fatal error
  * @instances: a list_head of all instances
  * @inst_fw_caps: an array of supported instance capabilities
+ * @np_dev: device to represent non pixel node
  */
 
 struct iris_core {
@@ -105,6 +106,7 @@ struct iris_core {
 	struct delayed_work			sys_error_handler;
 	struct list_head			instances;
 	struct platform_inst_fw_cap		inst_fw_caps[INST_FW_CAP_MAX];
+	struct device				*np_dev;
 };
 
 int iris_core_init(struct iris_core *core);
diff --git a/drivers/media/platform/qcom/iris/iris_probe.c b/drivers/media/platform/qcom/iris/iris_probe.c
index 9a7ce142f7007ffcda0bd422c1983f2374bb0d92..8fe87e30bd40f3c67ec41305c7d73520fbc9db7b 100644
--- a/drivers/media/platform/qcom/iris/iris_probe.c
+++ b/drivers/media/platform/qcom/iris/iris_probe.c
@@ -6,6 +6,8 @@
 #include <linux/clk.h>
 #include <linux/interconnect.h>
 #include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 #include <linux/pm_domain.h>
 #include <linux/pm_opp.h>
 #include <linux/pm_runtime.h>
@@ -127,6 +129,46 @@ static int iris_init_resets(struct iris_core *core)
 				     core->iris_platform_data->controller_rst_tbl_size);
 }
 
+static int iris_init_non_pixel_node(struct iris_core *core)
+{
+	struct platform_device_info info;
+	struct platform_device *pdev;
+	struct device_node *np_node;
+	int ret;
+
+	np_node = of_get_child_by_name(core->dev->of_node, "non_pixel");
+	if (!np_node)
+		return 0;
+
+	memset(&info, 0, sizeof(info));
+	info.fwnode = &np_node->fwnode;
+	info.parent = core->dev;
+	info.name = np_node->name;
+	info.dma_mask = DMA_BIT_MASK(32);
+
+	pdev = platform_device_register_full(&info);
+	if (IS_ERR(pdev)) {
+		of_node_put(np_node);
+		return PTR_ERR(pdev);
+	}
+	pdev->dev.of_node = np_node;
+
+	ret = of_dma_configure(&pdev->dev, np_node, true);
+	if (ret)
+		goto err_unregister;
+
+	core->np_dev = &pdev->dev;
+
+	of_node_put(np_node);
+
+	return 0;
+
+err_unregister:
+	platform_device_unregister(pdev);
+	of_node_put(np_node);
+	return ret;
+}
+
 static int iris_init_resources(struct iris_core *core)
 {
 	int ret;
@@ -143,7 +185,11 @@ static int iris_init_resources(struct iris_core *core)
 	if (ret)
 		return ret;
 
-	return iris_init_resets(core);
+	ret = iris_init_resets(core);
+	if (ret)
+		return ret;
+
+	return iris_init_non_pixel_node(core);
 }
 
 static int iris_register_video_device(struct iris_core *core)
@@ -188,6 +234,8 @@ static void iris_remove(struct platform_device *pdev)
 
 	iris_core_deinit(core);
 
+	platform_device_unregister(to_platform_device(core->np_dev));
+
 	video_unregister_device(core->vdev_dec);
 
 	v4l2_device_unregister(&core->v4l2_dev);

-- 
2.34.1


  parent reply	other threads:[~2025-06-27 15:48 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-27 15:48 [PATCH v3 0/5] Introduce "non-pixel" sub node within iris video node Vikash Garodia
2025-06-27 15:48 ` [PATCH v3 1/5] media: dt-bindings: add non-pixel property in iris schema Vikash Garodia
2025-06-27 16:31   ` Bryan O'Donoghue
2025-06-27 17:16     ` Vikash Garodia
2025-06-30 15:48   ` neil.armstrong
2025-06-30 15:56     ` Neil Armstrong
2025-07-02 11:13   ` Krzysztof Kozlowski
2025-07-02 11:32     ` Vikash Garodia
2025-07-02 11:46       ` Krzysztof Kozlowski
2025-07-02 13:11         ` Konrad Dybcio
2025-07-02 13:59           ` Krzysztof Kozlowski
2025-07-02 16:36             ` Vikash Garodia
2025-07-02 20:16               ` Krzysztof Kozlowski
2025-07-03 10:11             ` Konrad Dybcio
2025-07-03  7:29     ` Krzysztof Kozlowski
2025-07-02 11:23   ` Krzysztof Kozlowski
2025-07-02 11:45     ` Vikash Garodia
2025-07-02 11:47       ` Krzysztof Kozlowski
2025-07-02 11:55         ` Vikash Garodia
2025-07-02 11:58           ` Krzysztof Kozlowski
2025-07-02 12:08             ` Vikash Garodia
2025-07-02 12:11               ` Krzysztof Kozlowski
2025-06-27 15:48 ` Vikash Garodia [this message]
2025-06-27 17:01   ` [PATCH v3 2/5] media: iris: register and configure non-pixel node as platform device Bryan O'Donoghue
2025-07-02 11:04   ` Krzysztof Kozlowski
2025-07-02 11:39     ` Vikash Garodia
2025-07-02 12:45   ` Konrad Dybcio
2025-06-27 15:48 ` [PATCH v3 3/5] media: iris: use np_dev as preferred DMA device in HFI queue management Vikash Garodia
2025-06-27 17:03   ` Bryan O'Donoghue
2025-06-27 15:48 ` [PATCH v3 4/5] media: iris: select appropriate DMA device for internal buffers Vikash Garodia
2025-06-27 17:07   ` Bryan O'Donoghue
2025-06-27 15:48 ` [PATCH v3 5/5] media: iris: configure DMA device for vb2 queue on OUTPUT plane Vikash Garodia
2025-06-27 17:08   ` Bryan O'Donoghue
2025-06-30  7:58     ` Vikash Garodia
2025-07-01 12:04     ` Konrad Dybcio
2025-06-27 16:30 ` [PATCH v3 0/5] Introduce "non-pixel" sub node within iris video node Bryan O'Donoghue
2025-06-27 17:00   ` Vikash Garodia
2025-07-02 11:05   ` Krzysztof Kozlowski
2025-06-30 15:55 ` neil.armstrong
2025-06-30 18:04 ` neil.armstrong
2025-07-01  8:42   ` Konrad Dybcio
2025-07-01 10:23   ` Vikash Garodia
2025-07-01 13:19     ` Neil Armstrong
2025-07-01 16:11       ` Vikash Garodia
2025-07-02  7:59         ` Neil Armstrong
2025-07-02 11:06     ` Krzysztof Kozlowski
2025-07-02 11:18 ` Krzysztof Kozlowski
2025-07-02 11:37   ` Vikash Garodia
2025-07-02 11:52     ` Krzysztof Kozlowski
2025-07-02 11:54       ` Krzysztof Kozlowski
2025-07-02 12:01       ` Vikash Garodia
2025-07-02 12:05         ` Krzysztof Kozlowski
2025-07-02 12:57           ` Vikash Garodia
2025-07-02 12:06         ` Bryan O'Donoghue
2025-07-02 22:26           ` Dmitry Baryshkov
2025-07-03  7:27             ` Krzysztof Kozlowski
2025-07-03 12:38               ` Konrad Dybcio
2025-07-03 12:54                 ` Krzysztof Kozlowski
2025-07-03 15:28                   ` Konrad Dybcio
2025-07-03 20:28                     ` Bryan O'Donoghue
2025-07-03 21:23                       ` Dmitry Baryshkov
2025-07-04  8:23                         ` Bryan O'Donoghue
2025-07-04 10:28                           ` Konrad Dybcio
2025-07-04 16:45                           ` Dmitry Baryshkov
2025-07-04 22:44                             ` Bryan O'Donoghue
2025-07-10 18:18                               ` Prakash Gupta
2025-07-15 12:15                                 ` Konrad Dybcio
2025-07-04 19:15                           ` 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=20250627-video_cb-v3-2-51e18c0ffbce@quicinc.com \
    --to=quic_vgarodia@quicinc.com \
    --cc=abhinav.kumar@linux.dev \
    --cc=bryan.odonoghue@linaro.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.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_dikshita@quicinc.com \
    --cc=robh@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 NNTP newsgroup(s).