Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2644676rwb; Sun, 15 Jan 2023 19:43:27 -0800 (PST) X-Google-Smtp-Source: AMrXdXvvCXkwkZTyysPDSqL+1FZs4nCK6M1FO2EyGujcrjzxkUesehSl8L+XWotYPDZZ65QnLIMA X-Received: by 2002:a17:907:d601:b0:870:34c:97cf with SMTP id wd1-20020a170907d60100b00870034c97cfmr3750456ejc.25.1673840607100; Sun, 15 Jan 2023 19:43:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673840607; cv=none; d=google.com; s=arc-20160816; b=I5QQxw875UeJrJIbMGuHmc5+yJg1xurg0qHuLJ6waGLIUUQQCA0LGVWt97zPjTJzKw kEUvjc24wEZ9DKpsLz6BhVQKXevQHej81Bmy6VfValMY0vuZgEYXU/971yKaB0A3Rc+r QFTDjjOYvS8rfvtoUSvwaL3iDdaSR2L5/NyunWJcOZ5eo1a7pYobi+MnwrrJfSW+K2nd rF8PaxE8qAgv0dLiI3aRdgXsbyKcLxupiRXWKppE6mzj1Aeu/Ksf05Mle42geuzoMdLd cBdohbGeM2yw96EkdueE87DBmpVL6q8jLy6FQiILewydCKQCura2RRlmybEJj/zTCB1z +SEA== 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=8MCV3LWuemSF0zpvHWCgCKEgR1CAQBw+WQx6QagnncE=; b=BLIHom9eU5ptze6anoqGNtDvSBDXS0WEkqIFbtLPsKgM1aPKKEjS9p84aOMAj4ogxx X5jDEWKLOy+NNhmZg+iOZ32kSUyiAE6Im4B1xVgrYRRjo9UAkXRiMzU1rq4iK3tCtyK8 v+AtuMg2ZshvwDJucL4QJduIGzM9bDvBJCLGZf3bzZNKRSb6QPQDyLEyZ/sQVHzg7FJM 532zTe50/OcqVkXBJou4OPBXDvU2hItCCS52JpyPtyHXcvpBamCg3cbVFgqxmL/OjGo8 2HdoLavTP9sD/NQk00ghffyBXYt3yDZJMUcDhsmyq9qmIna3WEkzhBruC/PFNrZRIEDa AhFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Idmzp9Qw; 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 wz11-20020a170906fe4b00b0084d354539d7si5214578ejb.195.2023.01.15.19.43.14; Sun, 15 Jan 2023 19:43:27 -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=Idmzp9Qw; 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 S231735AbjAPDWk (ORCPT + 52 others); Sun, 15 Jan 2023 22:22:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231810AbjAPDWE (ORCPT ); Sun, 15 Jan 2023 22:22:04 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF2F27A97; Sun, 15 Jan 2023 19:21:58 -0800 (PST) X-UUID: ea9b39d8954c11eda06fc9ecc4dadd91-20230116 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=Idmzp9Qw+cPCJ3pxejJRK49i+a6bac3wrIlUO3vug7x97YM1Te2Rn2rpUGaKDdVnED3E+GOnfnaUHJoddZR/uAS6K7wR9FFULTWb0rUA2WL/WgHyejpVGsn5dJBQZZWDiKdABjjmOlZlWe7ROXbZy5q1Krh0xuZMmMVQaCuqutE=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.17,REQID:0aa267cf-b8b2-4278-b452-ca35389600a8,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:0aa267cf-b8b2-4278-b452-ca35389600a8,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:ced2e4f5-ff42-4fb0-b929-626456a83c14,B ulkID:2301131703279LH23KUD,BulkQuantity:7,Recheck:0,SF:38|28|17|19|48,TC:n il,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:41,QS:nil,BEC:nil,COL:0,OSI :0,OSA:0 X-CID-APTURL: Status:success,Category:nil,Trust:0,Unknown:0,Malicious:0 X-CID-BVR: 0,NGT X-UUID: ea9b39d8954c11eda06fc9ecc4dadd91-20230116 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 695081176; Mon, 16 Jan 2023 11:21:50 +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; Mon, 16 Jan 2023 11:21:49 +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; Mon, 16 Jan 2023 11:21:49 +0800 From: Moudy Ho To: Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Matthias Brugger CC: , , , , , , Moudy Ho Subject: [RESEND v3 07/13] media: platform: mtk-mdp3: avoid multiple driver registrations Date: Mon, 16 Jan 2023 11:21:41 +0800 Message-ID: <20230116032147.23607-8-moudy.ho@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230116032147.23607-1-moudy.ho@mediatek.com> References: <20230116032147.23607-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 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