Message ID | 20230919095938.70679-3-angelogioacchino.delregno@collabora.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp3472543vqi; Tue, 19 Sep 2023 08:25:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEhP9j9IpIl9aLe/oZQof3z6BzqFenZkAC44QC6baCT83TQ7zV7Iso5ABv4xekgfPyi4Ksu X-Received: by 2002:a05:6a20:8420:b0:132:2f7d:29ca with SMTP id c32-20020a056a20842000b001322f7d29camr15746619pzd.24.1695137133268; Tue, 19 Sep 2023 08:25:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695137133; cv=none; d=google.com; s=arc-20160816; b=OziO0ykJ1HLbQnBOVtzOqs8xSRJzrAN3C3nRc3L7hAOSNfkly3f5SnadX/jFuAql85 Yy3Eraw9QemRQyaIDNELsvI7sN6UE/AeAxdl02Oed7UT77nElR141YiFgHRkhAQ09ne2 dpKHDdQgbH3QsMJKTZfAD0KgFG3tXRo2v0dTgWuMl/tl+kwbNc4+aeJhe8KyLz+JeeLC 2lWKzfed1DsfCoNb1rWaePh4B0lv+kC5FFosYxs+OQXT03yNrR6n909yaC221L3yG7aH SBzsiyG2W7tQptFPy8hUk+nvzErXYEAhlmwOiX0q9qlMJZNIXlO/XBTO5PqcFSiQOjZB deZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SlwfOsv+H6AHlDKbTRxG4SD+E/FSPjYeg/3rDXmzKz8=; fh=i/LyJkRmgZBAMJ8yXV9iaklUoYAFLn5WBFFibvwWXtM=; b=WpkT4sRGkbCzNN5P47cOBdTjMih3vpH9oWzPLP/bbomcC4Og3CEtu80q/GkX1Tjlph Ah/rL0Q8eDRgjQMnXGLEIb2K7SZqIiAMgVdE1nY/ww2l7W8y3sf/PuC7GXd+7r9NZn96 jz6Px4Yi56MF2yc6F6ejhB7Vf/OVbKhFPmlc7Qr/7FUlFlRldByDHgG7FwGaB9vfkVnx gt2Vipa7Zm2CEI9tQursAUg4yOBoz/J1fUAlpk3DTFnJ4gw7fYDETilMBTO8sM+idL2T UBIJKJnHgRhq56EZOnOcYy7WGFzUZOIKwDIcry/il0RbHVkRqxJFxHS8x4gFduCMi8Pq s/HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=StKEpJ45; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id ca20-20020a056a02069400b0056603994af8si10568947pgb.666.2023.09.19.08.25.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 08:25:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=StKEpJ45; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 348FC80A0DF6; Tue, 19 Sep 2023 03:00:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231493AbjISKAJ (ORCPT <rfc822;toshivichauhan@gmail.com> + 26 others); Tue, 19 Sep 2023 06:00:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231724AbjISJ7w (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 19 Sep 2023 05:59:52 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D00E2123; Tue, 19 Sep 2023 02:59:46 -0700 (PDT) Received: from IcarusMOD.eternityproject.eu (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 95BC26607083; Tue, 19 Sep 2023 10:59:44 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1695117585; bh=ty1ncJ/gw8hrt51lR2U+TFArnXv5dU7HXDPnYcxw+dw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=StKEpJ45dfYg1hZOjzQqqJo3FpCWv8VqfgMPIQo7ZvtnXXpwzhwgrztPa4NeZ8T+y RVe0zeLcKynvJjpeOEr32ul/Abs0xJAhnwLplgr3pK6paFIQoHo+d8BRTxzH5eiIy/ uoj/dHKTDdFsNciQMeVwNuQWAMxOgCYsNlTmqctJA147Sljyda6bWa5UTZ2qvQSR5l xN1cY5vKssh0CdT8wNDCh2jHjufv/peXcgDi8gzlTvsOt9LjIR/nj2x/ayYlNXIS22 monR6h0q5f0N2s9ApuGN13f4S9sUCAfPMmpcq0VRzQKPJRa937S0tCb35egfWi9ScY VULyrDJyyqzNQ== From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> To: mchehab@kernel.org Cc: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, moudy.ho@mediatek.com, hverkuil-cisco@xs4all.nl, sakari.ailus@linux.intel.com, u.kleine-koenig@pengutronix.de, linqiheng@huawei.com, linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, kernel@collabora.com, wenst@chromium.org Subject: [PATCH 2/2] media: platform: mtk-mdp3: Use devicetree phandle to retrieve SCP Date: Tue, 19 Sep 2023 11:59:38 +0200 Message-ID: <20230919095938.70679-3-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230919095938.70679-1-angelogioacchino.delregno@collabora.com> References: <20230919095938.70679-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 19 Sep 2023 03:00:28 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777461429547782785 X-GMAIL-MSGID: 1777480114717579840 |
Series |
MediaTek MDP3: use devicetree to retrieve SCP
|
|
Commit Message
AngeloGioacchino Del Regno
Sept. 19, 2023, 9:59 a.m. UTC
Instead of walking the entire parent node for something that has the
right compatible, use the scp_get() function provided by the MediaTek
SCP remoteproc driver to retrieve a handle to mtk_scp through the
devicetree "mediatek,scp" (phandle) property.
In case of multi-core SCP, this also allows to select a specific core.
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
.../media/platform/mediatek/mdp3/mtk-mdp3-core.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
Comments
Il 19/09/23 12:21, Chen-Yu Tsai ha scritto: > On Tue, Sep 19, 2023 at 6:00 PM AngeloGioacchino Del Regno > <angelogioacchino.delregno@collabora.com> wrote: >> >> Instead of walking the entire parent node for something that has the >> right compatible, use the scp_get() function provided by the MediaTek >> SCP remoteproc driver to retrieve a handle to mtk_scp through the >> devicetree "mediatek,scp" (phandle) property. >> >> In case of multi-core SCP, this also allows to select a specific core. >> >> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> >> --- >> .../media/platform/mediatek/mdp3/mtk-mdp3-core.c | 16 ++++++++++------ >> 1 file changed, 10 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c >> index 8677e7fd5083..d93d3833633e 100644 >> --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c >> +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c >> @@ -254,13 +254,17 @@ static int mdp_probe(struct platform_device *pdev) >> goto err_destroy_job_wq; >> } >> >> - mm_pdev = __get_pdev_by_id(pdev, NULL, MDP_INFRA_SCP); >> - if (WARN_ON(!mm_pdev)) { >> - dev_err(&pdev->dev, "Could not get scp device\n"); >> - ret = -ENODEV; >> - goto err_destroy_clock_wq; >> + mdp->scp = scp_get(pdev); >> + if (!mdp->scp) { >> + mm_pdev = __get_pdev_by_id(pdev, NULL, MDP_INFRA_SCP); >> + if (WARN_ON(!mm_pdev)) { >> + dev_err(&pdev->dev, "Could not get scp device\n"); >> + ret = -ENODEV; >> + goto err_destroy_clock_wq; >> + } >> + mdp->scp = platform_get_drvdata(mm_pdev); > > You need to keep the original code as a fallback for old device trees. > I haven't removed the original code, it *is* there as a fallback :-) mdp->scp = scp_get() <--- new if (!mdp->scp) { fallback } Regards, Angelo > ChenYu > >> } >> - mdp->scp = platform_get_drvdata(mm_pdev); >> + >> mdp->rproc_handle = scp_get_rproc(mdp->scp); >> dev_dbg(&pdev->dev, "MDP rproc_handle: %pK", mdp->rproc_handle); >> >> -- >> 2.42.0 >> > _______________________________________________ > Kernel mailing list -- kernel@mailman.collabora.com > To unsubscribe send an email to kernel-leave@mailman.collabora.com
On Tue, Sep 19, 2023 at 6:24 PM AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> wrote: > > Il 19/09/23 12:21, Chen-Yu Tsai ha scritto: > > On Tue, Sep 19, 2023 at 6:00 PM AngeloGioacchino Del Regno > > <angelogioacchino.delregno@collabora.com> wrote: > >> > >> Instead of walking the entire parent node for something that has the > >> right compatible, use the scp_get() function provided by the MediaTek > >> SCP remoteproc driver to retrieve a handle to mtk_scp through the > >> devicetree "mediatek,scp" (phandle) property. > >> > >> In case of multi-core SCP, this also allows to select a specific core. > >> > >> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> > >> --- > >> .../media/platform/mediatek/mdp3/mtk-mdp3-core.c | 16 ++++++++++------ > >> 1 file changed, 10 insertions(+), 6 deletions(-) > >> > >> diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c > >> index 8677e7fd5083..d93d3833633e 100644 > >> --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c > >> +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c > >> @@ -254,13 +254,17 @@ static int mdp_probe(struct platform_device *pdev) > >> goto err_destroy_job_wq; > >> } > >> > >> - mm_pdev = __get_pdev_by_id(pdev, NULL, MDP_INFRA_SCP); > >> - if (WARN_ON(!mm_pdev)) { > >> - dev_err(&pdev->dev, "Could not get scp device\n"); > >> - ret = -ENODEV; > >> - goto err_destroy_clock_wq; > >> + mdp->scp = scp_get(pdev); > >> + if (!mdp->scp) { > >> + mm_pdev = __get_pdev_by_id(pdev, NULL, MDP_INFRA_SCP); > >> + if (WARN_ON(!mm_pdev)) { > >> + dev_err(&pdev->dev, "Could not get scp device\n"); > >> + ret = -ENODEV; > >> + goto err_destroy_clock_wq; > >> + } > >> + mdp->scp = platform_get_drvdata(mm_pdev); > > > > You need to keep the original code as a fallback for old device trees. > > > > I haven't removed the original code, it *is* there as a fallback :-) > > mdp->scp = scp_get() <--- new > if (!mdp->scp) { fallback } I see it now. I guess it's time to call it a day... I even replied with the wrong email ... Reviewed-by: Chen-Yu Tsai <wenst@chromium.org> > > ChenYu > > > >> } > >> - mdp->scp = platform_get_drvdata(mm_pdev); > >> + > >> mdp->rproc_handle = scp_get_rproc(mdp->scp); > >> dev_dbg(&pdev->dev, "MDP rproc_handle: %pK", mdp->rproc_handle); > >> > >> -- > >> 2.42.0 > >> > > _______________________________________________ > > Kernel mailing list -- kernel@mailman.collabora.com > > To unsubscribe send an email to kernel-leave@mailman.collabora.com > >
Il 19/09/23 12:26, Chen-Yu Tsai ha scritto: > On Tue, Sep 19, 2023 at 6:24 PM AngeloGioacchino Del Regno > <angelogioacchino.delregno@collabora.com> wrote: >> >> Il 19/09/23 12:21, Chen-Yu Tsai ha scritto: >>> On Tue, Sep 19, 2023 at 6:00 PM AngeloGioacchino Del Regno >>> <angelogioacchino.delregno@collabora.com> wrote: >>>> >>>> Instead of walking the entire parent node for something that has the >>>> right compatible, use the scp_get() function provided by the MediaTek >>>> SCP remoteproc driver to retrieve a handle to mtk_scp through the >>>> devicetree "mediatek,scp" (phandle) property. >>>> >>>> In case of multi-core SCP, this also allows to select a specific core. >>>> >>>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> >>>> --- >>>> .../media/platform/mediatek/mdp3/mtk-mdp3-core.c | 16 ++++++++++------ >>>> 1 file changed, 10 insertions(+), 6 deletions(-) >>>> >>>> diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c >>>> index 8677e7fd5083..d93d3833633e 100644 >>>> --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c >>>> +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c >>>> @@ -254,13 +254,17 @@ static int mdp_probe(struct platform_device *pdev) >>>> goto err_destroy_job_wq; >>>> } >>>> >>>> - mm_pdev = __get_pdev_by_id(pdev, NULL, MDP_INFRA_SCP); >>>> - if (WARN_ON(!mm_pdev)) { >>>> - dev_err(&pdev->dev, "Could not get scp device\n"); >>>> - ret = -ENODEV; >>>> - goto err_destroy_clock_wq; >>>> + mdp->scp = scp_get(pdev); >>>> + if (!mdp->scp) { >>>> + mm_pdev = __get_pdev_by_id(pdev, NULL, MDP_INFRA_SCP); >>>> + if (WARN_ON(!mm_pdev)) { >>>> + dev_err(&pdev->dev, "Could not get scp device\n"); >>>> + ret = -ENODEV; >>>> + goto err_destroy_clock_wq; >>>> + } >>>> + mdp->scp = platform_get_drvdata(mm_pdev); >>> >>> You need to keep the original code as a fallback for old device trees. >>> >> >> I haven't removed the original code, it *is* there as a fallback :-) >> >> mdp->scp = scp_get() <--- new >> if (!mdp->scp) { fallback } > > I see it now. I guess it's time to call it a day... I even replied with > the wrong email ... > > Reviewed-by: Chen-Yu Tsai <wenst@chromium.org> hahaha! no worries, it happens :-) Thanks for the review btw. Cheers! Angelo > >>> ChenYu >>> >>>> } >>>> - mdp->scp = platform_get_drvdata(mm_pdev); >>>> + >>>> mdp->rproc_handle = scp_get_rproc(mdp->scp); >>>> dev_dbg(&pdev->dev, "MDP rproc_handle: %pK", mdp->rproc_handle); >>>> >>>> -- >>>> 2.42.0 >>>> >>> _______________________________________________ >>> Kernel mailing list -- kernel@mailman.collabora.com >>> To unsubscribe send an email to kernel-leave@mailman.collabora.com >> >>
diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c index 8677e7fd5083..d93d3833633e 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c @@ -254,13 +254,17 @@ static int mdp_probe(struct platform_device *pdev) goto err_destroy_job_wq; } - mm_pdev = __get_pdev_by_id(pdev, NULL, MDP_INFRA_SCP); - if (WARN_ON(!mm_pdev)) { - dev_err(&pdev->dev, "Could not get scp device\n"); - ret = -ENODEV; - goto err_destroy_clock_wq; + mdp->scp = scp_get(pdev); + if (!mdp->scp) { + mm_pdev = __get_pdev_by_id(pdev, NULL, MDP_INFRA_SCP); + if (WARN_ON(!mm_pdev)) { + dev_err(&pdev->dev, "Could not get scp device\n"); + ret = -ENODEV; + goto err_destroy_clock_wq; + } + mdp->scp = platform_get_drvdata(mm_pdev); } - mdp->scp = platform_get_drvdata(mm_pdev); + mdp->rproc_handle = scp_get_rproc(mdp->scp); dev_dbg(&pdev->dev, "MDP rproc_handle: %pK", mdp->rproc_handle);