Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8822947rwb; Thu, 24 Nov 2022 04:55:11 -0800 (PST) X-Google-Smtp-Source: AA0mqf7HUvCDfQ0pLL6MuRn2etI48pgFKESpv/8ZCo0eue1R63KojLy5gX7BnKym09mw8Lri3c1E X-Received: by 2002:a05:6a00:1d81:b0:571:ea17:e111 with SMTP id z1-20020a056a001d8100b00571ea17e111mr14225905pfw.25.1669294511166; Thu, 24 Nov 2022 04:55:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669294511; cv=none; d=google.com; s=arc-20160816; b=GhLH7gXW4VXQ+LK1FZSAobhSGhCoala54OpolLgu06rMFVSCxdZAOVxH9NB43DLU2c hBMr2bVvOGfu86pMgUnFcNBZefO3vJ6JR2cV1IJUX9hMEXO/u2DIfpu1GuTAsPfglAnu /6nTkgOga2d25QF3THTlfCIacloghi7wg9m8Q+28TNAcW2trw5w9znu95n69PnJDvPId xcd8kRXiA8R7P+2pTInhOYjRk0p3WTsuG1HQlvekfKpynIjYe4i8YIivCOwGznxKQaeM E+wb5huVFZoy3VKgyhScLQiUdNN3Zw+HsJtBlBAcrzt4ON+cwfaUYiheXVgR7II9s59/ saiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=XGWtzqysHWwyBDnERg/YWC0l0GaSJFvhb+qWs3XLQOk=; b=rCY+pWHnnJ1mXz4gDwjc/ACXkVT20ZF4dhlX16Dk550pZlgsfx4YHHaXh0q7nDXP1p HSSLfOSUZoK8r3THyTUc3TwbsS/RfDZnOb3/UCtn7olZ8Be/rliEHCEVkh/RFmL89FEP xMs5QlICi/TIIi6U+v2D+GLjyHMoMt4z+IPGW8qie4r39S/fyMNS1CXorUroSTOJAYc0 77t7AqGw0a2N9oNFFvSR7YdxcOESBPgeC6yXhm+FB+nHiBUFZciGyoSnQoPK/bQzrZEx 89mxEaQoVnUOmJBqWOLzSNOPaSuZO6zgqYl1uaZuPsjPNdnMTsJMCu1ZduMfjOlOLpGX /gAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Ae1moGna; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cn15-20020a056a00340f00b0056c2e395593si950717pfb.167.2022.11.24.04.54.58; Thu, 24 Nov 2022 04:55:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Ae1moGna; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229895AbiKXMwo (ORCPT + 86 others); Thu, 24 Nov 2022 07:52:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229829AbiKXMwh (ORCPT ); Thu, 24 Nov 2022 07:52:37 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22745F595; Thu, 24 Nov 2022 04:52:33 -0800 (PST) X-UUID: 27285d16cad1455f9d8f02dd1135091d-20221124 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=XGWtzqysHWwyBDnERg/YWC0l0GaSJFvhb+qWs3XLQOk=; b=Ae1moGnaj0wM9cunjL20JW+jkQX61XkYbhCkcqms5fBT2Kf0yBQCDMVJCJx86MZNHeCb/Qh0MpB6cP5amIG/UV0KAsrfBeK+UBSoFGNLQQ+n7OfXO8760Jt0H3XlLnfCyMyQH4eMcOrTGHuFxUBotDZ9NQMYuMpPLH6/Yz7V8Qo=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.14,REQID:ff1cd509-fb37-4b6b-8fed-3ba6ada5d9a8,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:dcaaed0,CLOUDID:3717bb2f-2938-482e-aafd-98d66723b8a9,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: 27285d16cad1455f9d8f02dd1135091d-20221124 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 473209333; Thu, 24 Nov 2022 20:52:29 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Thu, 24 Nov 2022 20:52:27 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Thu, 24 Nov 2022 20:52:28 +0800 From: Moudy Ho To: Mauro Carvalho Chehab , Matthias Brugger , Hans Verkuil CC: Chun-Kuang Hu , , , , , Moudy Ho Subject: [PATCH v1 08/12] media: platform: mtk-mdp3: avoid multiple driver registrations Date: Thu, 24 Nov 2022 20:52:21 +0800 Message-ID: <20221124125225.24538-9-moudy.ho@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20221124125225.24538-1-moudy.ho@mediatek.com> References: <20221124125225.24538-1-moudy.ho@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 = 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 49b6e9c8e089..e5bd75ff90ee 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