devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: wens@kernel.org
Cc: mchehab@kernel.org, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org,
	matthias.bgg@gmail.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: Re: [PATCH 2/2] media: platform: mtk-mdp3: Use devicetree phandle to retrieve SCP
Date: Tue, 19 Sep 2023 12:23:57 +0200	[thread overview]
Message-ID: <f1e28c8d-c30f-d80b-3d6f-fbfd3e55a64a@collabora.com> (raw)
In-Reply-To: <CAGb2v66rEqWBjdMNO3VMZhYj36hhKTxPk+9pborPjnqW0B-=ZA@mail.gmail.com>

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



  reply	other threads:[~2023-09-19 10:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-19  9:59 [PATCH 0/2] MediaTek MDP3: use devicetree to retrieve SCP AngeloGioacchino Del Regno
2023-09-19  9:59 ` [PATCH 1/2] media: dt-bindings: mediatek: Add phandle to mediatek,scp on MDP3 RDMA AngeloGioacchino Del Regno
2023-09-19 10:28   ` Chen-Yu Tsai
2023-09-19 10:57   ` Conor Dooley
2023-09-23 17:38   ` Krzysztof Kozlowski
2023-10-02 11:17     ` AngeloGioacchino Del Regno
2023-09-19  9:59 ` [PATCH 2/2] media: platform: mtk-mdp3: Use devicetree phandle to retrieve SCP AngeloGioacchino Del Regno
2023-09-19 10:21   ` Chen-Yu Tsai
2023-09-19 10:23     ` AngeloGioacchino Del Regno [this message]
2023-09-19 10:26       ` Chen-Yu Tsai
2023-09-19 10:28         ` AngeloGioacchino Del Regno
2023-10-02  8:59 ` [PATCH 0/2] MediaTek MDP3: use devicetree " Hans Verkuil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f1e28c8d-c30f-d80b-3d6f-fbfd3e55a64a@collabora.com \
    --to=angelogioacchino.delregno@collabora.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=kernel@collabora.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linqiheng@huawei.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mchehab@kernel.org \
    --cc=moudy.ho@mediatek.com \
    --cc=robh+dt@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=wens@kernel.org \
    --cc=wenst@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).