diff mbox series

[V8,2/3] OPP: Introduce "required-opp" property

Message ID 6615035f294a64a4c17e5b44ac6690d1c2ac127c.1513591822.git.viresh.kumar@linaro.org
State Not Applicable, archived
Headers show
Series OPP: Allow OPP table to be used for power-domains | expand

Commit Message

Viresh Kumar Dec. 18, 2017, 10:21 a.m. UTC
Devices have inter-dependencies some times. For example a device that
needs to run at 800 MHz, needs another device (e.g. Its power domain) to
be configured at a particular operating performance point.

This patch introduces a new property "required-opp" which can be present
directly in a device's node (if it doesn't need to change its OPPs), or
in device's OPP nodes. More details on the property can be seen in the
binding itself.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 Documentation/devicetree/bindings/opp/opp.txt      |  8 +++
 .../devicetree/bindings/power/power_domain.txt     | 59 ++++++++++++++++++++++
 2 files changed, 67 insertions(+)

Comments

Ulf Hansson Dec. 20, 2017, 8:23 a.m. UTC | #1
On 18 December 2017 at 11:21, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> Devices have inter-dependencies some times. For example a device that
> needs to run at 800 MHz, needs another device (e.g. Its power domain) to
> be configured at a particular operating performance point.
>
> This patch introduces a new property "required-opp" which can be present
> directly in a device's node (if it doesn't need to change its OPPs), or
> in device's OPP nodes. More details on the property can be seen in the
> binding itself.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
>  Documentation/devicetree/bindings/opp/opp.txt      |  8 +++
>  .../devicetree/bindings/power/power_domain.txt     | 59 ++++++++++++++++++++++
>  2 files changed, 67 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/opp/opp.txt b/Documentation/devicetree/bindings/opp/opp.txt
> index a3953a1bb1a1..4e4f30288c8b 100644
> --- a/Documentation/devicetree/bindings/opp/opp.txt
> +++ b/Documentation/devicetree/bindings/opp/opp.txt
> @@ -159,6 +159,14 @@ properties.
>
>  - status: Marks the node enabled/disabled.
>
> +- required-opp: This contains phandle to an OPP node in another device's OPP
> +  table. It may contain an array of phandles, where each phandle points to an
> +  OPP of a different device. It should not contain multiple phandles to the OPP
> +  nodes in the same OPP table. This specifies the minimum required OPP of the
> +  device(s), whose OPP's phandle is present in this property, for the
> +  functioning of the current device at the current OPP (where this property is
> +  present).
> +
>  Example 1: Single cluster Dual-core ARM cortex A9, switch DVFS states together.
>
>  / {
> diff --git a/Documentation/devicetree/bindings/power/power_domain.txt b/Documentation/devicetree/bindings/power/power_domain.txt
> index 61549840ab3b..f824763b202e 100644
> --- a/Documentation/devicetree/bindings/power/power_domain.txt
> +++ b/Documentation/devicetree/bindings/power/power_domain.txt
> @@ -126,4 +126,63 @@ The node above defines a typical PM domain consumer device, which is located
>  inside a PM domain with index 0 of a power controller represented by a node
>  with the label "power".
>
> +Optional properties:
> +- required-opp: This contains phandle to an OPP node in another device's OPP
> +  table. It may contain an array of phandles, where each phandle points to an
> +  OPP of a different device. It should not contain multiple phandles to the OPP
> +  nodes in the same OPP table. This specifies the minimum required OPP of the
> +  device(s), whose OPP's phandle is present in this property, for the
> +  functioning of the current device at the current OPP (where this property is
> +  present).
> +
> +Example:
> +- OPP table for domain provider that provides two domains.
> +
> +       domain0_opp_table: opp_table0 {
> +               compatible = "operating-points-v2";
> +
> +               domain0_opp_0: opp-1000000000 {
> +                       opp-hz = /bits/ 64 <1000000000>;
> +                       opp-microvolt = <975000 970000 985000>;
> +               };
> +               domain0_opp_1: opp-1100000000 {
> +                       opp-hz = /bits/ 64 <1100000000>;
> +                       opp-microvolt = <1000000 980000 1010000>;
> +               };
> +       };
> +
> +       domain1_opp_table: opp_table1 {
> +               compatible = "operating-points-v2";
> +
> +               domain1_opp_0: opp-1200000000 {
> +                       opp-hz = /bits/ 64 <1200000000>;
> +                       opp-microvolt = <975000 970000 985000>;
> +               };
> +               domain1_opp_1: opp-1300000000 {
> +                       opp-hz = /bits/ 64 <1300000000>;
> +                       opp-microvolt = <1000000 980000 1010000>;
> +               };
> +       };
> +
> +       parent: power-controller@12340000 {

Nitpick: Could you please change "parent" to "power", to be consistent
with earlier examples.

> +               compatible = "foo,power-controller";
> +               reg = <0x12340000 0x1000>;
> +               #power-domain-cells = <1>;
> +               operating-points-v2 = <&domain0_opp_table>, <&domain1_opp_table>;
> +       };
> +
> +       leaky-device0@12350000 {
> +               compatible = "foo,i-leak-current";
> +               reg = <0x12350000 0x1000>;
> +               power-domains = <&parent 0>;
> +               required-opp = <&domain0_opp_0>;
> +       };
> +
> +       leaky-device1@12350000 {
> +               compatible = "foo,i-leak-current";
> +               reg = <0x12350000 0x1000>;
> +               power-domains = <&parent 1>;
> +               required-opp = <&domain1_opp_1>;
> +       };
> +
>  [1]. Documentation/devicetree/bindings/power/domain-idle-state.txt
> --
> 2.15.0.194.g9af6a3dea062
>


Besides the nitpick, feel free to add:

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Viresh Kumar Dec. 20, 2017, 8:26 a.m. UTC | #2
On 20-12-17, 09:23, Ulf Hansson wrote:
> Nitpick: Could you please change "parent" to "power", to be consistent
> with earlier examples.

Sure. Thanks for the review.
Rob Herring (Arm) Dec. 21, 2017, 10:26 p.m. UTC | #3
On Mon, Dec 18, 2017 at 03:51:29PM +0530, Viresh Kumar wrote:
> Devices have inter-dependencies some times. For example a device that
> needs to run at 800 MHz, needs another device (e.g. Its power domain) to
> be configured at a particular operating performance point.
> 
> This patch introduces a new property "required-opp" which can be present
> directly in a device's node (if it doesn't need to change its OPPs), or
> in device's OPP nodes. More details on the property can be seen in the
> binding itself.
> 
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
>  Documentation/devicetree/bindings/opp/opp.txt      |  8 +++
>  .../devicetree/bindings/power/power_domain.txt     | 59 ++++++++++++++++++++++
>  2 files changed, 67 insertions(+)

A couple of nits, otherwise:

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

> 
> diff --git a/Documentation/devicetree/bindings/opp/opp.txt b/Documentation/devicetree/bindings/opp/opp.txt
> index a3953a1bb1a1..4e4f30288c8b 100644
> --- a/Documentation/devicetree/bindings/opp/opp.txt
> +++ b/Documentation/devicetree/bindings/opp/opp.txt
> @@ -159,6 +159,14 @@ properties.
>  
>  - status: Marks the node enabled/disabled.
>  
> +- required-opp: This contains phandle to an OPP node in another device's OPP
> +  table. It may contain an array of phandles, where each phandle points to an
> +  OPP of a different device. It should not contain multiple phandles to the OPP
> +  nodes in the same OPP table. This specifies the minimum required OPP of the
> +  device(s), whose OPP's phandle is present in this property, for the
> +  functioning of the current device at the current OPP (where this property is
> +  present).
> +
>  Example 1: Single cluster Dual-core ARM cortex A9, switch DVFS states together.
>  
>  / {
> diff --git a/Documentation/devicetree/bindings/power/power_domain.txt b/Documentation/devicetree/bindings/power/power_domain.txt
> index 61549840ab3b..f824763b202e 100644
> --- a/Documentation/devicetree/bindings/power/power_domain.txt
> +++ b/Documentation/devicetree/bindings/power/power_domain.txt
> @@ -126,4 +126,63 @@ The node above defines a typical PM domain consumer device, which is located
>  inside a PM domain with index 0 of a power controller represented by a node
>  with the label "power".
>  
> +Optional properties:
> +- required-opp: This contains phandle to an OPP node in another device's OPP
> +  table. It may contain an array of phandles, where each phandle points to an
> +  OPP of a different device. It should not contain multiple phandles to the OPP
> +  nodes in the same OPP table. This specifies the minimum required OPP of the
> +  device(s), whose OPP's phandle is present in this property, for the
> +  functioning of the current device at the current OPP (where this property is
> +  present).
> +
> +Example:
> +- OPP table for domain provider that provides two domains.
> +
> +	domain0_opp_table: opp_table0 {

opp-table0

> +		compatible = "operating-points-v2";
> +
> +		domain0_opp_0: opp-1000000000 {
> +			opp-hz = /bits/ 64 <1000000000>;
> +			opp-microvolt = <975000 970000 985000>;
> +		};
> +		domain0_opp_1: opp-1100000000 {
> +			opp-hz = /bits/ 64 <1100000000>;
> +			opp-microvolt = <1000000 980000 1010000>;
> +		};
> +	};
> +
> +	domain1_opp_table: opp_table1 {

opp-table1

> +		compatible = "operating-points-v2";
> +
> +		domain1_opp_0: opp-1200000000 {
> +			opp-hz = /bits/ 64 <1200000000>;
> +			opp-microvolt = <975000 970000 985000>;
> +		};
> +		domain1_opp_1: opp-1300000000 {
> +			opp-hz = /bits/ 64 <1300000000>;
> +			opp-microvolt = <1000000 980000 1010000>;
> +		};
> +	};
> +
> +	parent: power-controller@12340000 {
> +		compatible = "foo,power-controller";
> +		reg = <0x12340000 0x1000>;
> +		#power-domain-cells = <1>;
> +		operating-points-v2 = <&domain0_opp_table>, <&domain1_opp_table>;
> +	};
> +
> +	leaky-device0@12350000 {
> +		compatible = "foo,i-leak-current";
> +		reg = <0x12350000 0x1000>;
> +		power-domains = <&parent 0>;
> +		required-opp = <&domain0_opp_0>;
> +	};
> +
> +	leaky-device1@12350000 {
> +		compatible = "foo,i-leak-current";
> +		reg = <0x12350000 0x1000>;
> +		power-domains = <&parent 1>;
> +		required-opp = <&domain1_opp_1>;
> +	};
> +
>  [1]. Documentation/devicetree/bindings/power/domain-idle-state.txt
> -- 
> 2.15.0.194.g9af6a3dea062
> 
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Viresh Kumar Dec. 22, 2017, 5:28 a.m. UTC | #4
On 18-12-17, 15:51, Viresh Kumar wrote:
> Devices have inter-dependencies some times. For example a device that
> needs to run at 800 MHz, needs another device (e.g. Its power domain) to
> be configured at a particular operating performance point.
> 
> This patch introduces a new property "required-opp" which can be present
> directly in a device's node (if it doesn't need to change its OPPs), or
> in device's OPP nodes. More details on the property can be seen in the
> binding itself.

This is slightly updated based on Rob and Ulf's comments. Will apply it to the
OPP tree with below diff.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/opp/opp.txt b/Documentation/devicetree/bindings/opp/opp.txt
index a3953a1bb1a1..4e4f30288c8b 100644
--- a/Documentation/devicetree/bindings/opp/opp.txt
+++ b/Documentation/devicetree/bindings/opp/opp.txt
@@ -159,6 +159,14 @@  properties.
 
 - status: Marks the node enabled/disabled.
 
+- required-opp: This contains phandle to an OPP node in another device's OPP
+  table. It may contain an array of phandles, where each phandle points to an
+  OPP of a different device. It should not contain multiple phandles to the OPP
+  nodes in the same OPP table. This specifies the minimum required OPP of the
+  device(s), whose OPP's phandle is present in this property, for the
+  functioning of the current device at the current OPP (where this property is
+  present).
+
 Example 1: Single cluster Dual-core ARM cortex A9, switch DVFS states together.
 
 / {
diff --git a/Documentation/devicetree/bindings/power/power_domain.txt b/Documentation/devicetree/bindings/power/power_domain.txt
index 61549840ab3b..f824763b202e 100644
--- a/Documentation/devicetree/bindings/power/power_domain.txt
+++ b/Documentation/devicetree/bindings/power/power_domain.txt
@@ -126,4 +126,63 @@  The node above defines a typical PM domain consumer device, which is located
 inside a PM domain with index 0 of a power controller represented by a node
 with the label "power".
 
+Optional properties:
+- required-opp: This contains phandle to an OPP node in another device's OPP
+  table. It may contain an array of phandles, where each phandle points to an
+  OPP of a different device. It should not contain multiple phandles to the OPP
+  nodes in the same OPP table. This specifies the minimum required OPP of the
+  device(s), whose OPP's phandle is present in this property, for the
+  functioning of the current device at the current OPP (where this property is
+  present).
+
+Example:
+- OPP table for domain provider that provides two domains.
+
+	domain0_opp_table: opp_table0 {
+		compatible = "operating-points-v2";
+
+		domain0_opp_0: opp-1000000000 {
+			opp-hz = /bits/ 64 <1000000000>;
+			opp-microvolt = <975000 970000 985000>;
+		};
+		domain0_opp_1: opp-1100000000 {
+			opp-hz = /bits/ 64 <1100000000>;
+			opp-microvolt = <1000000 980000 1010000>;
+		};
+	};
+
+	domain1_opp_table: opp_table1 {
+		compatible = "operating-points-v2";
+
+		domain1_opp_0: opp-1200000000 {
+			opp-hz = /bits/ 64 <1200000000>;
+			opp-microvolt = <975000 970000 985000>;
+		};
+		domain1_opp_1: opp-1300000000 {
+			opp-hz = /bits/ 64 <1300000000>;
+			opp-microvolt = <1000000 980000 1010000>;
+		};
+	};
+
+	parent: power-controller@12340000 {
+		compatible = "foo,power-controller";
+		reg = <0x12340000 0x1000>;
+		#power-domain-cells = <1>;
+		operating-points-v2 = <&domain0_opp_table>, <&domain1_opp_table>;
+	};
+
+	leaky-device0@12350000 {
+		compatible = "foo,i-leak-current";
+		reg = <0x12350000 0x1000>;
+		power-domains = <&parent 0>;
+		required-opp = <&domain0_opp_0>;
+	};
+
+	leaky-device1@12350000 {
+		compatible = "foo,i-leak-current";
+		reg = <0x12350000 0x1000>;
+		power-domains = <&parent 1>;
+		required-opp = <&domain1_opp_1>;
+	};
+
 [1]. Documentation/devicetree/bindings/power/domain-idle-state.txt