lkml.org 
[lkml]   [2023]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RESEND v3 07/13] media: platform: mtk-mdp3: avoid multiple driver registrations
Date
The number of MDP3 driver probes depends on the registered clocks of MMSYS.
Because VPPSYS0 and VPPSYS1 are used in MT8195 MDP3, it is necessary to
avoid multiple driver registrations.

Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
---
drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c | 7 ++++++-
drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h | 1 +
2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
index 56c42bd3f16b..6e3abadef6cd 100644
--- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
+++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
@@ -187,6 +187,11 @@ static int mdp_probe(struct platform_device *pdev)
mdp->pdev = pdev;
mdp->mdp_data = of_device_get_match_data(&pdev->dev);

+ if (strcmp(dev->of_node->name, MDP_NODE_NAME)) {
+ platform_set_drvdata(pdev, mdp);
+ goto success_return;
+ }
+
mm_pdev = __get_pdev_by_id(pdev, NULL, MDP_INFRA_MMSYS);
if (IS_ERR_OR_NULL(mm_pdev)) {
ret = -ENODEV;
@@ -224,7 +229,6 @@ static int mdp_probe(struct platform_device *pdev)
p = (id && mm2_pdev) ? mm2_pdev : mm_pdev;
m = (id && mm2_pdev) ?
mdp->mdp_mutex2 : mdp->mdp_mutex;
-
if (m[mutex_id])
continue;
m[mutex_id] = mtk_mutex_get(&p->dev);
@@ -293,6 +297,7 @@ static int mdp_probe(struct platform_device *pdev)
goto err_unregister_device;
}

+success_return:
dev_dbg(dev, "mdp-%d registered successfully\n", pdev->id);
return 0;

diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h
index ce9e2b9850e6..e3e60b106c72 100644
--- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h
+++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h
@@ -14,6 +14,7 @@
#include "mtk-mdp3-comp.h"
#include "mtk-mdp3-vpu.h"

+#define MDP_NODE_NAME "mdp3-rdma0"
#define MDP_MODULE_NAME "mtk-mdp3"
#define MDP_DEVICE_NAME "MediaTek MDP3"
#define MDP_PHANDLE_NAME "mediatek,mdp3"
--
2.18.0
\
 
 \ /
  Last update: 2023-03-26 23:42    [W:0.238 / U:0.424 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site