[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210611140124.v2.5.I0cbd6691d3edfa2757bd6f5de7acfce94b101480@changeid>
Date: Fri, 11 Jun 2021 14:01:42 +1000
From: Eizan Miyamoto <eizan@...omium.org>
To: linux-kernel@...r.kernel.org
Cc: houlong.wei@...iatek.com, enric.balletbo@...labora.com,
yong.wu@...iatek.com, chunkuang.hu@...nel.org,
Eizan Miyamoto <eizan@...omium.org>,
Andrew-CT Chen <andrew-ct.chen@...iatek.com>,
Matthias Brugger <matthias.bgg@...il.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Minghsiu Tsai <minghsiu.tsai@...iatek.com>,
linux-arm-kernel@...ts.infradead.org, linux-media@...r.kernel.org,
linux-mediatek@...ts.infradead.org
Subject: [PATCH v2 5/8] media: mtk-mdp: search for vpu node instead of linking it to a property
Since there is only one vpu node, it suffices to search for it instead
of having a link coded into the primary mdp device node.
Signed-off-by: Eizan Miyamoto <eizan@...omium.org>
---
(no changes since v1)
drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 6 ----
drivers/media/platform/mtk-mdp/mtk_mdp_core.c | 28 +++++++++++++------
2 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c
index fdbb46a5330a..3d9bb7265159 100644
--- a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c
+++ b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c
@@ -117,12 +117,6 @@ static int mtk_mdp_comp_bind(struct device *dev, struct device *master,
if (vpu_node) {
int ret;
- mdp->vpu_dev = of_find_device_by_node(vpu_node);
- if (WARN_ON(!mdp->vpu_dev)) {
- dev_err(dev, "vpu pdev failed\n");
- of_node_put(vpu_node);
- }
-
ret = v4l2_device_register(dev, &mdp->v4l2_dev);
if (ret) {
dev_err(dev, "Failed to register v4l2 device\n");
diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c
index 267e4cb4bf32..48e9a557c446 100644
--- a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c
+++ b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c
@@ -113,6 +113,7 @@ static void release_of(struct device *dev, void *data)
static int mtk_mdp_master_bind(struct device *dev)
{
int status;
+ struct device_node *vpu_node;
struct mtk_mdp_dev *mdp = dev_get_drvdata(dev);
status = component_bind_all(dev, mdp);
@@ -121,15 +122,24 @@ static int mtk_mdp_master_bind(struct device *dev)
goto err_component_bind_all;
}
- if (mdp->vpu_dev) {
- int ret = vpu_wdt_reg_handler(mdp->vpu_dev, mtk_mdp_reset_handler, mdp,
- VPU_RST_MDP);
- if (ret) {
- dev_err(dev, "Failed to register reset handler\n");
- goto err_wdt_reg;
- }
- } else {
- dev_err(dev, "no vpu_dev found\n");
+ vpu_node = of_find_node_by_name(NULL, "vpu");
+ if (!vpu_node) {
+ dev_err(dev, "unable to find vpu node");
+ status = -ENODEV;
+ goto err_wdt_reg;
+ }
+
+ mdp->vpu_dev = of_find_device_by_node(vpu_node);
+ if (!mdp->vpu_dev) {
+ dev_err(dev, "unable to find vpu device");
+ status = -ENODEV;
+ goto err_wdt_reg;
+ }
+
+ status = vpu_wdt_reg_handler(mdp->vpu_dev, mtk_mdp_reset_handler, mdp, VPU_RST_MDP);
+ if (status) {
+ dev_err(dev, "Failed to register reset handler\n");
+ goto err_wdt_reg;
}
status = mtk_mdp_register_m2m_device(mdp);
--
2.32.0.272.g935e593368-goog
Powered by blists - more mailing lists