diff mbox

[V2,2/5] PM / OPP: Add {opp-microvolt|opp-microamp|turbo-mode|opp-suspend}-<name> binding

Message ID 17a4388be606f21fe1d31b23180d41f6cabdd4b5.1446687367.git.viresh.kumar@linaro.org
State Changes Requested, archived
Headers show

Commit Message

Viresh Kumar Nov. 5, 2015, 1:41 a.m. UTC
Depending on the version of hardware or its properties, which are only
known at runtime, various properties of the OPP can change. For example,
an OPP with frequency 1.2 GHz, may have different voltage/current
requirements based on the version of the hardware it is running on.
Similarly, it may or may not be a turbo or suspend OPP on those
circumstances.

In order to not replicate the same OPP tables for varying values of all
such fields, this commit introduces the concept of opp-property-<name>.
The <name> can be chosen by the platform at runtime, and OPPs will be
initialized depending on that name string. Currently support is extended
for the following properties:
- opp-microvolt-<name>
- opp-microamp-<name>
- turbo-mode-<name>
- opp-suspend-<name>

If the name string isn't provided by the platform, or if it is provided
but doesn't match the properties present in the OPP node, we will fall
back to the original properties without the -<name> string, if they are
available.

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

Comments

Rob Herring (Arm) Nov. 5, 2015, 3:02 a.m. UTC | #1
On Thu, Nov 05, 2015 at 07:11:53AM +0530, Viresh Kumar wrote:
> Depending on the version of hardware or its properties, which are only
> known at runtime, various properties of the OPP can change. For example,
> an OPP with frequency 1.2 GHz, may have different voltage/current
> requirements based on the version of the hardware it is running on.
> Similarly, it may or may not be a turbo or suspend OPP on those
> circumstances.
> 
> In order to not replicate the same OPP tables for varying values of all
> such fields, this commit introduces the concept of opp-property-<name>.
> The <name> can be chosen by the platform at runtime, and OPPs will be
> initialized depending on that name string. Currently support is extended
> for the following properties:
> - opp-microvolt-<name>
> - opp-microamp-<name>
> - turbo-mode-<name>
> - opp-suspend-<name>
> 
> If the name string isn't provided by the platform, or if it is provided
> but doesn't match the properties present in the OPP node, we will fall
> back to the original properties without the -<name> string, if they are
> available.
> 
> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
>  Documentation/devicetree/bindings/opp/opp.txt | 58 +++++++++++++++++++++++++++
>  1 file changed, 58 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/opp/opp.txt b/Documentation/devicetree/bindings/opp/opp.txt
> index d072fa0ffbd4..61c6f25cf8e2 100644
> --- a/Documentation/devicetree/bindings/opp/opp.txt
> +++ b/Documentation/devicetree/bindings/opp/opp.txt
> @@ -100,6 +100,14 @@ properties.
>    Entries for multiple regulators must be present in the same order as
>    regulators are specified in device's DT node.
>  
> +- opp-microvolt-<name>: Named opp-microvolt property. This is exactly similar to
> +  the above opp-microvolt property, but allows multiple voltage ranges to be
> +  provided for the same OPP. At runtime, the platform can pick a <name> and
> +  matching opp-microvolt-<name> property will be enabled for all OPPs. If the
> +  platform doesn't pick a specific <name> or the <name> doesn't match with any
> +  opp-microvolt-<name> properties, then opp-microvolt property shall be used, if
> +  present.
> +
>  - opp-microamp: 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
> @@ -112,6 +120,9 @@ properties.
>    for few regulators, then this should be marked as zero for them. If it isn't
>    required for any regulator, then this property need not be present.
>  
> +- opp-microamp-<name>: Named opp-microamp property. Similar to
> +  opp-microvolt-<name> property, but for microamp instead.
> +
>  - clock-latency-ns: Specifies the maximum possible transition latency (in
>    nanoseconds) for switching to this OPP from any other OPP.
>  
> @@ -120,9 +131,15 @@ properties.
>    frequency for a short duration of time limited by the device's power, current
>    and thermal limits.
>  
> +- turbo-mode-<name>: Named turbo-mode property. Similar to opp-microvolt-<name>
> +  property, but for turbo mode instead.
> +
>  - opp-suspend: Marks the OPP to be used during device suspend. Only one OPP in
>    the table should have this.
>  
> +- opp-suspend-<name>: Named opp-suspend property. Similar to
> +  opp-microvolt-<name> property, but for suspend opp instead.
> +

I don't think these last 2 make sense. turbo-mode is a flag that the 
mode has restrictions such as other cores have to be idle or something. 
Similarly, opp-suspend should not vary by <name>.

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. 5, 2015, 3:19 a.m. UTC | #2
On 04-11-15, 21:02, Rob Herring wrote:
> > +- turbo-mode-<name>: Named turbo-mode property. Similar to opp-microvolt-<name>
> > +  property, but for turbo mode instead.
> > +
> >  - opp-suspend: Marks the OPP to be used during device suspend. Only one OPP in
> >    the table should have this.
> >  
> > +- opp-suspend-<name>: Named opp-suspend property. Similar to
> > +  opp-microvolt-<name> property, but for suspend opp instead.
> > +
> 
> I don't think these last 2 make sense. turbo-mode is a flag that the 
> mode has restrictions such as other cores have to be idle or something. 
> Similarly, opp-suspend should not vary by <name>.

Based on what version of the hardware you are running, via
opp-supported-hw property, the platform can enable a different set of
OPPs. And in that case we may want to select different OPPs marked as
turbo or suspend freq. That's what I thought at least.

For example, on version A of the hardware we have following available
frequencies: 800, 1000, 1100, 1200 MHz. Where 800 MHz is the suspend
freq and 1200 is the turbo one.

But on a slightly different version of hardware B, we have two more
OPPs available: 700 and 1400 MHz. And in that case we want the suspend
freq to be 700 and turbo OPP to be only 1400 MHz.
Rob Herring (Arm) Nov. 5, 2015, 11:33 p.m. UTC | #3
On Wed, Nov 4, 2015 at 9:19 PM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> On 04-11-15, 21:02, Rob Herring wrote:
>> > +- turbo-mode-<name>: Named turbo-mode property. Similar to opp-microvolt-<name>
>> > +  property, but for turbo mode instead.
>> > +
>> >  - opp-suspend: Marks the OPP to be used during device suspend. Only one OPP in
>> >    the table should have this.
>> >
>> > +- opp-suspend-<name>: Named opp-suspend property. Similar to
>> > +  opp-microvolt-<name> property, but for suspend opp instead.
>> > +
>>
>> I don't think these last 2 make sense. turbo-mode is a flag that the
>> mode has restrictions such as other cores have to be idle or something.
>> Similarly, opp-suspend should not vary by <name>.
>
> Based on what version of the hardware you are running, via
> opp-supported-hw property, the platform can enable a different set of
> OPPs. And in that case we may want to select different OPPs marked as
> turbo or suspend freq. That's what I thought at least.
>
> For example, on version A of the hardware we have following available
> frequencies: 800, 1000, 1100, 1200 MHz. Where 800 MHz is the suspend
> freq and 1200 is the turbo one.
>
> But on a slightly different version of hardware B, we have two more
> OPPs available: 700 and 1400 MHz. And in that case we want the suspend
> freq to be 700 and turbo OPP to be only 1400 MHz.

But different frequencies are different OPP nodes (since that is the
unit address now), so it is not going to hurt to set turbo-mode on
both 1200 and 1400.

Rob

>
> --
> viresh
--
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. 6, 2015, 1:53 a.m. UTC | #4
On 05-11-15, 17:33, Rob Herring wrote:
> On Wed, Nov 4, 2015 at 9:19 PM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> > On 04-11-15, 21:02, Rob Herring wrote:
> >> > +- turbo-mode-<name>: Named turbo-mode property. Similar to opp-microvolt-<name>
> >> > +  property, but for turbo mode instead.
> >> > +
> >> >  - opp-suspend: Marks the OPP to be used during device suspend. Only one OPP in
> >> >    the table should have this.
> >> >
> >> > +- opp-suspend-<name>: Named opp-suspend property. Similar to
> >> > +  opp-microvolt-<name> property, but for suspend opp instead.
> >> > +
> >>
> >> I don't think these last 2 make sense. turbo-mode is a flag that the
> >> mode has restrictions such as other cores have to be idle or something.
> >> Similarly, opp-suspend should not vary by <name>.
> >
> > Based on what version of the hardware you are running, via
> > opp-supported-hw property, the platform can enable a different set of
> > OPPs. And in that case we may want to select different OPPs marked as
> > turbo or suspend freq. That's what I thought at least.
> >
> > For example, on version A of the hardware we have following available
> > frequencies: 800, 1000, 1100, 1200 MHz. Where 800 MHz is the suspend
> > freq and 1200 is the turbo one.
> >
> > But on a slightly different version of hardware B, we have two more
> > OPPs available: 700 and 1400 MHz. And in that case we want the suspend
> > freq to be 700 and turbo OPP to be only 1400 MHz.
> 
> But different frequencies are different OPP nodes (since that is the
> unit address now), so it is not going to hurt to set turbo-mode on
> both 1200 and 1400.

Yeah, but in that case 1200 *may* not be a turbo frequency anymore, as
the voltage constraints might have changed.

So turbo frequency is something that should be used only in small
bursts, as they are consume lot of power. They aren't available to be
used freely. They may also have thermal side effects..

In a similar way, for suspend-freq, we may or may not want the lowest
frequency to be used during suspend and so that can change as well.
And we shouldn't have suspend-freq set for two OPP nodes.
Viresh Kumar Nov. 10, 2015, 2:55 p.m. UTC | #5
On 06-11-15, 07:23, Viresh Kumar wrote:
> Yeah, but in that case 1200 *may* not be a turbo frequency anymore, as
> the voltage constraints might have changed.
> 
> So turbo frequency is something that should be used only in small
> bursts, as they are consume lot of power. They aren't available to be
> used freely. They may also have thermal side effects..
> 
> In a similar way, for suspend-freq, we may or may not want the lowest
> frequency to be used during suspend and so that can change as well.
> And we shouldn't have suspend-freq set for two OPP nodes.

@Rob: Does my comments make any sense now? Or you still think we are
doing something wrong here?
Rob Herring (Arm) Nov. 10, 2015, 3:37 p.m. UTC | #6
On Tue, Nov 10, 2015 at 8:55 AM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> On 06-11-15, 07:23, Viresh Kumar wrote:
>> Yeah, but in that case 1200 *may* not be a turbo frequency anymore, as
>> the voltage constraints might have changed.
>>
>> So turbo frequency is something that should be used only in small
>> bursts, as they are consume lot of power. They aren't available to be
>> used freely. They may also have thermal side effects..
>>
>> In a similar way, for suspend-freq, we may or may not want the lowest
>> frequency to be used during suspend and so that can change as well.
>> And we shouldn't have suspend-freq set for two OPP nodes.
>
> @Rob: Does my comments make any sense now? Or you still think we are
> doing something wrong here?

What you said could be possible, but I'm still doubtful. I would drop
these until you have an actual user.

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
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/opp/opp.txt b/Documentation/devicetree/bindings/opp/opp.txt
index d072fa0ffbd4..61c6f25cf8e2 100644
--- a/Documentation/devicetree/bindings/opp/opp.txt
+++ b/Documentation/devicetree/bindings/opp/opp.txt
@@ -100,6 +100,14 @@  properties.
   Entries for multiple regulators must be present in the same order as
   regulators are specified in device's DT node.
 
+- opp-microvolt-<name>: Named opp-microvolt property. This is exactly similar to
+  the above opp-microvolt property, but allows multiple voltage ranges to be
+  provided for the same OPP. At runtime, the platform can pick a <name> and
+  matching opp-microvolt-<name> property will be enabled for all OPPs. If the
+  platform doesn't pick a specific <name> or the <name> doesn't match with any
+  opp-microvolt-<name> properties, then opp-microvolt property shall be used, if
+  present.
+
 - opp-microamp: 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
@@ -112,6 +120,9 @@  properties.
   for few regulators, then this should be marked as zero for them. If it isn't
   required for any regulator, then this property need not be present.
 
+- opp-microamp-<name>: Named opp-microamp property. Similar to
+  opp-microvolt-<name> property, but for microamp instead.
+
 - clock-latency-ns: Specifies the maximum possible transition latency (in
   nanoseconds) for switching to this OPP from any other OPP.
 
@@ -120,9 +131,15 @@  properties.
   frequency for a short duration of time limited by the device's power, current
   and thermal limits.
 
+- turbo-mode-<name>: Named turbo-mode property. Similar to opp-microvolt-<name>
+  property, but for turbo mode instead.
+
 - opp-suspend: Marks the OPP to be used during device suspend. Only one OPP in
   the table should have this.
 
+- opp-suspend-<name>: Named opp-suspend property. Similar to
+  opp-microvolt-<name> property, but for suspend opp instead.
+
 - opp-supported-hw: This enables us to select only a subset of OPPs from the
   larger OPP table, based on what version of the hardware we are running on. We
   still can't have multiple nodes with the same opp-hz value in OPP table.
@@ -528,3 +545,44 @@  Example 6: opp-supported-hw
 		};
 	};
 };
+
+Example 7: opp-microvolt-<name>, opp-microamp-<name>, turbo-mode-<name>,
+opp-suspend-<name>:
+(example: device with two possible microvolt ranges: slow and fast)
+
+/ {
+	cpus {
+		cpu@0 {
+			compatible = "arm,cortex-a7";
+			...
+
+			operating-points-v2 = <&cpu0_opp_table>;
+		};
+	};
+
+	cpu0_opp_table: opp_table0 {
+		compatible = "operating-points-v2";
+		opp-shared;
+
+		opp00 {
+			opp-hz = /bits/ 64 <1000000000>;
+			opp-microvolt-slow = <900000 915000 925000>;
+			opp-microvolt-fast = <970000 975000 985000>;
+			opp-microamp-slow =  <70000>;
+			opp-microamp-fast =  <71000>;
+			turbo-mode-slow; /* Will be used as turbo only if 'slow' is chosen */
+			opp-suspend-slow; /* Will be used as suspend-opp only if 'slow' is chosen */
+		};
+
+		opp01 {
+			opp-hz = /bits/ 64 <1200000000>;
+			opp-microvolt-slow = <900000 915000 925000>, /* Supply vcc0 */
+					      <910000 925000 935000>; /* Supply vcc1 */
+			opp-microvolt-fast = <970000 975000 985000>, /* Supply vcc0 */
+					     <960000 965000 975000>; /* Supply vcc1 */
+			opp-microamp =  <70000>; /* Will be used for both slow/fast */
+			turbo-mode; /* Always used as turbo */
+			opp-suspend-fast; /* Will be used as suspend opp only if 'fast' is chosen */
+		};
+	};
+};