Hi Viresh,
Thanks for having a look at it.
On 2/22/22 03:03, Viresh Kumar wrote:
On 21-02-22, 22:51, Lukasz Luba wrote:
Add DT bindings for the Energy Model information.
Signed-off-by: Lukasz Luba <lukasz.luba@xxxxxxx>
---
.../bindings/power/energy-model.yaml | 51 +++++++++++++++++++
1 file changed, 51 insertions(+)
create mode 100644 Documentation/devicetree/bindings/power/energy-model.yaml
diff --git a/Documentation/devicetree/bindings/power/energy-model.yaml b/Documentation/devicetree/bindings/power/energy-model.yaml
new file mode 100644
index 000000000000..804a9b324925
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/energy-model.yaml
@@ -0,0 +1,51 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/energy-model.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Energy Model Bindings
+
+maintainers:
+ - Lukasz Luba <lukasz.luba@xxxxxxx>
+
+description: |+
+ Devices work at specific performance states (frequencies). The power which
+ is used at a given performance state is an important information. A framework
+ which maintains this information is Energy Model. This document defines
+ bindings for these Energy Model performance states applicable across wide
+ range of devices. For illustration purpose, this document uses GPU as a device.
+
+ This binding only supports frequency-power pairs.
+
+select: true
+
+properties:
+ operating-points:
+ $ref: /schemas/types.yaml#/definitions/uint32-matrix
+ items:
+ items:
+ - description: Frequency in kHz
+ - description: Power in uW
+
+
+additionalProperties: true
+examples:
+ {
+ gpu_energy_model: energy-model {
+ compatible = "energy-model";
+ energy-model-entries = <
+ 200000 300000
+ 297000 500000
+ 400000 800000
+ 500000 1400000
+ 600000 2000000
+ 800000 2800000
+ >;
+ };
+ };
+
+ &gpu {
+ energy-model = <&gpu_energy_model>;
+ };
What about getting this from the OPP table instead? There is no point adding
similar tables for a device.
I'm not sure if that would be flexible enough to meet the requirement:
power for each OPP might be different in one board vs. other board.
Power can be different because of static power, which might vary due to
different temperature that the SoC operates at a particular OPP. It can
be due to: better heat sink (or no at all like on dev board), bigger PCB
with fat copper layers, different location of hot devices (like PMIC) on
the PCB, missing some hot devices on the PCB (fast charger), case, etc.
The 'advanced' EM and this DT array allows to provide avg power from
measurements for a particular board and for each OPP independently.
AFAIK the OPP definition is more SoC specific. I'm particularly
interested in this SC7180 SoC and it's GPU power [1]. There is
also a nice OPP definition in that node.
As you can see there is one SoC file and quite a few boards next to
it. Some of them have a decent thermal design (inside Chromebook) but
some are 'just' dev boards. The power would be different for those
boards.
Similar issue would be e.g. for Rk3399 SoC (Chromebook, Pine64, IoT and
some dev boards).
IMO the OPP table might be to much hassle and heavy for those boards.
[1]
https://elixir.bootlin.com/linux/latest/source/arch/arm64/boot/dts/qcom/sc7180.dtsi#L1953