diff mbox

[1/3] PM / OPP: Add "opp-supported-hw" binding

Message ID 2d52388bd7d3cc546ac3ab5afeb47bfcb3012213.1446167359.git.viresh.kumar@linaro.org
State Superseded, archived
Headers show

Commit Message

Viresh Kumar Oct. 30, 2015, 1:25 a.m. UTC
We may want to enable only a subset of OPPs, from the bigger list of
OPPs, based on what version of the hardware we are running on. This
would enable us to not duplicate OPP tables for every version of the
hardware we support.

To enable that, this patch defines a new property 'opp-supported-hw'. It
can support any number of hierarchy levels of the versions the hardware
follows. And based on the selected hardware versions, we can pick only
the relevant OPPs at runtime.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 Documentation/devicetree/bindings/opp/opp.txt | 57 +++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

Comments

Stephen Boyd Oct. 30, 2015, 9:49 p.m. UTC | #1
On 10/30, Viresh Kumar wrote:
> +- opp-supported-hw: User defined array containing a hierarchy of hardware
> +  version numbers, supported by the OPP. For example: a platform with hierarchy
> +  of three levels of versions (A, B and C), this field should be like <X Y Z>,
> +  where X corresponds to Version hierarchy A, Y corresponds to version hierarchy
> +  B and Z corresponds to version hierarchy C.
> +
> +  Each level of hierarchy is represented by a 32 bit value, and so there can be
> +  only 32 different supported version per hierarchy. i.e. 1 bit per version. A
> +  value of 0xFFFFFFFF will enable the OPP for all versions for that hierarchy
> +  level. And a value of 0x00000000 will disable the OPP completely, and so we
> +  never want that to happen.

I suppose if you wanted to have 64 possible combinations of some
attribute you would just extend it to two 32 bit numbers in
sequence? I don't see the limitation here, and hopefully there
isn't a limitation so that we can specify sufficiently large
numbers with more bits if we need to.
Stephen Boyd Oct. 30, 2015, 10:18 p.m. UTC | #2
On 10/30, Viresh Kumar wrote:
> +	opp_table {
> +		compatible = "operating-points-v2";
> +		status = "okay";
> +		opp-shared;
> +
> +		opp00 {

A side-note. I wonder if it would be better style to have the
node name be:

		opp@600000000 {

At least it seems that the assumption is we can store all the
possible combinations of OPP values for a particular frequency in
the same node. Following this style would make dt compilation
fail if two nodes have the same frequency.

Also, this makes it sound like opp-supported-hw is really just
telling us if this is a supported frequency or not for the
particular device we're running on. The current wording makes it
sound like we could have two OPP nodes with the same frequency
but different voltages inside them, which we're trying to
discourage by compressing the tables into less nodes.

I think in Lee's case we're only going to use the cuts parameter
to figure out if the OPP is supported or not. On qcom platforms
we will only use one parameter for this property as well, the
speed bin. The slow/fast and version stuff will be handled by
named opp properties.

> +			/*
> +			 * Supports all substrate and process versions for 0xF
> +			 * cuts, i.e. only first four cuts.
> +			 */
> +			opp-supported-hw = <0xF 0xFFFFFFFF 0xFFFFFFFF>
> +			opp-hz = /bits/ 64 <600000000>;
> +			opp-microvolt = <900000 915000 925000>;
Viresh Kumar Oct. 31, 2015, 2:16 a.m. UTC | #3
On 30-10-15, 14:49, Stephen Boyd wrote:
> I suppose if you wanted to have 64 possible combinations of some
> attribute you would just extend it to two 32 bit numbers in
> sequence? I don't see the limitation here, and hopefully there
> isn't a limitation so that we can specify sufficiently large
> numbers with more bits if we need to.

Yeah, we discussed this earlier when Lee had the same query and I
suggested the exact same thing to him then.
Viresh Kumar Oct. 31, 2015, 2:20 a.m. UTC | #4
On 30-10-15, 15:18, Stephen Boyd wrote:
> A side-note. I wonder if it would be better style to have the
> node name be:
> 
> 		opp@600000000 {

I thought the @... had a special meaning and we might end up creating
some device for the node then? Perhaps I am mistaken.

But then, yeah it will make it more readable as you mentioned.

> At least it seems that the assumption is we can store all the
> possible combinations of OPP values for a particular frequency in
> the same node. Following this style would make dt compilation
> fail if two nodes have the same frequency.

Right.

> Also, this makes it sound like opp-supported-hw is really just
> telling us if this is a supported frequency or not for the
> particular device we're running on.

That's right.

> The current wording makes it

Of the commit log ? Or the way the nodes are written?

> sound like we could have two OPP nodes with the same frequency
> but different voltages inside them, which we're trying to
> discourage by compressing the tables into less nodes.

No no, we can't have two nodes with same frequency.
Rob Herring Nov. 2, 2015, 3:13 p.m. UTC | #5
On Fri, Oct 30, 2015 at 9:20 PM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> On 30-10-15, 15:18, Stephen Boyd wrote:
>> A side-note. I wonder if it would be better style to have the
>> node name be:
>>
>>               opp@600000000 {
>
> I thought the @... had a special meaning and we might end up creating
> some device for the node then? Perhaps I am mistaken.

There is no special meaning, just convention which is the unit-address
should match the reg property address. I'm okay with an exception
here.

Rob
--
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 Nov. 2, 2015, 4:07 p.m. UTC | #6
On 30-10-15, 14:49, Stephen Boyd wrote:
> I suppose if you wanted to have 64 possible combinations of some
> attribute you would just extend it to two 32 bit numbers in
> sequence? I don't see the limitation here, and hopefully there
> isn't a limitation so that we can specify sufficiently large
> numbers with more bits if we need to.

I hope you want to mark this patch with your reviewed-by tag?
Viresh Kumar Nov. 2, 2015, 4:08 p.m. UTC | #7
On 02-11-15, 09:13, Rob Herring wrote:
> There is no special meaning, just convention which is the unit-address
> should match the reg property address. I'm okay with an exception
> here.

Thanks, I will update this separately.
Stephen Boyd Nov. 2, 2015, 7:20 p.m. UTC | #8
On 10/31, Viresh Kumar wrote:
> On 30-10-15, 15:18, Stephen Boyd wrote:
> 
> > Also, this makes it sound like opp-supported-hw is really just
> > telling us if this is a supported frequency or not for the
> > particular device we're running on.
> 
> That's right.
> 
> > The current wording makes it
> 
> Of the commit log ? Or the way the nodes are written?

The way the documentation is written.
Stephen Boyd Nov. 2, 2015, 7:21 p.m. UTC | #9
On 10/31, Viresh Kumar wrote:
> On 30-10-15, 14:49, Stephen Boyd wrote:
> > I suppose if you wanted to have 64 possible combinations of some
> > attribute you would just extend it to two 32 bit numbers in
> > sequence? I don't see the limitation here, and hopefully there
> > isn't a limitation so that we can specify sufficiently large
> > numbers with more bits if we need to.
> 
> Yeah, we discussed this earlier when Lee had the same query and I
> suggested the exact same thing to him then.
> 

Ah I see that after looking at the previous thread. Perhaps we
can add such information into the documentation so that people
aren't misled into thinking they're limited to 32 bits?
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/opp/opp.txt b/Documentation/devicetree/bindings/opp/opp.txt
index 0cb44dc21f97..96892057586a 100644
--- a/Documentation/devicetree/bindings/opp/opp.txt
+++ b/Documentation/devicetree/bindings/opp/opp.txt
@@ -123,6 +123,18 @@  properties.
 - opp-suspend: Marks the OPP to be used during device suspend. Only one OPP in
   the table should have this.
 
+- opp-supported-hw: User defined array containing a hierarchy of hardware
+  version numbers, supported by the OPP. For example: a platform with hierarchy
+  of three levels of versions (A, B and C), this field should be like <X Y Z>,
+  where X corresponds to Version hierarchy A, Y corresponds to version hierarchy
+  B and Z corresponds to version hierarchy C.
+
+  Each level of hierarchy is represented by a 32 bit value, and so there can be
+  only 32 different supported version per hierarchy. i.e. 1 bit per version. A
+  value of 0xFFFFFFFF will enable the OPP for all versions for that hierarchy
+  level. And a value of 0x00000000 will disable the OPP completely, and so we
+  never want that to happen.
+
 - status: Marks the node enabled/disabled.
 
 Example 1: Single cluster Dual-core ARM cortex A9, switch DVFS states together.
@@ -463,3 +475,48 @@  Example 5: Multiple OPP tables
 		};
 	};
 };
+
+Example 6: opp-supported-hw
+(example: three level hierarchy of versions: cuts, substrate and process)
+
+/ {
+	cpus {
+		cpu@0 {
+			compatible = "arm,cortex-a7";
+			...
+
+			cpu-supply = <&cpu_supply>
+			operating-points-v2 = <&cpu0_opp_table_slow>;
+		};
+	};
+
+	opp_table {
+		compatible = "operating-points-v2";
+		status = "okay";
+		opp-shared;
+
+		opp00 {
+			/*
+			 * Supports all substrate and process versions for 0xF
+			 * cuts, i.e. only first four cuts.
+			 */
+			opp-supported-hw = <0xF 0xFFFFFFFF 0xFFFFFFFF>
+			opp-hz = /bits/ 64 <600000000>;
+			opp-microvolt = <900000 915000 925000>;
+			...
+		};
+
+		opp01 {
+			/*
+			 * Supports:
+			 * - cuts: only one, 6th cut (represented by 6th bit).
+			 * - substrate: supports 16 different substrate versions
+			 * - process: supports 9 different process versions
+			 */
+			opp-supported-hw = <0x20 0xff0000ff 0x0000f4f0>
+			opp-hz = /bits/ 64 <800000000>;
+			opp-microvolt = <900000 915000 925000>;
+			...
+		};
+	};
+};