media: platform: mtk-mdp3: Use devicetree phandle to retrieve SCP
authorAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Thu, 5 Oct 2023 10:49:05 +0000 (12:49 +0200)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Thu, 7 Dec 2023 07:31:14 +0000 (08:31 +0100)
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.

Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c

index cc44be10fdb77f5ec139de36f537029061b12794..94f4ed78523bb8becb4d7775aa4e7e1e79c649e6 100644 (file)
@@ -208,13 +208,17 @@ static int mdp_probe(struct platform_device *pdev)
                goto err_destroy_job_wq;
        }
 
-       mm_pdev = __get_pdev_by_id(pdev, 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, 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);