mbox series

[v3,0/6] thermal: Add support of multiple sensors

Message ID 20240524143150.610949-1-abailon@baylibre.com
Headers show
Series thermal: Add support of multiple sensors | expand

Message

Alexandre Bailon May 24, 2024, 2:31 p.m. UTC
Following this comment [1], this updates thermal_of to support multiple
sensors.

This series intends to add support of thermal aggregation.
One use case for it is using the IPA in the case we have
multiple sensors for one performance domain.

This has been tested on the mt8195 using s-tui.
To test and validate, we heat up the CPU and the heat sink.
At some point, we run benchmark tests with different configurations:
- Mediatek kernel (IPA + their own thermal aggregation)
- Mainline kernel
- Mainline kernel with IPA and aggregation enabled
With the IPA and the aggregation enabled, we get the best performances
with the most stable CPU temperature.

The aggregation is configured and enabled using device tree.
One thermal zone has to be created with a list of sensors.
It will take care of registering a thermal zone for each sensors.
The cooling device will only be registered with the aggregating thermal zone.

There are still something important missing: a way to check that all
aggregated sensors are part of the same performance domain.
So far, I don't see how this should be done. Some recommendations would be
appreciated.

Changes in v2:
- Rebased on 6.7
- Seperated generic multi sensor and dt specfic code
- Simplified the code
- Drop min / max and only do weighted average (seems more adequate for IPA)

Changes in v3:
- Rebased on 6.9
- Reworked the way to register a multi sensor thermal zone
  - Only one thermal zone to define in device tree
- Max has been re-added
- Enabled it on mt8195

[1]: https://patchwork.kernel.org/comment/24723927/

Alexandre Bailon (6):
  dt-bindings: thermal: Restore the thermal-sensors property
  thermal: Add support of multi sensors to thermal_core
  thermal: Add support of multi sensors to thermal_of
  dt-bindings: thermal: Add a property to select the aggregation type
  thermal: of: Parse aggregation property to select the aggegration type
  ARM64: mt8195: Use thermal aggregation for big and little cpu

 .../bindings/thermal/thermal-zones.yaml       |  13 +-
 arch/arm64/boot/dts/mediatek/mt8195.dtsi      | 212 ++---------
 drivers/thermal/Makefile                      |   1 +
 drivers/thermal/thermal_core.h                |  15 +
 drivers/thermal/thermal_multi.c               | 332 ++++++++++++++++++
 drivers/thermal/thermal_of.c                  | 282 ++++++++++++++-
 include/uapi/linux/thermal.h                  |   5 +
 7 files changed, 663 insertions(+), 197 deletions(-)
 create mode 100644 drivers/thermal/thermal_multi.c