Skip to contentSkip to conversation

dt-bindings: power: Convert mediatek,mt2701-scpsys to DT schema

PATCH Superseded Rob Herring (Arm) 2 participants 2 messages Sep 25

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Rob Herring (Arm)

author maintainer
#0 lore raw

PATCH 1/1 dt-bindings: power: Convert mediatek,mt2701-scpsys to DT schema

Convert the mediatek,mt2701-scpsys binding to DT schema. The mt6735 and mt6765 don't exist anywhere. The mt8183 is covered by mediatek,mt8195-scpsys.yaml schema. With those dropped, the clock-names are trimmed to drop mm-*, isp-*, cam-*, and venc_lt. The venc_lt and mfg_2d supplies are dropped as well.

Assisted-by LLM
---
 .../power/mediatek,mt2701-scpsys.yaml         | 111 ++++++++++++++++++
 .../bindings/soc/mediatek/scpsys.txt          |  79 -------------
 2 files changed, 111 insertions(+), 79 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/power/mediatek,mt2701-scpsys.yaml
 delete mode 100644 Documentation/devicetree/bindings/soc/mediatek/scpsys.txt
Documentation/devicetree/bindings/power/mediatek,mt2701-scpsys.yaml new file +111 -0
new file mode 100644
index 000000000000..d991b8a008eb
@@ -0,0 +1,111 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/mediatek,mt2701-scpsys.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek SCPSYS
+
+maintainers:
+  - Matthias Brugger <[email protected]>
+  - AngeloGioacchino Del Regno <[email protected]>
+
+description: >
+  The System Control Processor System (SCPSYS) has several power management
+  related tasks in the system. The tasks include thermal measurement, dynamic
+  voltage frequency scaling (DVFS), interrupt filter and lowlevel sleep control.
+  The System Power Manager (SPM) inside the SCPSYS is for the MTCMOS power
+  domain control.
+
+  It provides the power domains defined in:
+    - include/dt-bindings/power/mt2701-power.h
+    - include/dt-bindings/power/mt2712-power.h
+    - include/dt-bindings/power/mt6797-power.h
+    - include/dt-bindings/power/mt7622-power.h
+    - include/dt-bindings/power/mt7623a-power.h
+
+properties:
+  compatible:
+    oneOf:
+      - enum:
+          - mediatek,mt7623a-scpsys
+          - mediatek,mt6797-scpsys
+      - items:
+          - enum:
+              - mediatek,mt2701-scpsys
+              - mediatek,mt2712-scpsys
+              - mediatek,mt7622-scpsys
+          - const: syscon
+      - items:
+          - const: mediatek,mt7623-scpsys
+          - const: mediatek,mt2701-scpsys
+          - const: syscon
+      - items:
+          - const: mediatek,mt7629-scpsys
+          - const: mediatek,mt7622-scpsys
+
+  '#power-domain-cells':
+    description: Always 1
+    const: 1
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 4
+
+  clocks:
+    minItems: 1
+    maxItems: 20
+
+  clock-names:
+    minItems: 1
+    maxItems: 6
+    items:
+      enum:
+        - mm
+        - mfg
+        - ethif
+        - venc
+        - jpgdec
+        - audio
+        - vdec
+        - hif_sel
+
+  vdec-supply: true
+  venc-supply: true
+  isp-supply: true
+  mm-supply: true
+  audio-supply: true
+  usb-supply: true
+  mfg_async-supply: true
+  mfg-supply: true
+
+  infracfg:
+    description: Infrastructure configuration controller phandle
+    $ref: /schemas/types.yaml#/definitions/phandle
+
+required:
+  - compatible
+  - '#power-domain-cells'
+  - reg
+  - infracfg
+  - clocks
+  - clock-names
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/mt2701-clk.h>
+
+    power-controller@10006000 {
+        #power-domain-cells = <1>;
+        compatible = "mediatek,mt2701-scpsys", "syscon";
+        reg = <0x10006000 0x1000>;
+        infracfg = <&infracfg>;
+        clocks = <&topckgen CLK_TOP_MM_SEL>,
+                  <&topckgen CLK_TOP_MFG_SEL>,
+                  <&topckgen CLK_TOP_ETHIF_SEL>;
+        clock-names = "mm", "mfg", "ethif";
+    };
Documentation/devicetree/bindings/soc/mediatek/scpsys.txt deleted +0 -79

79 lines not on this page · raw message

Signature · 1 line
2.53.0
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] dt-bindings: missing if-then conditionals for clock constraints per compatible --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] dt-bindings: missing if-then conditionals for clock constraints per compatible --

commit 58363c1987ec9c749cc55c9a540860ff57ed2f23
Author: Rob Herring (Arm) <[email protected]>

dt-bindings: power: Convert mediatek,mt2701-scpsys to DT schema

Convert the mediatek,mt2701-scpsys binding to DT schema. The mt6735 and mt6765 don't exist anywhere. The mt8183 is covered by mediatek,mt8195-scpsys.yaml schema. With those dropped, the clock-names are trimmed to drop mm-*, isp-*, cam-*, and venc_lt. The venc_lt and mfg_2d supplies are dropped as well.

Quoted 5 lines
Documentation/devicetree/bindings/power/mediatek,mt2701-scpsys.yaml new file +0 -0
new file mode 100644
index 0000000000000..d991b8a008eba

[ ... ]

Quoted 7 lines
Documentation/devicetree/bindings/power/mediatek,mt2701-scpsys.yaml new file +7 -0
+  clocks:
+    minItems: 1
+    maxItems: 20
+
+  clock-names:
+    minItems: 1
+    maxItems: 6

Documentation/devicetree/bindings/power/mediatek,mt2701-scpsys.yaml line 73

Quoted 10 lines
Documentation/devicetree/bindings/power/mediatek,mt2701-scpsys.yaml new file +10 -0
+    items:
+      enum:
+        - mm
+        - mfg
+        - ethif
+        - venc
+        - jpgdec
+        - audio
+        - vdec
+        - hif_sel

[Severity: Medium]
Does this generic definition omit the hardware-specific constraints from the original text binding?

The original text binding required specific clock combinations based on the SoC (for example, MT2712 explicitly required "mm", "mfg", "venc", "jpgdec", "audio", and "vdec").

This new schema generically allows any device tree to provide 1 to 6 clocks from the enum in any order, which would allow invalid configurations missing required clocks to silently pass dt_binding_check validation.

Should there be allOf and if-then conditional blocks to enforce the correct clocks and clock-names constraints per compatible string?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1