linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/9] Panfrost: Improve and add MediaTek SoCs support
@ 2023-02-08 10:37 AngeloGioacchino Del Regno
  2023-02-08 10:37 ` [PATCH 1/9] dt-bindings: gpu: mali-bifrost: Don't allow sram-supply by default AngeloGioacchino Del Regno
                   ` (10 more replies)
  0 siblings, 11 replies; 24+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-02-08 10:37 UTC (permalink / raw)
  To: airlied
  Cc: daniel, robh+dt, krzysztof.kozlowski+dt, tomeu.vizoso,
	steven.price, alyssa.rosenzweig, matthias.bgg, robh, dri-devel,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
	AngeloGioacchino Del Regno

This series adds support for new MediaTek SoCs (MT8186/MT8192/MT8195)
and improves MT8183 support: since the mtk-regulator-coupler driver
was picked, it is now useless for Panfrost to look for, and manage,
two regulators (GPU Vcore and GPU SRAM) on MediaTek;

The aforementioned driver will take care of keeping the voltage
relation (/constraints) of the two regulators on its own when a
voltage change request is sent to the Vcore, solving the old time
issue with not working DVFS on Panfrost+MediaTek (due to devfreq
supporting only single regulator).

In the specific case of MT8183, in order to not break the ABI, it
was necessary to add a new compatible for enabling DVFS.

Alyssa Rosenzweig (3):
  drm/panfrost: Increase MAX_PM_DOMAINS to 5
  drm/panfrost: Add the MT8192 GPU ID
  drm/panfrost: Add mediatek,mt8192-mali compatible

AngeloGioacchino Del Regno (6):
  dt-bindings: gpu: mali-bifrost: Don't allow sram-supply by default
  dt-bindings: gpu: mali-bifrost: Allow up to 5 power domains for MT8192
  dt-bindings: gpu: mali-bifrost: Add compatible for MT8195 SoC
  dt-bindings: gpu: mali-bifrost: Add new MT8183 compatible
  dt-bindings: gpu: mali-bifrost: Add a compatible for MediaTek MT8186
  drm/panfrost: Add new compatible for Mali on the MT8183 SoC

 .../bindings/gpu/arm,mali-bifrost.yaml        | 68 +++++++++++++++++--
 drivers/gpu/drm/panfrost/panfrost_device.h    |  2 +-
 drivers/gpu/drm/panfrost/panfrost_drv.c       | 28 ++++++++
 drivers/gpu/drm/panfrost/panfrost_gpu.c       |  8 +++
 4 files changed, 99 insertions(+), 7 deletions(-)

-- 
2.39.1


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

* [PATCH 1/9] dt-bindings: gpu: mali-bifrost: Don't allow sram-supply by default
  2023-02-08 10:37 [PATCH 0/9] Panfrost: Improve and add MediaTek SoCs support AngeloGioacchino Del Regno
@ 2023-02-08 10:37 ` AngeloGioacchino Del Regno
  2023-02-09  2:50   ` Chen-Yu Tsai
  2023-02-08 10:37 ` [PATCH 2/9] dt-bindings: gpu: mali-bifrost: Allow up to 5 power domains for MT8192 AngeloGioacchino Del Regno
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-02-08 10:37 UTC (permalink / raw)
  To: airlied
  Cc: daniel, robh+dt, krzysztof.kozlowski+dt, tomeu.vizoso,
	steven.price, alyssa.rosenzweig, matthias.bgg, robh, dri-devel,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
	AngeloGioacchino Del Regno

The sram-supply is MediaTek-specific, it is and will ever be used
only for the mediatek,mt8183-mali compatible due to the addition of
the mediatek-regulator-coupler driver: change the binding to add
this supply when mediatek,mt8183-mali is present as a compatible
instead of disabling it when not present.

This is done in preparation for adding new bindings for other
MediaTek SoCs, such as MT8192 and others.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
index 78964c140b46..69212f3b1328 100644
--- a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
+++ b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
@@ -57,8 +57,6 @@ properties:
 
   mali-supply: true
 
-  sram-supply: true
-
   operating-points-v2: true
 
   power-domains:
@@ -157,6 +155,7 @@ allOf:
             - const: core0
             - const: core1
             - const: core2
+        sram-supply: true
 
       required:
         - sram-supply
@@ -166,7 +165,6 @@ allOf:
       properties:
         power-domains:
           maxItems: 1
-        sram-supply: false
   - if:
       properties:
         compatible:
-- 
2.39.1


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

* [PATCH 2/9] dt-bindings: gpu: mali-bifrost: Allow up to 5 power domains for MT8192
  2023-02-08 10:37 [PATCH 0/9] Panfrost: Improve and add MediaTek SoCs support AngeloGioacchino Del Regno
  2023-02-08 10:37 ` [PATCH 1/9] dt-bindings: gpu: mali-bifrost: Don't allow sram-supply by default AngeloGioacchino Del Regno
@ 2023-02-08 10:37 ` AngeloGioacchino Del Regno
  2023-02-09  8:33   ` Chen-Yu Tsai
  2023-02-09 18:13   ` Rob Herring
  2023-02-08 10:37 ` [PATCH 3/9] dt-bindings: gpu: mali-bifrost: Add compatible for MT8195 SoC AngeloGioacchino Del Regno
                   ` (8 subsequent siblings)
  10 siblings, 2 replies; 24+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-02-08 10:37 UTC (permalink / raw)
  To: airlied
  Cc: daniel, robh+dt, krzysztof.kozlowski+dt, tomeu.vizoso,
	steven.price, alyssa.rosenzweig, matthias.bgg, robh, dri-devel,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
	AngeloGioacchino Del Regno

MediaTek MT8192 (and similar) needs five power domains for the
Mali GPU and no sram-supply: change the binding to allow so.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 .../bindings/gpu/arm,mali-bifrost.yaml        | 34 +++++++++++++++++--
 1 file changed, 31 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
index 69212f3b1328..e7aba66ddb8f 100644
--- a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
+++ b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
@@ -61,7 +61,7 @@ properties:
 
   power-domains:
     minItems: 1
-    maxItems: 3
+    maxItems: 5
 
   resets:
     minItems: 1
@@ -141,6 +141,18 @@ allOf:
         - power-domains
         - resets
         - reset-names
+  - if:
+      not:
+        properties:
+          compatible:
+            contains:
+              enum:
+                - mediatek,mt8183-mali
+                - mediatek,mt8192-mali
+    then:
+      properties:
+        power-domains:
+          maxItems: 1
   - if:
       properties:
         compatible:
@@ -161,10 +173,26 @@ allOf:
         - sram-supply
         - power-domains
         - power-domain-names
-    else:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: mediatek,mt8192-mali
+    then:
       properties:
         power-domains:
-          maxItems: 1
+          minItems: 5
+        power-domain-names:
+          items:
+            - const: core0
+            - const: core1
+            - const: core2
+            - const: core3
+            - const: core4
+
+      required:
+        - power-domains
+        - power-domain-names
   - if:
       properties:
         compatible:
-- 
2.39.1


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

* [PATCH 3/9] dt-bindings: gpu: mali-bifrost: Add compatible for MT8195 SoC
  2023-02-08 10:37 [PATCH 0/9] Panfrost: Improve and add MediaTek SoCs support AngeloGioacchino Del Regno
  2023-02-08 10:37 ` [PATCH 1/9] dt-bindings: gpu: mali-bifrost: Don't allow sram-supply by default AngeloGioacchino Del Regno
  2023-02-08 10:37 ` [PATCH 2/9] dt-bindings: gpu: mali-bifrost: Allow up to 5 power domains for MT8192 AngeloGioacchino Del Regno
@ 2023-02-08 10:37 ` AngeloGioacchino Del Regno
  2023-02-09 18:15   ` Rob Herring
  2023-02-08 10:37 ` [PATCH 4/9] dt-bindings: gpu: mali-bifrost: Add new MT8183 compatible AngeloGioacchino Del Regno
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-02-08 10:37 UTC (permalink / raw)
  To: airlied
  Cc: daniel, robh+dt, krzysztof.kozlowski+dt, tomeu.vizoso,
	steven.price, alyssa.rosenzweig, matthias.bgg, robh, dri-devel,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
	AngeloGioacchino Del Regno

The MediaTek MT8195 SoC has a Mali G57 MC5 (Valhall-JM) and has the
same number of power domains and requirements as MT8192 in terms of
bindings.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
index e7aba66ddb8f..6bd0a5b3c5b7 100644
--- a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
+++ b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
@@ -25,6 +25,11 @@ properties:
               - rockchip,px30-mali
               - rockchip,rk3568-mali
           - const: arm,mali-bifrost # Mali Bifrost GPU model/revision is fully discoverable
+      - items:
+          - enum:
+              - mediatek,mt8195-mali
+          - const: mediatek,mt8192-mali
+          - const: arm,mali-valhall-jm # Mali Valhall GPU model/revision is fully discoverable
       - items:
           - enum:
               - mediatek,mt8192-mali
-- 
2.39.1


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

* [PATCH 4/9] dt-bindings: gpu: mali-bifrost: Add new MT8183 compatible
  2023-02-08 10:37 [PATCH 0/9] Panfrost: Improve and add MediaTek SoCs support AngeloGioacchino Del Regno
                   ` (2 preceding siblings ...)
  2023-02-08 10:37 ` [PATCH 3/9] dt-bindings: gpu: mali-bifrost: Add compatible for MT8195 SoC AngeloGioacchino Del Regno
@ 2023-02-08 10:37 ` AngeloGioacchino Del Regno
  2023-02-09 18:15   ` Rob Herring
  2023-02-08 10:37 ` [PATCH 5/9] dt-bindings: gpu: mali-bifrost: Add a compatible for MediaTek MT8186 AngeloGioacchino Del Regno
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-02-08 10:37 UTC (permalink / raw)
  To: airlied
  Cc: daniel, robh+dt, krzysztof.kozlowski+dt, tomeu.vizoso,
	steven.price, alyssa.rosenzweig, matthias.bgg, robh, dri-devel,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
	AngeloGioacchino Del Regno

Since new platform data was required in Panfrost for getting GPU DVFS
finally working on MediaTek SoCs, add a new "mediatek,mt8183b-mali"
compatible.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 .../bindings/gpu/arm,mali-bifrost.yaml        | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
index 6bd0a5b3c5b7..8c57b89ee866 100644
--- a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
+++ b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
@@ -19,6 +19,7 @@ properties:
           - enum:
               - amlogic,meson-g12a-mali
               - mediatek,mt8183-mali
+              - mediatek,mt8183b-mali
               - realtek,rtd1619-mali
               - renesas,r9a07g044-mali
               - renesas,r9a07g054-mali
@@ -153,6 +154,7 @@ allOf:
             contains:
               enum:
                 - mediatek,mt8183-mali
+                - mediatek,mt8183b-mali
                 - mediatek,mt8192-mali
     then:
       properties:
@@ -178,6 +180,24 @@ allOf:
         - sram-supply
         - power-domains
         - power-domain-names
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: mediatek,mt8183b-mali
+    then:
+      properties:
+        power-domains:
+          minItems: 3
+        power-domain-names:
+          items:
+            - const: core0
+            - const: core1
+            - const: core2
+
+      required:
+        - power-domains
+        - power-domain-names
   - if:
       properties:
         compatible:
-- 
2.39.1


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

* [PATCH 5/9] dt-bindings: gpu: mali-bifrost: Add a compatible for MediaTek MT8186
  2023-02-08 10:37 [PATCH 0/9] Panfrost: Improve and add MediaTek SoCs support AngeloGioacchino Del Regno
                   ` (3 preceding siblings ...)
  2023-02-08 10:37 ` [PATCH 4/9] dt-bindings: gpu: mali-bifrost: Add new MT8183 compatible AngeloGioacchino Del Regno
@ 2023-02-08 10:37 ` AngeloGioacchino Del Regno
  2023-02-09  8:49   ` Chen-Yu Tsai
  2023-02-08 10:37 ` [PATCH 6/9] drm/panfrost: Increase MAX_PM_DOMAINS to 5 AngeloGioacchino Del Regno
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 24+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-02-08 10:37 UTC (permalink / raw)
  To: airlied
  Cc: daniel, robh+dt, krzysztof.kozlowski+dt, tomeu.vizoso,
	steven.price, alyssa.rosenzweig, matthias.bgg, robh, dri-devel,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
	AngeloGioacchino Del Regno

Get GPU support on MT8186 by adding its compatible.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
index 8c57b89ee866..85111559dfe0 100644
--- a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
+++ b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
@@ -15,6 +15,11 @@ properties:
 
   compatible:
     oneOf:
+      - items:
+          - enum:
+              - mediatek,mt8186-mali
+          - const: mediatek,mt8183b-mali
+          - const: arm,mali-bifrost # Mali Bifrost GPU model/revision is fully discoverable
       - items:
           - enum:
               - amlogic,meson-g12a-mali
-- 
2.39.1


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

* [PATCH 6/9] drm/panfrost: Increase MAX_PM_DOMAINS to 5
  2023-02-08 10:37 [PATCH 0/9] Panfrost: Improve and add MediaTek SoCs support AngeloGioacchino Del Regno
                   ` (4 preceding siblings ...)
  2023-02-08 10:37 ` [PATCH 5/9] dt-bindings: gpu: mali-bifrost: Add a compatible for MediaTek MT8186 AngeloGioacchino Del Regno
@ 2023-02-08 10:37 ` AngeloGioacchino Del Regno
  2023-02-08 10:37 ` [PATCH 7/9] drm/panfrost: Add the MT8192 GPU ID AngeloGioacchino Del Regno
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 24+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-02-08 10:37 UTC (permalink / raw)
  To: airlied
  Cc: daniel, robh+dt, krzysztof.kozlowski+dt, tomeu.vizoso,
	steven.price, alyssa.rosenzweig, matthias.bgg, robh, dri-devel,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
	AngeloGioacchino Del Regno

From: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>

Increase the MAX_PM_DOMAINS constant from 3 to 5, to support the
extra power domains required by the Mali-G57 on the MT8192.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/gpu/drm/panfrost/panfrost_device.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h
index d9ba68cffb77..b0126b9fbadc 100644
--- a/drivers/gpu/drm/panfrost/panfrost_device.h
+++ b/drivers/gpu/drm/panfrost/panfrost_device.h
@@ -23,7 +23,7 @@ struct panfrost_job;
 struct panfrost_perfcnt;
 
 #define NUM_JOB_SLOTS 3
-#define MAX_PM_DOMAINS 3
+#define MAX_PM_DOMAINS 5
 
 struct panfrost_features {
 	u16 id;
-- 
2.39.1


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

* [PATCH 7/9] drm/panfrost: Add the MT8192 GPU ID
  2023-02-08 10:37 [PATCH 0/9] Panfrost: Improve and add MediaTek SoCs support AngeloGioacchino Del Regno
                   ` (5 preceding siblings ...)
  2023-02-08 10:37 ` [PATCH 6/9] drm/panfrost: Increase MAX_PM_DOMAINS to 5 AngeloGioacchino Del Regno
@ 2023-02-08 10:37 ` AngeloGioacchino Del Regno
  2023-02-08 10:37 ` [PATCH 8/9] drm/panfrost: Add mediatek,mt8192-mali compatible AngeloGioacchino Del Regno
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 24+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-02-08 10:37 UTC (permalink / raw)
  To: airlied
  Cc: daniel, robh+dt, krzysztof.kozlowski+dt, tomeu.vizoso,
	steven.price, alyssa.rosenzweig, matthias.bgg, robh, dri-devel,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
	AngeloGioacchino Del Regno

From: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>

MediaTek MT8192 has a Mali-G57 with a special GPU ID. Add its GPU ID,
but treat it as otherwise identical to a standard Mali-G57.

We do _not_ fix up the GPU ID here -- userspace needs to be aware of the
special GPU ID, in case we find functional differences between
MediaTek's implementation and the standard Mali-G57 down the line.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/gpu/drm/panfrost/panfrost_gpu.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c
index 6452e4e900dd..d28b99732dde 100644
--- a/drivers/gpu/drm/panfrost/panfrost_gpu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c
@@ -204,6 +204,14 @@ static const struct panfrost_model gpu_models[] = {
 
 	GPU_MODEL(g57, 0x9001,
 		GPU_REV(g57, 0, 0)),
+
+	/* MediaTek MT8192 has a Mali-G57 with a different GPU ID from the
+	 * standard. Arm's driver does not appear to handle this model.
+	 * ChromeOS has a hack downstream for it. Treat it as equivalent to
+	 * standard Mali-G57 for now.
+	 */
+	GPU_MODEL(g57, 0x9003,
+		GPU_REV(g57, 0, 0)),
 };
 
 static void panfrost_gpu_init_features(struct panfrost_device *pfdev)
-- 
2.39.1


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

* [PATCH 8/9] drm/panfrost: Add mediatek,mt8192-mali compatible
  2023-02-08 10:37 [PATCH 0/9] Panfrost: Improve and add MediaTek SoCs support AngeloGioacchino Del Regno
                   ` (6 preceding siblings ...)
  2023-02-08 10:37 ` [PATCH 7/9] drm/panfrost: Add the MT8192 GPU ID AngeloGioacchino Del Regno
@ 2023-02-08 10:37 ` AngeloGioacchino Del Regno
  2023-02-08 10:37 ` [PATCH 9/9] drm/panfrost: Add new compatible for Mali on the MT8183 SoC AngeloGioacchino Del Regno
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 24+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-02-08 10:37 UTC (permalink / raw)
  To: airlied
  Cc: daniel, robh+dt, krzysztof.kozlowski+dt, tomeu.vizoso,
	steven.price, alyssa.rosenzweig, matthias.bgg, robh, dri-devel,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
	AngeloGioacchino Del Regno

From: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>

Required for Mali-G57 on the Mediatek MT8192 and MT8195, which
uses even more power domains than the MT8183 before it.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
[Angelo: Removed unneeded "sram" supply, added mt8195 to commit description]
Co-developed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/gpu/drm/panfrost/panfrost_drv.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
index abb0dadd8f63..5d25e77e1037 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -663,6 +663,16 @@ static const struct panfrost_compatible mediatek_mt8183_data = {
 	.pm_domain_names = mediatek_mt8183_pm_domains,
 };
 
+static const char * const mediatek_mt8192_supplies[] = { "mali", NULL };
+static const char * const mediatek_mt8192_pm_domains[] = { "core0", "core1", "core2",
+							   "core3", "core4" };
+static const struct panfrost_compatible mediatek_mt8192_data = {
+	.num_supplies = ARRAY_SIZE(mediatek_mt8192_supplies) - 1,
+	.supply_names = mediatek_mt8192_supplies,
+	.num_pm_domains = ARRAY_SIZE(mediatek_mt8192_pm_domains),
+	.pm_domain_names = mediatek_mt8192_pm_domains,
+};
+
 static const struct of_device_id dt_match[] = {
 	/* Set first to probe before the generic compatibles */
 	{ .compatible = "amlogic,meson-gxm-mali",
@@ -681,6 +691,7 @@ static const struct of_device_id dt_match[] = {
 	{ .compatible = "arm,mali-bifrost", .data = &default_data, },
 	{ .compatible = "arm,mali-valhall-jm", .data = &default_data, },
 	{ .compatible = "mediatek,mt8183-mali", .data = &mediatek_mt8183_data },
+	{ .compatible = "mediatek,mt8192-mali", .data = &mediatek_mt8192_data },
 	{}
 };
 MODULE_DEVICE_TABLE(of, dt_match);
-- 
2.39.1


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

* [PATCH 9/9] drm/panfrost: Add new compatible for Mali on the MT8183 SoC
  2023-02-08 10:37 [PATCH 0/9] Panfrost: Improve and add MediaTek SoCs support AngeloGioacchino Del Regno
                   ` (7 preceding siblings ...)
  2023-02-08 10:37 ` [PATCH 8/9] drm/panfrost: Add mediatek,mt8192-mali compatible AngeloGioacchino Del Regno
@ 2023-02-08 10:37 ` AngeloGioacchino Del Regno
  2023-02-08 15:11 ` [PATCH 0/9] Panfrost: Improve and add MediaTek SoCs support Steven Price
  2023-02-09  9:10 ` Chen-Yu Tsai
  10 siblings, 0 replies; 24+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-02-08 10:37 UTC (permalink / raw)
  To: airlied
  Cc: daniel, robh+dt, krzysztof.kozlowski+dt, tomeu.vizoso,
	steven.price, alyssa.rosenzweig, matthias.bgg, robh, dri-devel,
	devicetree, linux-kernel, linux-arm-kernel, linux-mediatek,
	AngeloGioacchino Del Regno

The "mediatek,mt8183-mali" compatible uses platform data that calls for
getting (and managing) two regulators ("mali" and "sram") but devfreq
does not support this usecase, resulting in DVFS not working.

Since a lot of MediaTek SoCs need to set the voltages for the GPU SRAM
regulator in a specific relation to the GPU VCORE regulator, a MediaTek
SoC specific driver was introduced to automatically satisfy, through
coupling, these constraints: this means that there is at all no need to
manage both regulators in panfrost but to otherwise just manage the main
"mali" (-> gpu vcore) regulator instead.

Keeping in mind that we cannot break the ABI, the most sensible route
(avoiding hacks and uselessly overcomplicated code) to get a MT8183
node with one power supply was to add a new "mediatek,mt8183b-mali"
compatible, which effectively deprecates the former.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/gpu/drm/panfrost/panfrost_drv.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
index 5d25e77e1037..14cdeaeeb5c4 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -654,6 +654,14 @@ static const struct panfrost_compatible amlogic_data = {
 	.vendor_quirk = panfrost_gpu_amlogic_quirk,
 };
 
+/*
+ * The old data with two power supplies for MT8183 is here only to
+ * keep retro-compatibility with older devicetrees, as DVFS will
+ * not work with this one.
+ *
+ * On new devicetrees please use the _b variant with a single and
+ * coupled regulators instead.
+ */
 static const char * const mediatek_mt8183_supplies[] = { "mali", "sram", NULL };
 static const char * const mediatek_mt8183_pm_domains[] = { "core0", "core1", "core2" };
 static const struct panfrost_compatible mediatek_mt8183_data = {
@@ -663,6 +671,14 @@ static const struct panfrost_compatible mediatek_mt8183_data = {
 	.pm_domain_names = mediatek_mt8183_pm_domains,
 };
 
+static const char * const mediatek_mt8183_b_supplies[] = { "mali", NULL };
+static const struct panfrost_compatible mediatek_mt8183_b_data = {
+	.num_supplies = ARRAY_SIZE(mediatek_mt8183_b_supplies) - 1,
+	.supply_names = mediatek_mt8183_b_supplies,
+	.num_pm_domains = ARRAY_SIZE(mediatek_mt8183_pm_domains),
+	.pm_domain_names = mediatek_mt8183_pm_domains,
+};
+
 static const char * const mediatek_mt8192_supplies[] = { "mali", NULL };
 static const char * const mediatek_mt8192_pm_domains[] = { "core0", "core1", "core2",
 							   "core3", "core4" };
@@ -691,6 +707,7 @@ static const struct of_device_id dt_match[] = {
 	{ .compatible = "arm,mali-bifrost", .data = &default_data, },
 	{ .compatible = "arm,mali-valhall-jm", .data = &default_data, },
 	{ .compatible = "mediatek,mt8183-mali", .data = &mediatek_mt8183_data },
+	{ .compatible = "mediatek,mt8183b-mali", .data = &mediatek_mt8183_b_data },
 	{ .compatible = "mediatek,mt8192-mali", .data = &mediatek_mt8192_data },
 	{}
 };
-- 
2.39.1


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

* Re: [PATCH 0/9] Panfrost: Improve and add MediaTek SoCs support
  2023-02-08 10:37 [PATCH 0/9] Panfrost: Improve and add MediaTek SoCs support AngeloGioacchino Del Regno
                   ` (8 preceding siblings ...)
  2023-02-08 10:37 ` [PATCH 9/9] drm/panfrost: Add new compatible for Mali on the MT8183 SoC AngeloGioacchino Del Regno
@ 2023-02-08 15:11 ` Steven Price
  2023-02-09  9:10 ` Chen-Yu Tsai
  10 siblings, 0 replies; 24+ messages in thread
From: Steven Price @ 2023-02-08 15:11 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, airlied
  Cc: daniel, robh+dt, krzysztof.kozlowski+dt, tomeu.vizoso,
	alyssa.rosenzweig, matthias.bgg, robh, dri-devel, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek

On 08/02/2023 10:37, AngeloGioacchino Del Regno wrote:
> This series adds support for new MediaTek SoCs (MT8186/MT8192/MT8195)
> and improves MT8183 support: since the mtk-regulator-coupler driver
> was picked, it is now useless for Panfrost to look for, and manage,
> two regulators (GPU Vcore and GPU SRAM) on MediaTek;

Yay! ;) I never did like Panfrost dealing with two regulators.

> The aforementioned driver will take care of keeping the voltage
> relation (/constraints) of the two regulators on its own when a
> voltage change request is sent to the Vcore, solving the old time
> issue with not working DVFS on Panfrost+MediaTek (due to devfreq
> supporting only single regulator).
> 
> In the specific case of MT8183, in order to not break the ABI, it
> was necessary to add a new compatible for enabling DVFS.

It's a shame to need a new compatible, but it seems sensible to me.

For the panfrost changes:

Reviewed-by: Steven Price <steven.price@arm.com>

I'll let others comment on the DT binding changes.

Thanks,

Steve

> Alyssa Rosenzweig (3):
>   drm/panfrost: Increase MAX_PM_DOMAINS to 5
>   drm/panfrost: Add the MT8192 GPU ID
>   drm/panfrost: Add mediatek,mt8192-mali compatible
> 
> AngeloGioacchino Del Regno (6):
>   dt-bindings: gpu: mali-bifrost: Don't allow sram-supply by default
>   dt-bindings: gpu: mali-bifrost: Allow up to 5 power domains for MT8192
>   dt-bindings: gpu: mali-bifrost: Add compatible for MT8195 SoC
>   dt-bindings: gpu: mali-bifrost: Add new MT8183 compatible
>   dt-bindings: gpu: mali-bifrost: Add a compatible for MediaTek MT8186
>   drm/panfrost: Add new compatible for Mali on the MT8183 SoC
> 
>  .../bindings/gpu/arm,mali-bifrost.yaml        | 68 +++++++++++++++++--
>  drivers/gpu/drm/panfrost/panfrost_device.h    |  2 +-
>  drivers/gpu/drm/panfrost/panfrost_drv.c       | 28 ++++++++
>  drivers/gpu/drm/panfrost/panfrost_gpu.c       |  8 +++
>  4 files changed, 99 insertions(+), 7 deletions(-)
> 


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

* Re: [PATCH 1/9] dt-bindings: gpu: mali-bifrost: Don't allow sram-supply by default
  2023-02-08 10:37 ` [PATCH 1/9] dt-bindings: gpu: mali-bifrost: Don't allow sram-supply by default AngeloGioacchino Del Regno
@ 2023-02-09  2:50   ` Chen-Yu Tsai
  2023-02-09  9:15     ` AngeloGioacchino Del Regno
  0 siblings, 1 reply; 24+ messages in thread
From: Chen-Yu Tsai @ 2023-02-09  2:50 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: airlied, tomeu.vizoso, devicetree, linux-kernel, dri-devel,
	steven.price, robh+dt, linux-mediatek, alyssa.rosenzweig,
	krzysztof.kozlowski+dt, matthias.bgg, linux-arm-kernel

On Wed, Feb 8, 2023 at 6:37 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> The sram-supply is MediaTek-specific, it is and will ever be used
> only for the mediatek,mt8183-mali compatible due to the addition of
> the mediatek-regulator-coupler driver: change the binding to add
> this supply when mediatek,mt8183-mali is present as a compatible
> instead of disabling it when not present.
>
> This is done in preparation for adding new bindings for other
> MediaTek SoCs, such as MT8192 and others.
>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
> index 78964c140b46..69212f3b1328 100644
> --- a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
> +++ b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
> @@ -57,8 +57,6 @@ properties:
>
>    mali-supply: true
>
> -  sram-supply: true
> -

Have you tried actually validating the device trees against this?
Based on my previous tests this gives out errors.

The reason is that each conditional is a separate sub-schema, and the
validator is run against each schema and sub-schema separately, instead
of collapsing matching schemas and sub-schemas together and validating
once. So we'll get a validation error on sram-supply not being a valid
property when validating current mt8183 against the base schema.

We have a similar issue with power-domain-names, for which I'll send
a patch to fix. See the following for the fix:

    http://git.kernel.org/wens/c/d1adb38ab2ad0442755607c2bcc726cc17cce2c7

and the following for what I did for MT8192 on top of the previous patch:

    http://git.kernel.org/wens/c/049bd164884398d7e5f72c710da6aaa9a95bc10a


Regards
ChenYu

>    operating-points-v2: true
>
>    power-domains:
> @@ -157,6 +155,7 @@ allOf:
>              - const: core0
>              - const: core1
>              - const: core2
> +        sram-supply: true
>
>        required:
>          - sram-supply
> @@ -166,7 +165,6 @@ allOf:
>        properties:
>          power-domains:
>            maxItems: 1
> -        sram-supply: false
>    - if:
>        properties:
>          compatible:
> --
> 2.39.1
>

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

* Re: [PATCH 2/9] dt-bindings: gpu: mali-bifrost: Allow up to 5 power domains for MT8192
  2023-02-08 10:37 ` [PATCH 2/9] dt-bindings: gpu: mali-bifrost: Allow up to 5 power domains for MT8192 AngeloGioacchino Del Regno
@ 2023-02-09  8:33   ` Chen-Yu Tsai
  2023-02-09  9:17     ` AngeloGioacchino Del Regno
  2023-02-09 18:13   ` Rob Herring
  1 sibling, 1 reply; 24+ messages in thread
From: Chen-Yu Tsai @ 2023-02-09  8:33 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: airlied, tomeu.vizoso, devicetree, linux-kernel, dri-devel,
	steven.price, robh+dt, linux-mediatek, alyssa.rosenzweig,
	krzysztof.kozlowski+dt, matthias.bgg, linux-arm-kernel

On Wed, Feb 8, 2023 at 6:37 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> MediaTek MT8192 (and similar) needs five power domains for the
> Mali GPU and no sram-supply: change the binding to allow so.
>

mt8192 compatible was already added, so this should have:

Fixes: 5d82e74a97c2 ("dt-bindings: Add compatible for Mali Valhall (JM)")

> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  .../bindings/gpu/arm,mali-bifrost.yaml        | 34 +++++++++++++++++--
>  1 file changed, 31 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
> index 69212f3b1328..e7aba66ddb8f 100644
> --- a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
> +++ b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
> @@ -61,7 +61,7 @@ properties:
>
>    power-domains:
>      minItems: 1
> -    maxItems: 3
> +    maxItems: 5
>
>    resets:
>      minItems: 1
> @@ -141,6 +141,18 @@ allOf:
>          - power-domains
>          - resets
>          - reset-names
> +  - if:
> +      not:
> +        properties:
> +          compatible:
> +            contains:
> +              enum:
> +                - mediatek,mt8183-mali
> +                - mediatek,mt8192-mali
> +    then:
> +      properties:
> +        power-domains:
> +          maxItems: 1
>    - if:
>        properties:
>          compatible:
> @@ -161,10 +173,26 @@ allOf:
>          - sram-supply
>          - power-domains
>          - power-domain-names
> -    else:
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: mediatek,mt8192-mali
> +    then:
>        properties:
>          power-domains:
> -          maxItems: 1
> +          minItems: 5
> +        power-domain-names:
> +          items:
> +            - const: core0
> +            - const: core1
> +            - const: core2
> +            - const: core3
> +            - const: core4
> +
> +      required:
> +        - power-domains
> +        - power-domain-names
>    - if:
>        properties:
>          compatible:
> --
> 2.39.1
>

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

* Re: [PATCH 5/9] dt-bindings: gpu: mali-bifrost: Add a compatible for MediaTek MT8186
  2023-02-08 10:37 ` [PATCH 5/9] dt-bindings: gpu: mali-bifrost: Add a compatible for MediaTek MT8186 AngeloGioacchino Del Regno
@ 2023-02-09  8:49   ` Chen-Yu Tsai
  2023-02-09  9:20     ` AngeloGioacchino Del Regno
  0 siblings, 1 reply; 24+ messages in thread
From: Chen-Yu Tsai @ 2023-02-09  8:49 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: airlied, tomeu.vizoso, devicetree, linux-kernel, dri-devel,
	steven.price, robh+dt, linux-mediatek, alyssa.rosenzweig,
	krzysztof.kozlowski+dt, matthias.bgg, linux-arm-kernel, Fei Shao,
	Nick Fan

On Wed, Feb 8, 2023 at 6:37 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> Get GPU support on MT8186 by adding its compatible.

I'd skip MT8186 for now. We have to work out some binning details for the
OPP, in particular how to deal with both Panfrost (or Mali) and SVS adding
the OPP table. We were just looking at the Mali driver today.

ChenYu

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

* Re: [PATCH 0/9] Panfrost: Improve and add MediaTek SoCs support
  2023-02-08 10:37 [PATCH 0/9] Panfrost: Improve and add MediaTek SoCs support AngeloGioacchino Del Regno
                   ` (9 preceding siblings ...)
  2023-02-08 15:11 ` [PATCH 0/9] Panfrost: Improve and add MediaTek SoCs support Steven Price
@ 2023-02-09  9:10 ` Chen-Yu Tsai
  10 siblings, 0 replies; 24+ messages in thread
From: Chen-Yu Tsai @ 2023-02-09  9:10 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: airlied, tomeu.vizoso, devicetree, linux-kernel, dri-devel,
	steven.price, robh+dt, linux-mediatek, alyssa.rosenzweig,
	krzysztof.kozlowski+dt, matthias.bgg, linux-arm-kernel

On Wed, Feb 8, 2023 at 6:37 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> This series adds support for new MediaTek SoCs (MT8186/MT8192/MT8195)
> and improves MT8183 support: since the mtk-regulator-coupler driver
> was picked, it is now useless for Panfrost to look for, and manage,
> two regulators (GPU Vcore and GPU SRAM) on MediaTek;
>
> The aforementioned driver will take care of keeping the voltage
> relation (/constraints) of the two regulators on its own when a
> voltage change request is sent to the Vcore, solving the old time
> issue with not working DVFS on Panfrost+MediaTek (due to devfreq
> supporting only single regulator).
>
> In the specific case of MT8183, in order to not break the ABI, it
> was necessary to add a new compatible for enabling DVFS.

Tested on MT8183 Juniper (Kukui-based device), MT8192 Hayato (Asurada-based),
and MT8195 Tomato (Cherry-based).

GPU probed. When running glmark-es2-drm, observed state transitions in
/sys/class/devfreq/13040000.gpu/trans_stat , as well as actual changes to
values for regulators and clocks.

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

Also observed that sometimes when glmark terminated, the GPU would not be
brought down to the lowest OPP.

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

* Re: [PATCH 1/9] dt-bindings: gpu: mali-bifrost: Don't allow sram-supply by default
  2023-02-09  2:50   ` Chen-Yu Tsai
@ 2023-02-09  9:15     ` AngeloGioacchino Del Regno
  2023-02-09 18:11       ` Rob Herring
  0 siblings, 1 reply; 24+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-02-09  9:15 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: airlied, tomeu.vizoso, devicetree, linux-kernel, dri-devel,
	steven.price, robh+dt, linux-mediatek, alyssa.rosenzweig,
	krzysztof.kozlowski+dt, matthias.bgg, linux-arm-kernel

Il 09/02/23 03:50, Chen-Yu Tsai ha scritto:
> On Wed, Feb 8, 2023 at 6:37 PM AngeloGioacchino Del Regno
> <angelogioacchino.delregno@collabora.com> wrote:
>>
>> The sram-supply is MediaTek-specific, it is and will ever be used
>> only for the mediatek,mt8183-mali compatible due to the addition of
>> the mediatek-regulator-coupler driver: change the binding to add
>> this supply when mediatek,mt8183-mali is present as a compatible
>> instead of disabling it when not present.
>>
>> This is done in preparation for adding new bindings for other
>> MediaTek SoCs, such as MT8192 and others.
>>
>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>> ---
>>   Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml | 4 +---
>>   1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
>> index 78964c140b46..69212f3b1328 100644
>> --- a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
>> +++ b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
>> @@ -57,8 +57,6 @@ properties:
>>
>>     mali-supply: true
>>
>> -  sram-supply: true
>> -
> 
> Have you tried actually validating the device trees against this?
> Based on my previous tests this gives out errors.

I did... and I didn't get any complaint... but perhaps something went wrong
on my side?

I mean, I can retry just to be sure.

> 
> The reason is that each conditional is a separate sub-schema, and the
> validator is run against each schema and sub-schema separately, instead
> of collapsing matching schemas and sub-schemas together and validating
> once. So we'll get a validation error on sram-supply not being a valid
> property when validating current mt8183 against the base schema.
> 
> We have a similar issue with power-domain-names, for which I'll send
> a patch to fix. See the following for the fix:
> 
>      http://git.kernel.org/wens/c/d1adb38ab2ad0442755607c2bcc726cc17cce2c7
> 
> and the following for what I did for MT8192 on top of the previous patch:
> 
>      http://git.kernel.org/wens/c/049bd164884398d7e5f72c710da6aaa9a95bc10a
> 

Thanks for the pointer, btw

Cheers,
Angelo

> 
> Regards
> ChenYu
> 
>>     operating-points-v2: true
>>
>>     power-domains:
>> @@ -157,6 +155,7 @@ allOf:
>>               - const: core0
>>               - const: core1
>>               - const: core2
>> +        sram-supply: true
>>
>>         required:
>>           - sram-supply
>> @@ -166,7 +165,6 @@ allOf:
>>         properties:
>>           power-domains:
>>             maxItems: 1
>> -        sram-supply: false
>>     - if:
>>         properties:
>>           compatible:
>> --
>> 2.39.1
>>




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

* Re: [PATCH 2/9] dt-bindings: gpu: mali-bifrost: Allow up to 5 power domains for MT8192
  2023-02-09  8:33   ` Chen-Yu Tsai
@ 2023-02-09  9:17     ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 24+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-02-09  9:17 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: airlied, tomeu.vizoso, devicetree, linux-kernel, dri-devel,
	steven.price, robh+dt, linux-mediatek, alyssa.rosenzweig,
	krzysztof.kozlowski+dt, matthias.bgg, linux-arm-kernel

Il 09/02/23 09:33, Chen-Yu Tsai ha scritto:
> On Wed, Feb 8, 2023 at 6:37 PM AngeloGioacchino Del Regno
> <angelogioacchino.delregno@collabora.com> wrote:
>>
>> MediaTek MT8192 (and similar) needs five power domains for the
>> Mali GPU and no sram-supply: change the binding to allow so.
>>
> 
> mt8192 compatible was already added, so this should have:
> 
> Fixes: 5d82e74a97c2 ("dt-bindings: Add compatible for Mali Valhall (JM)")
> 

Yeah, agreed.



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

* Re: [PATCH 5/9] dt-bindings: gpu: mali-bifrost: Add a compatible for MediaTek MT8186
  2023-02-09  8:49   ` Chen-Yu Tsai
@ 2023-02-09  9:20     ` AngeloGioacchino Del Regno
  2023-02-09  9:45       ` Chen-Yu Tsai
  0 siblings, 1 reply; 24+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-02-09  9:20 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: airlied, tomeu.vizoso, devicetree, linux-kernel, dri-devel,
	steven.price, robh+dt, linux-mediatek, alyssa.rosenzweig,
	krzysztof.kozlowski+dt, matthias.bgg, linux-arm-kernel, Fei Shao,
	Nick Fan

Il 09/02/23 09:49, Chen-Yu Tsai ha scritto:
> On Wed, Feb 8, 2023 at 6:37 PM AngeloGioacchino Del Regno
> <angelogioacchino.delregno@collabora.com> wrote:
>>
>> Get GPU support on MT8186 by adding its compatible.
> 
> I'd skip MT8186 for now. We have to work out some binning details for the
> OPP, in particular how to deal with both Panfrost (or Mali) and SVS adding
> the OPP table. We were just looking at the Mali driver today.
> 

Dealing with binning is fairly easy... I have something already done for
that one, but I'm not sure that it would be the best option.
My solution makes use of opp-supported-hw by "standard means", but perhaps
let's have a separated conversation about it?

I don't think that skipping this would give any benefit though, because
that is only adding a compatible and whatever binning support would have
to be generic and 99% not bound to any mediatek specific compatible.

Angelo

> ChenYu


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

* Re: [PATCH 5/9] dt-bindings: gpu: mali-bifrost: Add a compatible for MediaTek MT8186
  2023-02-09  9:20     ` AngeloGioacchino Del Regno
@ 2023-02-09  9:45       ` Chen-Yu Tsai
  2023-02-09  9:58         ` AngeloGioacchino Del Regno
  0 siblings, 1 reply; 24+ messages in thread
From: Chen-Yu Tsai @ 2023-02-09  9:45 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: airlied, tomeu.vizoso, devicetree, linux-kernel, dri-devel,
	steven.price, robh+dt, linux-mediatek, alyssa.rosenzweig,
	krzysztof.kozlowski+dt, matthias.bgg, linux-arm-kernel, Fei Shao,
	Nick Fan

On Thu, Feb 9, 2023 at 5:20 PM AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> wrote:
>
> Il 09/02/23 09:49, Chen-Yu Tsai ha scritto:
> > On Wed, Feb 8, 2023 at 6:37 PM AngeloGioacchino Del Regno
> > <angelogioacchino.delregno@collabora.com> wrote:
> >>
> >> Get GPU support on MT8186 by adding its compatible.
> >
> > I'd skip MT8186 for now. We have to work out some binning details for the
> > OPP, in particular how to deal with both Panfrost (or Mali) and SVS adding
> > the OPP table. We were just looking at the Mali driver today.
> >
>
> Dealing with binning is fairly easy... I have something already done for
> that one, but I'm not sure that it would be the best option.
> My solution makes use of opp-supported-hw by "standard means", but perhaps
> let's have a separated conversation about it?
>
> I don't think that skipping this would give any benefit though, because
> that is only adding a compatible and whatever binning support would have
> to be generic and 99% not bound to any mediatek specific compatible.

The binning is related to voltage range, not maximum OPP. So it's more
like fast/slow example in Documentation/devicetree/bindings/opp/opp-v2.yaml
or the opp/allwinner,sun50i-h6-operating-points.yaml, minus the efuse node.

The downstream DT currently looks like this:

opp-950000000 {
        opp-hz = /bits/ 64 <950000000>;

/* This is Mali specific; ignore
        opp-hz-real = /bits/ 64 <950000000>,
                      /bits/ 64 <950000000>;
*/
        opp-microvolt = <900000>, <1000000>;
        opp-microvolt-bin4 = <875000>, <975000>;
        opp-microvolt-bin5 = <850000>, <950000>;
};


ChenYu

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

* Re: [PATCH 5/9] dt-bindings: gpu: mali-bifrost: Add a compatible for MediaTek MT8186
  2023-02-09  9:45       ` Chen-Yu Tsai
@ 2023-02-09  9:58         ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 24+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-02-09  9:58 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: airlied, tomeu.vizoso, devicetree, linux-kernel, dri-devel,
	steven.price, robh+dt, linux-mediatek, alyssa.rosenzweig,
	krzysztof.kozlowski+dt, matthias.bgg, linux-arm-kernel, Fei Shao,
	Nick Fan

Il 09/02/23 10:45, Chen-Yu Tsai ha scritto:
> On Thu, Feb 9, 2023 at 5:20 PM AngeloGioacchino Del Regno
> <angelogioacchino.delregno@collabora.com> wrote:
>>
>> Il 09/02/23 09:49, Chen-Yu Tsai ha scritto:
>>> On Wed, Feb 8, 2023 at 6:37 PM AngeloGioacchino Del Regno
>>> <angelogioacchino.delregno@collabora.com> wrote:
>>>>
>>>> Get GPU support on MT8186 by adding its compatible.
>>>
>>> I'd skip MT8186 for now. We have to work out some binning details for the
>>> OPP, in particular how to deal with both Panfrost (or Mali) and SVS adding
>>> the OPP table. We were just looking at the Mali driver today.
>>>
>>
>> Dealing with binning is fairly easy... I have something already done for
>> that one, but I'm not sure that it would be the best option.
>> My solution makes use of opp-supported-hw by "standard means", but perhaps
>> let's have a separated conversation about it?
>>
>> I don't think that skipping this would give any benefit though, because
>> that is only adding a compatible and whatever binning support would have
>> to be generic and 99% not bound to any mediatek specific compatible.
> 
> The binning is related to voltage range, not maximum OPP. So it's more
> like fast/slow example in Documentation/devicetree/bindings/opp/opp-v2.yaml
> or the opp/allwinner,sun50i-h6-operating-points.yaml, minus the efuse node.
> 
> The downstream DT currently looks like this:
> 
> opp-950000000 {
>          opp-hz = /bits/ 64 <950000000>;
> 
> /* This is Mali specific; ignore
>          opp-hz-real = /bits/ 64 <950000000>,
>                        /bits/ 64 <950000000>;
> */
>          opp-microvolt = <900000>, <1000000>;
>          opp-microvolt-bin4 = <875000>, <975000>;
>          opp-microvolt-bin5 = <850000>, <950000>;
> };
> 

Yes, my option is, in short:

	opp-900000000 {
		opp-hz = /bits/ 64 <900000000>;
		opp-microvolt = <850000>;
		opp-supported-hw = <0xcf>;
	};

	opp-900000000-bin4 {
		opp-hz = /bits/ 64 <900000000>;
		opp-microvolt = <837500>;
		opp-supported-hw = <0x10>;
	};

	opp-900000000-bin5 {
		opp-hz = /bits/ 64 <900000000>;
		opp-microvolt = <825000>;
		opp-supported-hw = <0x20>;
	};



> 
> ChenYu




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

* Re: [PATCH 1/9] dt-bindings: gpu: mali-bifrost: Don't allow sram-supply by default
  2023-02-09  9:15     ` AngeloGioacchino Del Regno
@ 2023-02-09 18:11       ` Rob Herring
  0 siblings, 0 replies; 24+ messages in thread
From: Rob Herring @ 2023-02-09 18:11 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: Chen-Yu Tsai, airlied, tomeu.vizoso, devicetree, linux-kernel,
	dri-devel, steven.price, linux-mediatek, alyssa.rosenzweig,
	krzysztof.kozlowski+dt, matthias.bgg, linux-arm-kernel

On Thu, Feb 09, 2023 at 10:15:33AM +0100, AngeloGioacchino Del Regno wrote:
> Il 09/02/23 03:50, Chen-Yu Tsai ha scritto:
> > On Wed, Feb 8, 2023 at 6:37 PM AngeloGioacchino Del Regno
> > <angelogioacchino.delregno@collabora.com> wrote:
> > > 
> > > The sram-supply is MediaTek-specific, it is and will ever be used
> > > only for the mediatek,mt8183-mali compatible due to the addition of
> > > the mediatek-regulator-coupler driver: change the binding to add
> > > this supply when mediatek,mt8183-mali is present as a compatible
> > > instead of disabling it when not present.
> > > 
> > > This is done in preparation for adding new bindings for other
> > > MediaTek SoCs, such as MT8192 and others.
> > > 
> > > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> > > ---
> > >   Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml | 4 +---
> > >   1 file changed, 1 insertion(+), 3 deletions(-)
> > > 
> > > diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
> > > index 78964c140b46..69212f3b1328 100644
> > > --- a/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
> > > +++ b/Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
> > > @@ -57,8 +57,6 @@ properties:
> > > 
> > >     mali-supply: true
> > > 
> > > -  sram-supply: true
> > > -
> > 
> > Have you tried actually validating the device trees against this?
> > Based on my previous tests this gives out errors.
> 
> I did... and I didn't get any complaint... but perhaps something went wrong
> on my side?
> 
> I mean, I can retry just to be sure.

You should need unevaluatedProperties instead of additionalProperties 
for this to work. The latter cannot 'see' into an if/then schema.

But really we want the default top level to allow this and then disallow 
it in an if/then schema.

Rob

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

* Re: [PATCH 2/9] dt-bindings: gpu: mali-bifrost: Allow up to 5 power domains for MT8192
  2023-02-08 10:37 ` [PATCH 2/9] dt-bindings: gpu: mali-bifrost: Allow up to 5 power domains for MT8192 AngeloGioacchino Del Regno
  2023-02-09  8:33   ` Chen-Yu Tsai
@ 2023-02-09 18:13   ` Rob Herring
  1 sibling, 0 replies; 24+ messages in thread
From: Rob Herring @ 2023-02-09 18:13 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: devicetree, dri-devel, linux-arm-kernel, matthias.bgg,
	tomeu.vizoso, daniel, krzysztof.kozlowski+dt, linux-kernel,
	steven.price, alyssa.rosenzweig, robh+dt, airlied,
	linux-mediatek


On Wed, 08 Feb 2023 11:37:02 +0100, AngeloGioacchino Del Regno wrote:
> MediaTek MT8192 (and similar) needs five power domains for the
> Mali GPU and no sram-supply: change the binding to allow so.
> 
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  .../bindings/gpu/arm,mali-bifrost.yaml        | 34 +++++++++++++++++--
>  1 file changed, 31 insertions(+), 3 deletions(-)
> 

Reviewed-by: Rob Herring <robh@kernel.org>


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

* Re: [PATCH 3/9] dt-bindings: gpu: mali-bifrost: Add compatible for MT8195 SoC
  2023-02-08 10:37 ` [PATCH 3/9] dt-bindings: gpu: mali-bifrost: Add compatible for MT8195 SoC AngeloGioacchino Del Regno
@ 2023-02-09 18:15   ` Rob Herring
  0 siblings, 0 replies; 24+ messages in thread
From: Rob Herring @ 2023-02-09 18:15 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: robh+dt, linux-arm-kernel, steven.price, airlied, tomeu.vizoso,
	devicetree, alyssa.rosenzweig, linux-mediatek,
	krzysztof.kozlowski+dt, matthias.bgg, daniel, linux-kernel,
	dri-devel


On Wed, 08 Feb 2023 11:37:03 +0100, AngeloGioacchino Del Regno wrote:
> The MediaTek MT8195 SoC has a Mali G57 MC5 (Valhall-JM) and has the
> same number of power domains and requirements as MT8192 in terms of
> bindings.
> 
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml | 5 +++++
>  1 file changed, 5 insertions(+)
> 

Reviewed-by: Rob Herring <robh@kernel.org>


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

* Re: [PATCH 4/9] dt-bindings: gpu: mali-bifrost: Add new MT8183 compatible
  2023-02-08 10:37 ` [PATCH 4/9] dt-bindings: gpu: mali-bifrost: Add new MT8183 compatible AngeloGioacchino Del Regno
@ 2023-02-09 18:15   ` Rob Herring
  0 siblings, 0 replies; 24+ messages in thread
From: Rob Herring @ 2023-02-09 18:15 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: linux-arm-kernel, linux-kernel, dri-devel, daniel, airlied,
	linux-mediatek, steven.price, robh+dt, devicetree,
	alyssa.rosenzweig, tomeu.vizoso, krzysztof.kozlowski+dt,
	matthias.bgg


On Wed, 08 Feb 2023 11:37:04 +0100, AngeloGioacchino Del Regno wrote:
> Since new platform data was required in Panfrost for getting GPU DVFS
> finally working on MediaTek SoCs, add a new "mediatek,mt8183b-mali"
> compatible.
> 
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  .../bindings/gpu/arm,mali-bifrost.yaml        | 20 +++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 

Reviewed-by: Rob Herring <robh@kernel.org>


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

end of thread, other threads:[~2023-02-09 18:16 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-08 10:37 [PATCH 0/9] Panfrost: Improve and add MediaTek SoCs support AngeloGioacchino Del Regno
2023-02-08 10:37 ` [PATCH 1/9] dt-bindings: gpu: mali-bifrost: Don't allow sram-supply by default AngeloGioacchino Del Regno
2023-02-09  2:50   ` Chen-Yu Tsai
2023-02-09  9:15     ` AngeloGioacchino Del Regno
2023-02-09 18:11       ` Rob Herring
2023-02-08 10:37 ` [PATCH 2/9] dt-bindings: gpu: mali-bifrost: Allow up to 5 power domains for MT8192 AngeloGioacchino Del Regno
2023-02-09  8:33   ` Chen-Yu Tsai
2023-02-09  9:17     ` AngeloGioacchino Del Regno
2023-02-09 18:13   ` Rob Herring
2023-02-08 10:37 ` [PATCH 3/9] dt-bindings: gpu: mali-bifrost: Add compatible for MT8195 SoC AngeloGioacchino Del Regno
2023-02-09 18:15   ` Rob Herring
2023-02-08 10:37 ` [PATCH 4/9] dt-bindings: gpu: mali-bifrost: Add new MT8183 compatible AngeloGioacchino Del Regno
2023-02-09 18:15   ` Rob Herring
2023-02-08 10:37 ` [PATCH 5/9] dt-bindings: gpu: mali-bifrost: Add a compatible for MediaTek MT8186 AngeloGioacchino Del Regno
2023-02-09  8:49   ` Chen-Yu Tsai
2023-02-09  9:20     ` AngeloGioacchino Del Regno
2023-02-09  9:45       ` Chen-Yu Tsai
2023-02-09  9:58         ` AngeloGioacchino Del Regno
2023-02-08 10:37 ` [PATCH 6/9] drm/panfrost: Increase MAX_PM_DOMAINS to 5 AngeloGioacchino Del Regno
2023-02-08 10:37 ` [PATCH 7/9] drm/panfrost: Add the MT8192 GPU ID AngeloGioacchino Del Regno
2023-02-08 10:37 ` [PATCH 8/9] drm/panfrost: Add mediatek,mt8192-mali compatible AngeloGioacchino Del Regno
2023-02-08 10:37 ` [PATCH 9/9] drm/panfrost: Add new compatible for Mali on the MT8183 SoC AngeloGioacchino Del Regno
2023-02-08 15:11 ` [PATCH 0/9] Panfrost: Improve and add MediaTek SoCs support Steven Price
2023-02-09  9:10 ` Chen-Yu Tsai

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