Hi all,
This patch set solves a few issues:
1. It allows to register EM from DT, when the voltage information is not
available. (Some background of the issues present on Chromebook devices
can be checked at [1].)
2. It allows to register 'advanced' EM from the DT, which is more accurate
and reflects total power (dynamic + static).
Implementation details:
Existing machinery in the OPP framework now handles "opp-microwatt", similarly
to "opp-microamp". It also has helper exported function to get power from OPP.
For the EM, it adds a new callback in OPP framework to use this new API and
read power while having an opp pointer. It's agreed to work with OPP-v2.
Comments, suggestions are very welcome.
changelog:
v5:
- added dual-macro to conditionally setup needed callback and compile
on !EM kernel gently
- removed 'advanced' word from OPP patch header description
v4 [2]
Regards,
Lukasz Luba
[1] https://lore.kernel.org/linux-pm/[email protected]/
[2] https://lore.kernel.org/linux-pm/[email protected]/
Lukasz Luba (5):
dt-bindings: opp: Add "opp-microwatt" entry in the OPP
OPP: Add "opp-microwatt" supporting code
PM: EM: add macro to set .active_power() callback conditionally
OPP: Add support of "opp-microwatt" for EM registration
Documentation: EM: Describe new registration method using DT
.../devicetree/bindings/opp/opp-v2-base.yaml | 23 ++++
Documentation/power/energy-model.rst | 10 ++
drivers/opp/core.c | 25 ++++
drivers/opp/debugfs.c | 3 +
drivers/opp/of.c | 108 +++++++++++++++++-
include/linux/energy_model.h | 2 +
include/linux/pm_opp.h | 12 +-
7 files changed, 179 insertions(+), 4 deletions(-)
--
2.17.1
The new registration method allows to get power values from the DT OPP
definition. The new OPP entry property "opp-microwatt" contains total
power expressed in micro-Watts. Align the EM documentation with this
new possible registration method of EM.
Signed-off-by: Lukasz Luba <[email protected]>
---
Documentation/power/energy-model.rst | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/Documentation/power/energy-model.rst b/Documentation/power/energy-model.rst
index 5ac62a7b4b7c..49549aab41b4 100644
--- a/Documentation/power/energy-model.rst
+++ b/Documentation/power/energy-model.rst
@@ -113,6 +113,16 @@ to: return warning/error, stop working or panic.
See Section 3. for an example of driver implementing this
callback, or Section 2.4 for further documentation on this API
+Registration of EM using DT
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The EM can also be registered using OPP framework and information in DT
+"operating-points-v2". Each OPP entry in DT can be extended with a property
+"opp-microwatt" containing micro-Watts power value. This OPP DT property
+allows a platform to register EM power values which are reflecting total power
+(static + dynamic). These power values might be coming directly from
+experiments and measurements.
+
Registration of 'simple' EM
~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
2.17.1
Add new entry for the OPP which provides information about power
expressed in micro-Watts. It is useful for the Energy Model framework.
Signed-off-by: Lukasz Luba <[email protected]>
---
.../devicetree/bindings/opp/opp-v2-base.yaml | 23 +++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/Documentation/devicetree/bindings/opp/opp-v2-base.yaml b/Documentation/devicetree/bindings/opp/opp-v2-base.yaml
index 15a76bcd6d42..04a592c0f862 100644
--- a/Documentation/devicetree/bindings/opp/opp-v2-base.yaml
+++ b/Documentation/devicetree/bindings/opp/opp-v2-base.yaml
@@ -93,6 +93,21 @@ patternProperties:
minItems: 1
maxItems: 8 # Should be enough regulators
+ opp-microwatt:
+ description: |
+ The power for the OPP in micro-Watts.
+
+ 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 power 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
+ 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
+
opp-level:
description:
A value representing the performance level of the device.
@@ -203,6 +218,14 @@ patternProperties:
minItems: 1
maxItems: 8 # Should be enough regulators
+ '^opp-microwatt':
+ description:
+ Named opp-microwatt property. Similar to opp-microamp property,
+ but for microwatt instead.
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+ minItems: 1
+ maxItems: 8 # Should be enough regulators
+
dependencies:
opp-avg-kBps: [ opp-peak-kBps ]
--
2.17.1
On 02-03-22, 11:29, Lukasz Luba wrote:
> Hi all,
>
> This patch set solves a few issues:
> 1. It allows to register EM from DT, when the voltage information is not
> available. (Some background of the issues present on Chromebook devices
> can be checked at [1].)
> 2. It allows to register 'advanced' EM from the DT, which is more accurate
> and reflects total power (dynamic + static).
>
> Implementation details:
> Existing machinery in the OPP framework now handles "opp-microwatt", similarly
> to "opp-microamp". It also has helper exported function to get power from OPP.
> For the EM, it adds a new callback in OPP framework to use this new API and
> read power while having an opp pointer. It's agreed to work with OPP-v2.
>
> Comments, suggestions are very welcome.
>
> changelog:
> v5:
> - added dual-macro to conditionally setup needed callback and compile
> on !EM kernel gently
> - removed 'advanced' word from OPP patch header description
> v4 [2]
Applied. Thanks.
--
viresh
On 3/3/22 04:05, Viresh Kumar wrote:
> On 02-03-22, 11:29, Lukasz Luba wrote:
>> Hi all,
>>
>> This patch set solves a few issues:
>> 1. It allows to register EM from DT, when the voltage information is not
>> available. (Some background of the issues present on Chromebook devices
>> can be checked at [1].)
>> 2. It allows to register 'advanced' EM from the DT, which is more accurate
>> and reflects total power (dynamic + static).
>>
>> Implementation details:
>> Existing machinery in the OPP framework now handles "opp-microwatt", similarly
>> to "opp-microamp". It also has helper exported function to get power from OPP.
>> For the EM, it adds a new callback in OPP framework to use this new API and
>> read power while having an opp pointer. It's agreed to work with OPP-v2.
>>
>> Comments, suggestions are very welcome.
>>
>> changelog:
>> v5:
>> - added dual-macro to conditionally setup needed callback and compile
>> on !EM kernel gently
>> - removed 'advanced' word from OPP patch header description
>> v4 [2]
>
> Applied. Thanks.
>
Thank you Viresh for your reviews.
Regards,
Lukasz