linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] MediaTek MDP3: use devicetree to retrieve SCP
@ 2023-09-19  9:59 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
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-09-19  9:59 UTC (permalink / raw)
  To: mchehab
  Cc: robh+dt, krzysztof.kozlowski+dt, conor+dt, matthias.bgg,
	angelogioacchino.delregno, moudy.ho, hverkuil-cisco,
	sakari.ailus, u.kleine-koenig, linqiheng, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
	kernel, wenst

Especially now that Multi-Core SCP support has landed, it makes sense to
retrieve the SCP handle by using the "mediatek,scp" property (as already
done in MediaTek VCODEC), both to select one specific SCP core for MDP3
and to avoid walking the parent node to find a SCP node.

AngeloGioacchino Del Regno (2):
  media: dt-bindings: mediatek: Add phandle to mediatek,scp on MDP3 RDMA
  media: platform: mtk-mdp3: Use devicetree phandle to retrieve SCP

 .../bindings/media/mediatek,mdp3-rdma.yaml       |  6 ++++++
 .../media/platform/mediatek/mdp3/mtk-mdp3-core.c | 16 ++++++++++------
 2 files changed, 16 insertions(+), 6 deletions(-)

-- 
2.42.0



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/2] media: dt-bindings: mediatek: Add phandle to mediatek,scp on MDP3 RDMA
  2023-09-19  9:59 [PATCH 0/2] MediaTek MDP3: use devicetree to retrieve SCP AngeloGioacchino Del Regno
@ 2023-09-19  9:59 ` AngeloGioacchino Del Regno
  2023-09-19 10:28   ` Chen-Yu Tsai
                     ` (2 more replies)
  2023-09-19  9:59 ` [PATCH 2/2] media: platform: mtk-mdp3: Use devicetree phandle to retrieve SCP AngeloGioacchino Del Regno
  2023-10-02  8:59 ` [PATCH 0/2] MediaTek MDP3: use devicetree " Hans Verkuil
  2 siblings, 3 replies; 12+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-09-19  9:59 UTC (permalink / raw)
  To: mchehab
  Cc: robh+dt, krzysztof.kozlowski+dt, conor+dt, matthias.bgg,
	angelogioacchino.delregno, moudy.ho, hverkuil-cisco,
	sakari.ailus, u.kleine-koenig, linqiheng, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
	kernel, wenst

The MDP3 RDMA needs to communicate with the SCP remote processor: allow
specifying a phandle to a SCP core.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 .../devicetree/bindings/media/mediatek,mdp3-rdma.yaml       | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/mediatek,mdp3-rdma.yaml b/Documentation/devicetree/bindings/media/mediatek,mdp3-rdma.yaml
index d639a1461143..0e5ce2e77e99 100644
--- a/Documentation/devicetree/bindings/media/mediatek,mdp3-rdma.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek,mdp3-rdma.yaml
@@ -46,6 +46,11 @@ properties:
       include/dt-bindings/gce/<chip>-gce.h of each chips.
     $ref: /schemas/types.yaml#/definitions/uint32-array
 
+  mediatek,scp:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      Phandle to the System Control Processor (SCP) node
+
   power-domains:
     oneOf:
       - items:
@@ -98,6 +103,7 @@ examples:
         mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0x1000 0x1000>;
         mediatek,gce-events = <CMDQ_EVENT_MDP_RDMA0_SOF>,
                               <CMDQ_EVENT_MDP_RDMA0_EOF>;
+        mediatek,scp = <&scp>;
         power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
         clocks = <&mmsys CLK_MM_MDP_RDMA0>,
                  <&mmsys CLK_MM_MDP_RSZ1>;
-- 
2.42.0



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/2] media: platform: mtk-mdp3: Use devicetree phandle to retrieve SCP
  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  9:59 ` AngeloGioacchino Del Regno
  2023-09-19 10:21   ` Chen-Yu Tsai
  2023-10-02  8:59 ` [PATCH 0/2] MediaTek MDP3: use devicetree " Hans Verkuil
  2 siblings, 1 reply; 12+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-09-19  9:59 UTC (permalink / raw)
  To: mchehab
  Cc: robh+dt, krzysztof.kozlowski+dt, conor+dt, matthias.bgg,
	angelogioacchino.delregno, moudy.ho, hverkuil-cisco,
	sakari.ailus, u.kleine-koenig, linqiheng, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
	kernel, wenst

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);
 	}
-	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



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/2] media: platform: mtk-mdp3: Use devicetree phandle to retrieve SCP
  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
  0 siblings, 1 reply; 12+ messages in thread
From: Chen-Yu Tsai @ 2023-09-19 10:21 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: mchehab, robh+dt, krzysztof.kozlowski+dt, conor+dt, matthias.bgg,
	moudy.ho, hverkuil-cisco, sakari.ailus, u.kleine-koenig,
	linqiheng, linux-media, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek, kernel, wenst

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.

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
>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/2] media: platform: mtk-mdp3: Use devicetree phandle to retrieve SCP
  2023-09-19 10:21   ` Chen-Yu Tsai
@ 2023-09-19 10:23     ` AngeloGioacchino Del Regno
  2023-09-19 10:26       ` Chen-Yu Tsai
  0 siblings, 1 reply; 12+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-09-19 10:23 UTC (permalink / raw)
  To: wens
  Cc: mchehab, robh+dt, krzysztof.kozlowski+dt, conor+dt, matthias.bgg,
	moudy.ho, hverkuil-cisco, sakari.ailus, u.kleine-koenig,
	linqiheng, linux-media, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek, kernel, wenst

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




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/2] media: platform: mtk-mdp3: Use devicetree phandle to retrieve SCP
  2023-09-19 10:23     ` AngeloGioacchino Del Regno
@ 2023-09-19 10:26       ` Chen-Yu Tsai
  2023-09-19 10:28         ` AngeloGioacchino Del Regno
  0 siblings, 1 reply; 12+ messages in thread
From: Chen-Yu Tsai @ 2023-09-19 10:26 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: wens, mchehab, robh+dt, krzysztof.kozlowski+dt, conor+dt,
	matthias.bgg, moudy.ho, hverkuil-cisco, sakari.ailus,
	u.kleine-koenig, linqiheng, linux-media, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek, kernel

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
>
>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/2] media: dt-bindings: mediatek: Add phandle to mediatek,scp on MDP3 RDMA
  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
  2 siblings, 0 replies; 12+ messages in thread
From: Chen-Yu Tsai @ 2023-09-19 10:28 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: mchehab, robh+dt, krzysztof.kozlowski+dt, conor+dt, matthias.bgg,
	moudy.ho, hverkuil-cisco, sakari.ailus, u.kleine-koenig,
	linqiheng, linux-media, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek, kernel

On Tue, Sep 19, 2023 at 5:59 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> The MDP3 RDMA needs to communicate with the SCP remote processor: allow
> specifying a phandle to a SCP core.
>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>

> ---
>  .../devicetree/bindings/media/mediatek,mdp3-rdma.yaml       | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/media/mediatek,mdp3-rdma.yaml b/Documentation/devicetree/bindings/media/mediatek,mdp3-rdma.yaml
> index d639a1461143..0e5ce2e77e99 100644
> --- a/Documentation/devicetree/bindings/media/mediatek,mdp3-rdma.yaml
> +++ b/Documentation/devicetree/bindings/media/mediatek,mdp3-rdma.yaml
> @@ -46,6 +46,11 @@ properties:
>        include/dt-bindings/gce/<chip>-gce.h of each chips.
>      $ref: /schemas/types.yaml#/definitions/uint32-array
>
> +  mediatek,scp:
> +    $ref: /schemas/types.yaml#/definitions/phandle
> +    description:
> +      Phandle to the System Control Processor (SCP) node
> +
>    power-domains:
>      oneOf:
>        - items:
> @@ -98,6 +103,7 @@ examples:
>          mediatek,gce-client-reg = <&gce SUBSYS_1400XXXX 0x1000 0x1000>;
>          mediatek,gce-events = <CMDQ_EVENT_MDP_RDMA0_SOF>,
>                                <CMDQ_EVENT_MDP_RDMA0_EOF>;
> +        mediatek,scp = <&scp>;
>          power-domains = <&spm MT8183_POWER_DOMAIN_DISP>;
>          clocks = <&mmsys CLK_MM_MDP_RDMA0>,
>                   <&mmsys CLK_MM_MDP_RSZ1>;
> --
> 2.42.0
>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/2] media: platform: mtk-mdp3: Use devicetree phandle to retrieve SCP
  2023-09-19 10:26       ` Chen-Yu Tsai
@ 2023-09-19 10:28         ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 12+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-09-19 10:28 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: wens, mchehab, robh+dt, krzysztof.kozlowski+dt, conor+dt,
	matthias.bgg, moudy.ho, hverkuil-cisco, sakari.ailus,
	u.kleine-koenig, linqiheng, linux-media, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek, kernel

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
>>
>>



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/2] media: dt-bindings: mediatek: Add phandle to mediatek,scp on MDP3 RDMA
  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
  2 siblings, 0 replies; 12+ messages in thread
From: Conor Dooley @ 2023-09-19 10:57 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: mchehab, robh+dt, krzysztof.kozlowski+dt, conor+dt, matthias.bgg,
	moudy.ho, hverkuil-cisco, sakari.ailus, u.kleine-koenig,
	linqiheng, linux-media, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek, kernel, wenst

[-- Attachment #1: Type: text/plain, Size: 359 bytes --]

On Tue, Sep 19, 2023 at 11:59:37AM +0200, AngeloGioacchino Del Regno wrote:
> The MDP3 RDMA needs to communicate with the SCP remote processor: allow
> specifying a phandle to a SCP core.
> 
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

Reviewed-by: Conor Dooley <conor.dooley@microchip.com>

Thanks,
Conor.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/2] media: dt-bindings: mediatek: Add phandle to mediatek,scp on MDP3 RDMA
  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
  2 siblings, 1 reply; 12+ messages in thread
From: Krzysztof Kozlowski @ 2023-09-23 17:38 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, mchehab
  Cc: robh+dt, krzysztof.kozlowski+dt, conor+dt, matthias.bgg,
	moudy.ho, hverkuil-cisco, sakari.ailus, u.kleine-koenig,
	linqiheng, linux-media, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek, kernel, wenst

On 19/09/2023 11:59, AngeloGioacchino Del Regno wrote:
> The MDP3 RDMA needs to communicate with the SCP remote processor: allow
> specifying a phandle to a SCP core.
> 
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  .../devicetree/bindings/media/mediatek,mdp3-rdma.yaml       | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/media/mediatek,mdp3-rdma.yaml b/Documentation/devicetree/bindings/media/mediatek,mdp3-rdma.yaml
> index d639a1461143..0e5ce2e77e99 100644
> --- a/Documentation/devicetree/bindings/media/mediatek,mdp3-rdma.yaml
> +++ b/Documentation/devicetree/bindings/media/mediatek,mdp3-rdma.yaml
> @@ -46,6 +46,11 @@ properties:
>        include/dt-bindings/gce/<chip>-gce.h of each chips.
>      $ref: /schemas/types.yaml#/definitions/uint32-array
>  
> +  mediatek,scp:
> +    $ref: /schemas/types.yaml#/definitions/phandle
> +    description:
> +      Phandle to the System Control Processor (SCP) node

Why? Why do you need it? For what do you add here phandle? Your
description should explain the purpose.

Best regards,
Krzysztof



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/2] MediaTek MDP3: use devicetree to retrieve SCP
  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  9:59 ` [PATCH 2/2] media: platform: mtk-mdp3: Use devicetree phandle to retrieve SCP AngeloGioacchino Del Regno
@ 2023-10-02  8:59 ` Hans Verkuil
  2 siblings, 0 replies; 12+ messages in thread
From: Hans Verkuil @ 2023-10-02  8:59 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, mchehab
  Cc: robh+dt, krzysztof.kozlowski+dt, conor+dt, matthias.bgg,
	moudy.ho, sakari.ailus, u.kleine-koenig, linqiheng, linux-media,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
	kernel, wenst

On 19/09/2023 11:59, AngeloGioacchino Del Regno wrote:
> Especially now that Multi-Core SCP support has landed, it makes sense to
> retrieve the SCP handle by using the "mediatek,scp" property (as already
> done in MediaTek VCODEC), both to select one specific SCP core for MDP3
> and to avoid walking the parent node to find a SCP node.
> 
> AngeloGioacchino Del Regno (2):
>   media: dt-bindings: mediatek: Add phandle to mediatek,scp on MDP3 RDMA
>   media: platform: mtk-mdp3: Use devicetree phandle to retrieve SCP
> 
>  .../bindings/media/mediatek,mdp3-rdma.yaml       |  6 ++++++
>  .../media/platform/mediatek/mdp3/mtk-mdp3-core.c | 16 ++++++++++------
>  2 files changed, 16 insertions(+), 6 deletions(-)
> 

This series no longer applies to our staging master branch.

Since Krzysztof also asked for a better patch 1/2, I prefer a rebased and
updated v5.

Regards,

	Hans


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/2] media: dt-bindings: mediatek: Add phandle to mediatek,scp on MDP3 RDMA
  2023-09-23 17:38   ` Krzysztof Kozlowski
@ 2023-10-02 11:17     ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 12+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-10-02 11:17 UTC (permalink / raw)
  To: Krzysztof Kozlowski, mchehab
  Cc: robh+dt, krzysztof.kozlowski+dt, conor+dt, matthias.bgg,
	moudy.ho, hverkuil-cisco, sakari.ailus, u.kleine-koenig,
	linqiheng, linux-media, devicetree, linux-kernel,
	linux-arm-kernel, linux-mediatek, kernel, wenst

Il 23/09/23 19:38, Krzysztof Kozlowski ha scritto:
> On 19/09/2023 11:59, AngeloGioacchino Del Regno wrote:
>> The MDP3 RDMA needs to communicate with the SCP remote processor: allow
>> specifying a phandle to a SCP core.
>>
>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>> ---
>>   .../devicetree/bindings/media/mediatek,mdp3-rdma.yaml       | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/media/mediatek,mdp3-rdma.yaml b/Documentation/devicetree/bindings/media/mediatek,mdp3-rdma.yaml
>> index d639a1461143..0e5ce2e77e99 100644
>> --- a/Documentation/devicetree/bindings/media/mediatek,mdp3-rdma.yaml
>> +++ b/Documentation/devicetree/bindings/media/mediatek,mdp3-rdma.yaml
>> @@ -46,6 +46,11 @@ properties:
>>         include/dt-bindings/gce/<chip>-gce.h of each chips.
>>       $ref: /schemas/types.yaml#/definitions/uint32-array
>>   
>> +  mediatek,scp:
>> +    $ref: /schemas/types.yaml#/definitions/phandle
>> +    description:
>> +      Phandle to the System Control Processor (SCP) node
> 
> Why? Why do you need it? For what do you add here phandle? Your
> description should explain the purpose.
> 

Sorry for the slow reply, just seen your feedback, thanks!
I'll add a nicer description for v2.

Cheers,
Angelo



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-10-02 11:17 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).