Skip to contentSkip to conversation

dt-bindings: Convert OPP bindings to DT schema

PATCH Superseded Rob Herring 2 participants 6 messages Jun 23, 2021 – Jun 24, 2021

Subsystems (8)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Rob Herring

author maintainer
#0 lore raw

cover dt-bindings: Convert OPP bindings to DT schema

The OPP bindings are one of the most common occurring bindings that are not yet converted to schema, so let's convert them.

Note this depends on a dtschema change in property-units.yaml to allow a matrix for opp-microvolt.

Rob

Rob Herring (2):
dt-bindings: Clean-up OPP binding node names in examples
dt-bindings: opp: Convert to DT schema

 .../bindings/gpu/arm,mali-bifrost.yaml        |   2 +-
 .../bindings/gpu/arm,mali-midgard.yaml        |   2 +-
 .../bindings/interconnect/fsl,imx8m-noc.yaml  |   4 +-
 .../allwinner,sun50i-h6-operating-points.yaml |   4 +
 .../devicetree/bindings/opp/opp-v1.yaml       |  51 ++
 .../devicetree/bindings/opp/opp-v2-base.yaml  | 213 ++++++
 .../devicetree/bindings/opp/opp-v2.yaml       | 475 +++++++++++++
 Documentation/devicetree/bindings/opp/opp.txt | 622 ------------------
 8 files changed, 747 insertions(+), 626 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/opp/opp-v1.yaml
 create mode 100644 Documentation/devicetree/bindings/opp/opp-v2-base.yaml
 create mode 100644 Documentation/devicetree/bindings/opp/opp-v2.yaml
 delete mode 100644 Documentation/devicetree/bindings/opp/opp.txt
Signature · 1 line
2.27.0
author maintainer
#1 lore raw

PATCH 1/2 dt-bindings: Clean-up OPP binding node names in examples

In preparation to convert OPP bindings to DT schema, clean-up a few OPP binding node names in the binding examples.

---
 Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml   | 2 +-
 Documentation/devicetree/bindings/gpu/arm,mali-midgard.yaml   | 2 +-
 .../devicetree/bindings/interconnect/fsl,imx8m-noc.yaml       | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml +1 -1
index 894ba217ab32..260afff8cfbb 100644
@@ -108,7 +108,7 @@ examples:
       resets = <&reset 0>, <&reset 1>;
     };
 
-    gpu_opp_table: opp_table0 {
+    gpu_opp_table: opp-table {
       compatible = "operating-points-v2";
 
       opp-533000000 {
Documentation/devicetree/bindings/gpu/arm,mali-midgard.yaml +1 -1
index 696c17aedbbe..d209f272625d 100644
@@ -160,7 +160,7 @@ examples:
       #cooling-cells = <2>;
     };
 
-    gpu_opp_table: opp_table0 {
+    gpu_opp_table: opp-table {
       compatible = "operating-points-v2";
 
       opp-533000000 {
Documentation/devicetree/bindings/interconnect/fsl,imx8m-noc.yaml +2 -2
index a8873739d61a..b8204ed22dd5 100644
@@ -81,10 +81,10 @@ examples:
         noc_opp_table: opp-table {
             compatible = "operating-points-v2";
 
-            opp-133M {
+            opp-133333333 {
                 opp-hz = /bits/ 64 <133333333>;
             };
-            opp-800M {
+            opp-800000000 {
                 opp-hz = /bits/ 64 <800000000>;
             };
         };
Signature · 1 line
2.27.0
author maintainer
#3 lore raw

PATCH 2/2 dt-bindings: opp: Convert to DT schema

In reply to Rob Herring

Convert the OPP v1 and v2 bindings to DT schema format. As the OPPv2 binding can be extended by vendors, we need to split the common part out from the "operating-points-v2" conforming compatible.

Cc Yangtao Li <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Nishanth Menon <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Chen-Yu Tsai <[email protected]>
---
 .../allwinner,sun50i-h6-operating-points.yaml |   4 +
 .../devicetree/bindings/opp/opp-v1.yaml       |  51 ++
 .../devicetree/bindings/opp/opp-v2-base.yaml  | 213 ++++++
 .../devicetree/bindings/opp/opp-v2.yaml       | 475 +++++++++++++
 Documentation/devicetree/bindings/opp/opp.txt | 622 ------------------
 5 files changed, 743 insertions(+), 622 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/opp/opp-v1.yaml
 create mode 100644 Documentation/devicetree/bindings/opp/opp-v2-base.yaml
 create mode 100644 Documentation/devicetree/bindings/opp/opp-v2.yaml
 delete mode 100644 Documentation/devicetree/bindings/opp/opp.txt
Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml +4 -0
index aeff2bd774dd..729ae97b63d9 100644
@@ -18,6 +18,9 @@ description: |
   sun50i-cpufreq-nvmem driver reads the efuse value from the SoC to
   provide the OPP framework with required information.
 
+allOf:
+  - $ref: opp-v2-base.yaml#
+
 properties:
   compatible:
     const: allwinner,sun50i-h6-operating-points
@@ -43,6 +46,7 @@ patternProperties:
 
     properties:
       opp-hz: true
+      clock-latency-ns: true
 
     patternProperties:
       "opp-microvolt-.*": true
Documentation/devicetree/bindings/opp/opp-v1.yaml new file +51 -0

51 lines not on this page · raw message

Documentation/devicetree/bindings/opp/opp-v2-base.yaml new file +213 -0

213 lines not on this page · raw message

Documentation/devicetree/bindings/opp/opp-v2.yaml new file +475 -0

475 lines not on this page · raw message

Documentation/devicetree/bindings/opp/opp.txt deleted +0 -622

622 lines not on this page · raw message

Signature · 1 line
2.27.0
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] dt-bindings: Clean-up OPP binding node names in examples

In reply to Rob Herring
Quoted 10 lines · Rob Herring

In preparation to convert OPP bindings to DT schema, clean-up a few OPP binding node names in the binding examples.

Quoted 5 lines
---
 Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml   | 2 +-
 Documentation/devicetree/bindings/gpu/arm,mali-midgard.yaml   | 2 +-
 .../devicetree/bindings/interconnect/fsl,imx8m-noc.yaml       | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
Signature · 1 line
viresh
Acked-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] dt-bindings: opp: Convert to DT schema

In reply to Rob Herring

Thanks for taking it up :)

Quoted 48 lines · Rob Herring
Documentation/devicetree/bindings/opp/opp-v2-base.yaml +47 -0
+$id: http://devicetree.org/schemas/opp/opp-v2-base.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Generic OPP (Operating Performance Points) Common Binding
+
+maintainers:
+  - Viresh Kumar <[email protected]>
+
+description: |
+  Devices work at voltage-current-frequency combinations and some implementations
+  have the liberty of choosing these. These combinations are called Operating
+  Performance Points aka OPPs. This document defines bindings for these OPPs
+  applicable across wide range of devices. For illustration purpose, this document
+  uses CPU as a device.
+
+  This describes the OPPs belonging to a device.
+
+select: false
+
+properties:
+  $nodename:
+    pattern: '^opp-table(-[a-z0-9]+)?$'
+
+  opp-shared:
+    description:
+      Indicates that device nodes using this OPP Table Node's phandle switch
+      their DVFS state together, i.e. they share clock/voltage/current lines.
+      Missing property means devices have independent clock/voltage/current
+      lines, but they share OPP tables.
+    type: boolean
+
+patternProperties:
+  '^opp-?[0-9]+$':
+    type: object
+    description:
+      One or more OPP nodes describing voltage-current-frequency combinations.
+      Their name isn't significant but their phandle can be used to reference an
+      OPP. These are mandatory except for the case where the OPP table is
+      present only to indicate dependency between devices using the opp-shared
+      property.
+
+    properties:
+      opp-hz:
+        description:
+          Frequency in Hz, expressed as a 64-bit big-endian integer. This is a
+          required property for all device nodes, unless another "required"
+          property to uniquely identify the OPP nodes exists. Devices like power

Documentation/devicetree/bindings/opp/opp-v2-base.yaml line 60

Quoted 10 lines
Documentation/devicetree/bindings/opp/opp-v2-base.yaml +10 -0
+          domains must have another (implementation dependent) property.
+
+      opp-peak-kBps:
+        description:
+          Peak bandwidth in kilobytes per second, expressed as an array of
+          32-bit big-endian integers. Each element of the array represents the
+          peak bandwidth value of each interconnect path. The number of elements
+          should match the number of interconnect paths.
+        minItems: 1
+        maxItems: 32  # Should be enough

Can we move this down, closer to opp-avg-kBps ?

Quoted 9 lines
Documentation/devicetree/bindings/opp/opp-v2-base.yaml +9 -0
+
+      opp-microvolt:
+        description: |
+          Voltage for the OPP
+
+          A single regulator's voltage is specified with an array of size one or three.
+          Single entry is for target voltage and three entries are for <target min max>
+          voltages.
+

Documentation/devicetree/bindings/opp/opp-v2-base.yaml line 79

Quoted 10 lines
Documentation/devicetree/bindings/opp/opp-v2-base.yaml +10 -0
+          Entries for multiple regulators shall be provided in the same field separated
+          by angular brackets <>. The OPP binding doesn't provide any provisions to
+          relate the values to their power supplies or the order in which the supplies
+          need to be configured and that is left for the implementation specific
+          binding.
+
+          Entries for all regulators shall be of the same size, i.e. either all use a
+          single value or triplets.
+        minItems: 1
+        maxItems: 8

For consistency with rest of the doc, maybe add

# Should be enough regulators

Documentation/devicetree/bindings/opp/opp-v2-base.yaml line 91

Quoted 12 lines
Documentation/devicetree/bindings/opp/opp-v2-base.yaml +12 -0
+        items:
+          minItems: 1
+          maxItems: 3
+
+      opp-microamp:
+        description: |
+          The maximum current drawn by the device in microamperes considering
+          system specific parameters (such as transients, process, aging,
+          maximum operating temperature range etc.) as necessary. This may be
+          used to set the most efficient regulator operating mode.
+
+          Should only be set if opp-microvolt(-name)? is set for the OPP.

What is the significance of '?' here ?

Quoted 4 lines
Documentation/devicetree/bindings/opp/opp-v2-base.yaml +4 -0
+
+          Entries for multiple regulators shall be provided in the same field
+          separated by angular brackets <>. If current values aren't required
+          for a regulator, then it shall be filled with 0. If current values

Documentation/devicetree/bindings/opp/opp-v2-base.yaml line 105

Quoted 10 lines
Documentation/devicetree/bindings/opp/opp-v2-base.yaml +10 -0
+          aren't required for any of the regulators, then this field is not
+          required. The OPP binding doesn't provide any provisions to relate the
+          values to their power supplies or the order in which the supplies need
+          to be configured and that is left for the implementation specific
+          binding.
+        minItems: 1
+        maxItems: 8   # Should be enough regulators
+        items:
+          minItems: 1
+          maxItems: 3
Signature · 1 line
viresh
author maintainer
#5 lore raw

Re: [PATCH 2/2] dt-bindings: opp: Convert to DT schema

Quoted 56 lines · Viresh Kumar

Thanks for taking it up :)

Quoted 52 lines · Rob Herring
Documentation/devicetree/bindings/opp/opp-v2-base.yaml +51 -0
+$id: http://devicetree.org/schemas/opp/opp-v2-base.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Generic OPP (Operating Performance Points) Common Binding
+
+maintainers:
+  - Viresh Kumar <[email protected]>
+
+description: |
+  Devices work at voltage-current-frequency combinations and some implementations
+  have the liberty of choosing these. These combinations are called Operating
+  Performance Points aka OPPs. This document defines bindings for these OPPs
+  applicable across wide range of devices. For illustration purpose, this document
+  uses CPU as a device.
+
+  This describes the OPPs belonging to a device.
+
+select: false
+
+properties:
+  $nodename:
+    pattern: '^opp-table(-[a-z0-9]+)?$'
+
+  opp-shared:
+    description:
+      Indicates that device nodes using this OPP Table Node's phandle switch
+      their DVFS state together, i.e. they share clock/voltage/current lines.
+      Missing property means devices have independent clock/voltage/current
+      lines, but they share OPP tables.
+    type: boolean
+
+patternProperties:
+  '^opp-?[0-9]+$':
+    type: object
+    description:
+      One or more OPP nodes describing voltage-current-frequency combinations.
+      Their name isn't significant but their phandle can be used to reference an
+      OPP. These are mandatory except for the case where the OPP table is
+      present only to indicate dependency between devices using the opp-shared
+      property.
+
+    properties:
+      opp-hz:
+        description:
+          Frequency in Hz, expressed as a 64-bit big-endian integer. This is a
+          required property for all device nodes, unless another "required"
+          property to uniquely identify the OPP nodes exists. Devices like power
+          domains must have another (implementation dependent) property.
+
+      opp-peak-kBps:
+        description:
Quoted 8 lines

Documentation/devicetree/bindings/opp/opp-v2-base.yaml line 60

Quoted 6 lines
Documentation/devicetree/bindings/opp/opp-v2-base.yaml +6 -0
+          Peak bandwidth in kilobytes per second, expressed as an array of
+          32-bit big-endian integers. Each element of the array represents the
+          peak bandwidth value of each interconnect path. The number of elements
+          should match the number of interconnect paths.
+        minItems: 1
+        maxItems: 32  # Should be enough

Can we move this down, closer to opp-avg-kBps ?

Sure.

Quoted 24 lines
Quoted 9 lines
Documentation/devicetree/bindings/opp/opp-v2-base.yaml +9 -0
+
+      opp-microvolt:
+        description: |
+          Voltage for the OPP
+
+          A single regulator's voltage is specified with an array of size one or three.
+          Single entry is for target voltage and three entries are for <target min max>
+          voltages.
+

Documentation/devicetree/bindings/opp/opp-v2-base.yaml line 79

Quoted 10 lines
Documentation/devicetree/bindings/opp/opp-v2-base.yaml +10 -0
+          Entries for multiple regulators shall be provided in the same field separated
+          by angular brackets <>. The OPP binding doesn't provide any provisions to
+          relate the values to their power supplies or the order in which the supplies
+          need to be configured and that is left for the implementation specific
+          binding.
+
+          Entries for all regulators shall be of the same size, i.e. either all use a
+          single value or triplets.
+        minItems: 1
+        maxItems: 8

For consistency with rest of the doc, maybe add

# Should be enough regulators

Quoted 14 lines

Documentation/devicetree/bindings/opp/opp-v2-base.yaml line 91

Quoted 12 lines
Documentation/devicetree/bindings/opp/opp-v2-base.yaml +12 -0
+        items:
+          minItems: 1
+          maxItems: 3
+
+      opp-microamp:
+        description: |
+          The maximum current drawn by the device in microamperes considering
+          system specific parameters (such as transients, process, aging,
+          maximum operating temperature range etc.) as necessary. This may be
+          used to set the most efficient regulator operating mode.
+
+          Should only be set if opp-microvolt(-name)? is set for the OPP.

What is the significance of '?' here ?

regex. '?' means optional.

Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/opp/opp-v2-base.yaml +5 -0
+          Entries for multiple regulators shall be provided in the same field
+          separated by angular brackets <>. If current values aren't required
+          for a regulator, then it shall be filled with 0. If current values
+          aren't required for any of the regulators, then this field is not
+          required. The OPP binding doesn't provide any provisions to relate the
Quoted 8 lines

Documentation/devicetree/bindings/opp/opp-v2-base.yaml line 105

Quoted 8 lines
Documentation/devicetree/bindings/opp/opp-v2-base.yaml +8 -0
+          values to their power supplies or the order in which the supplies need
+          to be configured and that is left for the implementation specific
+          binding.
+        minItems: 1
+        maxItems: 8   # Should be enough regulators
+        items:
+          minItems: 1
+          maxItems: 3

Actually, I need to drop these 3 lines as opp-microamp doesn't have a range like opp-microvolt.

Quoted 5 lines

--
viresh