From nobody Thu Nov 14 07:31:30 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C234BC54EBE for ; Fri, 13 Jan 2023 09:04:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240968AbjAMJEB (ORCPT ); Fri, 13 Jan 2023 04:04:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236790AbjAMJDb (ORCPT ); Fri, 13 Jan 2023 04:03:31 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AA8559F87; Fri, 13 Jan 2023 01:03:29 -0800 (PST) X-UUID: 22ab4a26932111ed945fc101203acc17-20230113 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=8MCV3LWuemSF0zpvHWCgCKEgR1CAQBw+WQx6QagnncE=; b=lf03smHrF0sKpVK3ZAUD43hKvS8ZVH0j8jpF4ApQcQwYEwTNmTdAT5vzyoleex7d85ouktjATG1dqBFFdrtJLjH5CEOF0IymbOfjpR/KtqHGVKobkbfP3uRrViG2UTUORAyB54JT4BLXEpdV8IcMzIlzxsboBHt93dvLWnzqM9k=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.17,REQID:5eac8db0-e1f6-42a7-8d7f-162a8038f558,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:70 X-CID-INFO: VERSION:1.1.17,REQID:5eac8db0-e1f6-42a7-8d7f-162a8038f558,IP:0,URL :0,TC:0,Content:-25,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTI ON:quarantine,TS:70 X-CID-META: VersionHash:543e81c,CLOUDID:8d74baf5-ff42-4fb0-b929-626456a83c14,B ulkID:2301131703279LH23KUD,BulkQuantity:0,Recheck:0,SF:38|28|17|19|48,TC:n il,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OS I:0,OSA:0 X-CID-APTURL: Status:success,Category:nil,Trust:0,Unknown:0,Malicious:0 X-CID-BVR: 0,NGT X-UUID: 22ab4a26932111ed945fc101203acc17-20230113 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 360243109; Fri, 13 Jan 2023 17:03:24 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.3; Fri, 13 Jan 2023 17:03:23 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Fri, 13 Jan 2023 17:03:23 +0800 From: Moudy Ho To: Mauro Carvalho Chehab , Matthias Brugger , Hans Verkuil CC: Chun-Kuang Hu , , , , , Moudy Ho Subject: [PATCH v3 07/13] media: platform: mtk-mdp3: avoid multiple driver registrations Date: Fri, 13 Jan 2023 17:03:15 +0800 Message-ID: <20230113090321.25128-8-moudy.ho@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230113090321.25128-1-moudy.ho@mediatek.com> References: <20230113090321.25128-1-moudy.ho@mediatek.com> MIME-Version: 1.0 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- 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 =3D pdev; mdp->mdp_data =3D of_device_get_match_data(&pdev->dev); =20 + if (strcmp(dev->of_node->name, MDP_NODE_NAME)) { + platform_set_drvdata(pdev, mdp); + goto success_return; + } + mm_pdev =3D __get_pdev_by_id(pdev, NULL, MDP_INFRA_MMSYS); if (IS_ERR_OR_NULL(mm_pdev)) { ret =3D -ENODEV; @@ -224,7 +229,6 @@ static int mdp_probe(struct platform_device *pdev) p =3D (id && mm2_pdev) ? mm2_pdev : mm_pdev; m =3D (id && mm2_pdev) ? mdp->mdp_mutex2 : mdp->mdp_mutex; - if (m[mutex_id]) continue; m[mutex_id] =3D mtk_mutex_get(&p->dev); @@ -293,6 +297,7 @@ static int mdp_probe(struct platform_device *pdev) goto err_unregister_device; } =20 +success_return: dev_dbg(dev, "mdp-%d registered successfully\n", pdev->id); return 0; =20 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" =20 +#define MDP_NODE_NAME "mdp3-rdma0" #define MDP_MODULE_NAME "mtk-mdp3" #define MDP_DEVICE_NAME "MediaTek MDP3" #define MDP_PHANDLE_NAME "mediatek,mdp3" --=20 2.18.0