diff mbox series

[3/7] dt-bindings: power: Convert domain-idle-states bindings to json-schema

Message ID 20200303150749.30566-4-ulf.hansson@linaro.org
State New
Headers show
Series dt-bindings: arm: Fix bindings used for hierarchical PSCI states | expand

Commit Message

Ulf Hansson March 3, 2020, 3:07 p.m. UTC
While converting to the json-schema, let's also take the opportunity to
further specify/clarify some more details about the DT binding.

For example, let's define the label where to put the states nodes, set a
pattern for nodename of the state nodes and finally add an example.

Fixes: a3f048b5424e ("dt: psci: Update DT bindings to support hierarchical PSCI states")
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

---
 .../devicetree/bindings/arm/psci.yaml         |  2 +-
 .../bindings/power/domain-idle-state.txt      | 33 ---------
 .../bindings/power/domain-idle-state.yaml     | 67 +++++++++++++++++++
 .../bindings/power/power-domain.yaml          | 22 +++---
 .../bindings/power/power_domain.txt           |  2 +-
 5 files changed, 79 insertions(+), 47 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/power/domain-idle-state.txt
 create mode 100644 Documentation/devicetree/bindings/power/domain-idle-state.yaml

-- 
2.20.1

Comments

Rob Herring March 3, 2020, 5:02 p.m. UTC | #1
On Tue, Mar 03, 2020 at 04:07:45PM +0100, Ulf Hansson wrote:
> While converting to the json-schema, let's also take the opportunity to
> further specify/clarify some more details about the DT binding.
> 
> For example, let's define the label where to put the states nodes, set a
> pattern for nodename of the state nodes and finally add an example.
> 
> Fixes: a3f048b5424e ("dt: psci: Update DT bindings to support hierarchical PSCI states")
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> ---
>  .../devicetree/bindings/arm/psci.yaml         |  2 +-
>  .../bindings/power/domain-idle-state.txt      | 33 ---------
>  .../bindings/power/domain-idle-state.yaml     | 67 +++++++++++++++++++
>  .../bindings/power/power-domain.yaml          | 22 +++---
>  .../bindings/power/power_domain.txt           |  2 +-
>  5 files changed, 79 insertions(+), 47 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/power/domain-idle-state.txt
>  create mode 100644 Documentation/devicetree/bindings/power/domain-idle-state.yaml
> 
> diff --git a/Documentation/devicetree/bindings/arm/psci.yaml b/Documentation/devicetree/bindings/arm/psci.yaml
> index 540211a080d4..0bc3c43a525a 100644
> --- a/Documentation/devicetree/bindings/arm/psci.yaml
> +++ b/Documentation/devicetree/bindings/arm/psci.yaml
> @@ -123,7 +123,7 @@ properties:
>        to mandate it.
>  
>        [3] Documentation/devicetree/bindings/power/power_domain.txt
> -      [4] Documentation/devicetree/bindings/power/domain-idle-state.txt
> +      [4] Documentation/devicetree/bindings/power/domain-idle-state.yaml
>  
>    power-domains:
>      $ref: '/schemas/types.yaml#/definitions/phandle-array'
> diff --git a/Documentation/devicetree/bindings/power/domain-idle-state.txt b/Documentation/devicetree/bindings/power/domain-idle-state.txt
> deleted file mode 100644
> index eefc7ed22ca2..000000000000
> --- a/Documentation/devicetree/bindings/power/domain-idle-state.txt
> +++ /dev/null
> @@ -1,33 +0,0 @@
> -PM Domain Idle State Node:
> -
> -A domain idle state node represents the state parameters that will be used to
> -select the state when there are no active components in the domain.
> -
> -The state node has the following parameters -
> -
> -- compatible:
> -	Usage: Required
> -	Value type: <string>
> -	Definition: Must be "domain-idle-state".
> -
> -- entry-latency-us
> -	Usage: Required
> -	Value type: <prop-encoded-array>
> -	Definition: u32 value representing worst case latency in
> -		    microseconds required to enter the idle state.
> -		    The exit-latency-us duration may be guaranteed
> -		    only after entry-latency-us has passed.
> -
> -- exit-latency-us
> -	Usage: Required
> -	Value type: <prop-encoded-array>
> -	Definition: u32 value representing worst case latency
> -		    in microseconds required to exit the idle state.
> -
> -- min-residency-us
> -	Usage: Required
> -	Value type: <prop-encoded-array>
> -	Definition: u32 value representing minimum residency duration
> -		    in microseconds after which the idle state will yield
> -		    power benefits after overcoming the overhead in entering
> -i		    the idle state.
> diff --git a/Documentation/devicetree/bindings/power/domain-idle-state.yaml b/Documentation/devicetree/bindings/power/domain-idle-state.yaml
> new file mode 100644
> index 000000000000..27da43076b85
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power/domain-idle-state.yaml
> @@ -0,0 +1,67 @@
> +# SPDX-License-Identifier: GPL-2.0
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/power/domain-idle-state.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: PM Domain Idle States binding description
> +
> +maintainers:
> +  - Ulf Hansson <ulf.hansson@linaro.org>
> +
> +description:
> +  A domain idle state node represents the state parameters that will be used to
> +  select the state when there are no active components in the PM domain.
> +
> +properties:
> +  $nodename:
> +    const: domain-idle-states
> +
> +patternProperties:
> +  "^(cpu|cluster|domain)-":
> +    type: object
> +    description:
> +      Each state node represents a domain idle state description.
> +
> +    properties:
> +      compatible:
> +        const: domain-idle-state
> +
> +      entry-latency-us:
> +        $ref: /schemas/types.yaml#/definitions/uint32

You don't need a type because the core schema defines it for all 
standard units.

> +        description:
> +          The worst case latency in microseconds required to enter the idle
> +          state. Note that, the exit-latency-us duration may be guaranteed only
> +          after the entry-latency-us has passed.
> +
> +      exit-latency-us:
> +        $ref: /schemas/types.yaml#/definitions/uint32
> +        description:
> +          The worst case latency in microseconds required to exit the idle
> +          state.
> +
> +      min-residency-us:
> +        $ref: /schemas/types.yaml#/definitions/uint32
> +        description:
> +          The minimum residency duration in microseconds after which the idle
> +          state will yield power benefits, after overcoming the overhead while
> +          entering the idle state.
> +
> +    required:
> +      - compatible
> +      - entry-latency-us
> +      - exit-latency-us
> +      - min-residency-us

       additionalProperties: false 

Do we have cases of adding additional properties?

I can fix these up when applying.

Rob
Ulf Hansson March 3, 2020, 8:45 p.m. UTC | #2
On Tue, 3 Mar 2020 at 18:02, Rob Herring <robh@kernel.org> wrote:
>
> On Tue, Mar 03, 2020 at 04:07:45PM +0100, Ulf Hansson wrote:
> > While converting to the json-schema, let's also take the opportunity to
> > further specify/clarify some more details about the DT binding.
> >
> > For example, let's define the label where to put the states nodes, set a
> > pattern for nodename of the state nodes and finally add an example.
> >
> > Fixes: a3f048b5424e ("dt: psci: Update DT bindings to support hierarchical PSCI states")
> > Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> > ---
> >  .../devicetree/bindings/arm/psci.yaml         |  2 +-
> >  .../bindings/power/domain-idle-state.txt      | 33 ---------
> >  .../bindings/power/domain-idle-state.yaml     | 67 +++++++++++++++++++
> >  .../bindings/power/power-domain.yaml          | 22 +++---
> >  .../bindings/power/power_domain.txt           |  2 +-
> >  5 files changed, 79 insertions(+), 47 deletions(-)
> >  delete mode 100644 Documentation/devicetree/bindings/power/domain-idle-state.txt
> >  create mode 100644 Documentation/devicetree/bindings/power/domain-idle-state.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/arm/psci.yaml b/Documentation/devicetree/bindings/arm/psci.yaml
> > index 540211a080d4..0bc3c43a525a 100644
> > --- a/Documentation/devicetree/bindings/arm/psci.yaml
> > +++ b/Documentation/devicetree/bindings/arm/psci.yaml
> > @@ -123,7 +123,7 @@ properties:
> >        to mandate it.
> >
> >        [3] Documentation/devicetree/bindings/power/power_domain.txt
> > -      [4] Documentation/devicetree/bindings/power/domain-idle-state.txt
> > +      [4] Documentation/devicetree/bindings/power/domain-idle-state.yaml
> >
> >    power-domains:
> >      $ref: '/schemas/types.yaml#/definitions/phandle-array'
> > diff --git a/Documentation/devicetree/bindings/power/domain-idle-state.txt b/Documentation/devicetree/bindings/power/domain-idle-state.txt
> > deleted file mode 100644
> > index eefc7ed22ca2..000000000000
> > --- a/Documentation/devicetree/bindings/power/domain-idle-state.txt
> > +++ /dev/null
> > @@ -1,33 +0,0 @@
> > -PM Domain Idle State Node:
> > -
> > -A domain idle state node represents the state parameters that will be used to
> > -select the state when there are no active components in the domain.
> > -
> > -The state node has the following parameters -
> > -
> > -- compatible:
> > -     Usage: Required
> > -     Value type: <string>
> > -     Definition: Must be "domain-idle-state".
> > -
> > -- entry-latency-us
> > -     Usage: Required
> > -     Value type: <prop-encoded-array>
> > -     Definition: u32 value representing worst case latency in
> > -                 microseconds required to enter the idle state.
> > -                 The exit-latency-us duration may be guaranteed
> > -                 only after entry-latency-us has passed.
> > -
> > -- exit-latency-us
> > -     Usage: Required
> > -     Value type: <prop-encoded-array>
> > -     Definition: u32 value representing worst case latency
> > -                 in microseconds required to exit the idle state.
> > -
> > -- min-residency-us
> > -     Usage: Required
> > -     Value type: <prop-encoded-array>
> > -     Definition: u32 value representing minimum residency duration
> > -                 in microseconds after which the idle state will yield
> > -                 power benefits after overcoming the overhead in entering
> > -i                the idle state.
> > diff --git a/Documentation/devicetree/bindings/power/domain-idle-state.yaml b/Documentation/devicetree/bindings/power/domain-idle-state.yaml
> > new file mode 100644
> > index 000000000000..27da43076b85
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/power/domain-idle-state.yaml
> > @@ -0,0 +1,67 @@
> > +# SPDX-License-Identifier: GPL-2.0
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/power/domain-idle-state.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: PM Domain Idle States binding description
> > +
> > +maintainers:
> > +  - Ulf Hansson <ulf.hansson@linaro.org>
> > +
> > +description:
> > +  A domain idle state node represents the state parameters that will be used to
> > +  select the state when there are no active components in the PM domain.
> > +
> > +properties:
> > +  $nodename:
> > +    const: domain-idle-states
> > +
> > +patternProperties:
> > +  "^(cpu|cluster|domain)-":
> > +    type: object
> > +    description:
> > +      Each state node represents a domain idle state description.
> > +
> > +    properties:
> > +      compatible:
> > +        const: domain-idle-state
> > +
> > +      entry-latency-us:
> > +        $ref: /schemas/types.yaml#/definitions/uint32
>
> You don't need a type because the core schema defines it for all
> standard units.

Okay, I noticed some skips this, but wanted rather to clear and fuzzy.

In any case, yes, let's remove it.

>
> > +        description:
> > +          The worst case latency in microseconds required to enter the idle
> > +          state. Note that, the exit-latency-us duration may be guaranteed only
> > +          after the entry-latency-us has passed.
> > +
> > +      exit-latency-us:
> > +        $ref: /schemas/types.yaml#/definitions/uint32
> > +        description:
> > +          The worst case latency in microseconds required to exit the idle
> > +          state.
> > +
> > +      min-residency-us:
> > +        $ref: /schemas/types.yaml#/definitions/uint32
> > +        description:
> > +          The minimum residency duration in microseconds after which the idle
> > +          state will yield power benefits, after overcoming the overhead while
> > +          entering the idle state.
> > +
> > +    required:
> > +      - compatible
> > +      - entry-latency-us
> > +      - exit-latency-us
> > +      - min-residency-us
>
>        additionalProperties: false
>
> Do we have cases of adding additional properties?

I might, but I am not sure what's the correct way to deal with that.

What I am wondering about is the "arm,psci-suspend-param" property,
currently defined as part of the PSCI bindings (psci.yaml).

I am not sure that's correct to define it as a PSCI binding. Shouldn't
it rather be a part of the idle state bindings (idle-states.yaml) and
the domain idle states binding ($subject patch)?

What do you think?

In any case, we probably want to fix this on top, if we should care.

>
> I can fix these up when applying.

Thanks a lot!

Kind regards
Uffe
Rob Herring March 4, 2020, 2:48 p.m. UTC | #3
On Tue,  3 Mar 2020 16:07:45 +0100, Ulf Hansson wrote:
> While converting to the json-schema, let's also take the opportunity to
> further specify/clarify some more details about the DT binding.
> 
> For example, let's define the label where to put the states nodes, set a
> pattern for nodename of the state nodes and finally add an example.
> 
> Fixes: a3f048b5424e ("dt: psci: Update DT bindings to support hierarchical PSCI states")
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> ---
>  .../devicetree/bindings/arm/psci.yaml         |  2 +-
>  .../bindings/power/domain-idle-state.txt      | 33 ---------
>  .../bindings/power/domain-idle-state.yaml     | 67 +++++++++++++++++++
>  .../bindings/power/power-domain.yaml          | 22 +++---
>  .../bindings/power/power_domain.txt           |  2 +-
>  5 files changed, 79 insertions(+), 47 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/power/domain-idle-state.txt
>  create mode 100644 Documentation/devicetree/bindings/power/domain-idle-state.yaml
> 

Applied, thanks.

Rob
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/arm/psci.yaml b/Documentation/devicetree/bindings/arm/psci.yaml
index 540211a080d4..0bc3c43a525a 100644
--- a/Documentation/devicetree/bindings/arm/psci.yaml
+++ b/Documentation/devicetree/bindings/arm/psci.yaml
@@ -123,7 +123,7 @@  properties:
       to mandate it.
 
       [3] Documentation/devicetree/bindings/power/power_domain.txt
-      [4] Documentation/devicetree/bindings/power/domain-idle-state.txt
+      [4] Documentation/devicetree/bindings/power/domain-idle-state.yaml
 
   power-domains:
     $ref: '/schemas/types.yaml#/definitions/phandle-array'
diff --git a/Documentation/devicetree/bindings/power/domain-idle-state.txt b/Documentation/devicetree/bindings/power/domain-idle-state.txt
deleted file mode 100644
index eefc7ed22ca2..000000000000
--- a/Documentation/devicetree/bindings/power/domain-idle-state.txt
+++ /dev/null
@@ -1,33 +0,0 @@ 
-PM Domain Idle State Node:
-
-A domain idle state node represents the state parameters that will be used to
-select the state when there are no active components in the domain.
-
-The state node has the following parameters -
-
-- compatible:
-	Usage: Required
-	Value type: <string>
-	Definition: Must be "domain-idle-state".
-
-- entry-latency-us
-	Usage: Required
-	Value type: <prop-encoded-array>
-	Definition: u32 value representing worst case latency in
-		    microseconds required to enter the idle state.
-		    The exit-latency-us duration may be guaranteed
-		    only after entry-latency-us has passed.
-
-- exit-latency-us
-	Usage: Required
-	Value type: <prop-encoded-array>
-	Definition: u32 value representing worst case latency
-		    in microseconds required to exit the idle state.
-
-- min-residency-us
-	Usage: Required
-	Value type: <prop-encoded-array>
-	Definition: u32 value representing minimum residency duration
-		    in microseconds after which the idle state will yield
-		    power benefits after overcoming the overhead in entering
-i		    the idle state.
diff --git a/Documentation/devicetree/bindings/power/domain-idle-state.yaml b/Documentation/devicetree/bindings/power/domain-idle-state.yaml
new file mode 100644
index 000000000000..27da43076b85
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/domain-idle-state.yaml
@@ -0,0 +1,67 @@ 
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/domain-idle-state.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: PM Domain Idle States binding description
+
+maintainers:
+  - Ulf Hansson <ulf.hansson@linaro.org>
+
+description:
+  A domain idle state node represents the state parameters that will be used to
+  select the state when there are no active components in the PM domain.
+
+properties:
+  $nodename:
+    const: domain-idle-states
+
+patternProperties:
+  "^(cpu|cluster|domain)-":
+    type: object
+    description:
+      Each state node represents a domain idle state description.
+
+    properties:
+      compatible:
+        const: domain-idle-state
+
+      entry-latency-us:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        description:
+          The worst case latency in microseconds required to enter the idle
+          state. Note that, the exit-latency-us duration may be guaranteed only
+          after the entry-latency-us has passed.
+
+      exit-latency-us:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        description:
+          The worst case latency in microseconds required to exit the idle
+          state.
+
+      min-residency-us:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        description:
+          The minimum residency duration in microseconds after which the idle
+          state will yield power benefits, after overcoming the overhead while
+          entering the idle state.
+
+    required:
+      - compatible
+      - entry-latency-us
+      - exit-latency-us
+      - min-residency-us
+
+examples:
+  - |
+
+    domain-idle-states {
+      domain_retention: domain-retention {
+        compatible = "domain-idle-state";
+        entry-latency-us = <20>;
+        exit-latency-us = <40>;
+        min-residency-us = <80>;
+      };
+    };
+...
diff --git a/Documentation/devicetree/bindings/power/power-domain.yaml b/Documentation/devicetree/bindings/power/power-domain.yaml
index 455b573293ae..207e63ae10f9 100644
--- a/Documentation/devicetree/bindings/power/power-domain.yaml
+++ b/Documentation/devicetree/bindings/power/power-domain.yaml
@@ -29,18 +29,16 @@  properties:
 
   domain-idle-states:
     $ref: /schemas/types.yaml#/definitions/phandle-array
-    description:
-      A phandle of an idle-state that shall be soaked into a generic domain
-      power state. The idle state definitions are compatible with
-      domain-idle-state specified in
-      Documentation/devicetree/bindings/power/domain-idle-state.txt
-      phandles that are not compatible with domain-idle-state will be ignored.
-      The domain-idle-state property reflects the idle state of this PM domain
-      and not the idle states of the devices or sub-domains in the PM domain.
-      Devices and sub-domains have their own idle-states independent
-      of the parent domain's idle states. In the absence of this property,
-      the domain would be considered as capable of being powered-on
-      or powered-off.
+    description: |
+      Phandles of idle states that defines the available states for the
+      power-domain provider. The idle state definitions are compatible with the
+      domain-idle-state bindings, specified in ./domain-idle-state.yaml.
+
+      Note that, the domain-idle-state property reflects the idle states of this
+      PM domain and not the idle states of the devices or sub-domains in the PM
+      domain. Devices and sub-domains have their own idle states independent of
+      the parent domain's idle states. In the absence of this property, the
+      domain would be considered as capable of being powered-on or powered-off.
 
   operating-points-v2:
     $ref: /schemas/types.yaml#/definitions/phandle-array
diff --git a/Documentation/devicetree/bindings/power/power_domain.txt b/Documentation/devicetree/bindings/power/power_domain.txt
index 5b09b2deb483..08497ef26c7a 100644
--- a/Documentation/devicetree/bindings/power/power_domain.txt
+++ b/Documentation/devicetree/bindings/power/power_domain.txt
@@ -109,4 +109,4 @@  Example:
 		required-opps = <&domain1_opp_1>;
 	};
 
-[1]. Documentation/devicetree/bindings/power/domain-idle-state.txt
+[1]. Documentation/devicetree/bindings/power/domain-idle-state.yaml