[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f1e28c8d-c30f-d80b-3d6f-fbfd3e55a64a@collabora.com>
Date: Tue, 19 Sep 2023 12:23:57 +0200
From: AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>
To: wens@...nel.org
Cc: mchehab@...nel.org, robh+dt@...nel.org,
krzysztof.kozlowski+dt@...aro.org, conor+dt@...nel.org,
matthias.bgg@...il.com, moudy.ho@...iatek.com,
hverkuil-cisco@...all.nl, sakari.ailus@...ux.intel.com,
u.kleine-koenig@...gutronix.de, linqiheng@...wei.com,
linux-media@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, kernel@...labora.com,
wenst@...omium.org
Subject: Re: [PATCH 2/2] media: platform: mtk-mdp3: Use devicetree phandle to
retrieve SCP
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@...labora.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@...labora.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@...lman.collabora.com
> To unsubscribe send an email to kernel-leave@...lman.collabora.com
Powered by blists - more mailing lists