thermal: Add multi-source thermal zone aggregation
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest12 patches 2 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/12 | thermal: core: Add thermal zone device reference helpersdrivers/ drivers/ | +35 | 0 replies | |
| 2/12 | thermal: core: Introduce private thermal zone aggregation structuresdrivers/ include/ | +27 | 0 replies | |
| 3/12 | thermal: core: Validate thermal zone aggregation descriptionsdrivers/ drivers/ drivers/ | +85 | 0 replies | |
| 4/12 | thermal: core: Initialize thermal zone aggregation coefficientsdrivers/ drivers/ | +83 | 0 replies | |
| 5/12 | thermal: core: Dispatch aggregate temperature readsdrivers/ drivers/ drivers/ | +18 | 0 replies | |
| 6/12 | thermal: core: Calculate aggregated thermal zone temperaturesdrivers/ | +66 | 2 replies | |
| 7/12 | thermal: core: Initialize aggregation during zone registrationdrivers/ drivers/ drivers/ +1 more | +52 | 0 replies | |
| 8/12 | thermal: of: Separate zone parsing from sensor lookupdrivers/ | +29 | 0 replies | |
| 9/12 | thermal: of: Track registered hardware temperature sourcesdrivers/ | +79 | 0 replies | |
| 10/12 | thermal: of: Instantiate aggregates after their source zonesdrivers/ | +216 | 0 replies | |
| 11/12 | dt-bindings: thermal: Describe multi-source zone aggregationDocumentation/ | +39 | 0 replies | |
| 12/12 | thermal: testing: Add KUnit coverage for zone aggregationdrivers/ drivers/ drivers/ +6 more | +811 | 0 replies |
Reviews trailers per patch
None of the 12 patches has a Reviewed-by or Acked-by.
| Patch | Anvesh Jain P |
|---|---|
| 1/12 | |
| 2/12 | |
| 3/12 | |
| 4/12 | |
| 5/12 | |
| 6/12 | T-b |
| 7/12 | |
| 8/12 | |
| 9/12 | |
| 10/12 | |
| 11/12 | |
| 12/12 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v1 00/12] thermal: Add multi-source thermal zone aggregation
Thermal management may need to estimate a temperature that no sensor measures directly. For example, skin temperature can be estimated from readings near the processor, display and battery; an internal board region's temperature from sensors around the processor, memory and power-management circuitry; and the temperature surrounding the battery from readings near the battery, charging circuitry and adjacent components. Each sensor's contribution depends on its location relative to the target region and the thermal paths connecting them. A linear regression model provides a practical approximation of these
relationships: coefficients fitted from platform measurements weight each sensor's contribution, while a constant offset accounts for the baseline difference between the weighted readings and the target temperature.
This series provides common support for aggregated thermal zones, allowing estimated temperatures to benefit from the thermal framework's existing trip handling, governors and cooling policies. It has two parts: thermal core support, which makes aggregation available independently of the firmware interface, and OF support, which allows platforms to describe aggregated zones in Device Tree.
This series introduces support in the thermal core for deriving a zone's temperature from a weighted combination of existing thermal zone temperatures and a constant offset, reusing the readings already provided by sensor drivers. Each source zone retains its own trips and cooling policy and can contribute to several aggregates, each representing a different thermal constraint. The series adds reference-counting helpers so aggregate owners can keep source zones alive until their dependencies are torn down. It also introduces registration-time validation of the aggregation parameters to reject unavailable sources, nested aggregation, incomplete coefficient sets and incompatible operations before the new zone is exposed.
The series also adds OF support for describing aggregated zones through multiple thermal-sensors references and optional coefficients in Device Tree. These references identify hardware sensors whose registered thermal zones provide the source temperatures. Aggregate creation waits until all sources are available, allowing sensor drivers to probe independently. Dependent aggregates are removed before a source is unregistered and recreated when it returns. This lets platforms describe their thermal estimates without changes to sensor drivers, while preserving existing single-source calibration.
The series includes KUnit tests for both the core and OF support, using synthetic thermal sources without requiring platform hardware. The core tests cover parameter validation, default coefficients, temperature calculations, error handling and source lock contention. The OF tests cover deferred creation, coefficient parsing, source removal and recreation, and a temperature read concurrent with source teardown. All 23 cases pass on UML with lockdep enabled. Initial late-init discovery, real module loading and platform hardware are not covered by these tests.
Testing:
- git diff --check passes.
- Per-patch checkpatch reports no errors. Remaining warnings concern commit-message line lengths and possible MAINTAINERS updates.
This cover letter was drafted with OpenCode using gpt-6.1-sol from the commit series, human driven and a source-code study. The same tool ran the KUnit and patch checks reported above.
Daniel Lezcano (12):
thermal: core: Add thermal zone device reference helpers
thermal: core: Introduce private thermal zone aggregation structures
thermal: core: Validate thermal zone aggregation descriptions
thermal: core: Initialize thermal zone aggregation coefficients
thermal: core: Dispatch aggregate temperature reads
thermal: core: Calculate aggregated thermal zone temperatures
thermal: core: Initialize aggregation during zone registration
thermal: of: Separate zone parsing from sensor lookup
thermal: of: Track registered hardware temperature sources
thermal: of: Instantiate aggregates after their source zones
dt-bindings: thermal: Describe multi-source zone aggregation
thermal: testing: Add KUnit coverage for zone aggregation
.../bindings/thermal/thermal-zones.yaml | 46 ++- drivers/thermal/Kconfig | 31 ++ drivers/thermal/Makefile | 2 + drivers/thermal/testing/.kunitconfig | 11 + drivers/thermal/testing/README.rst | 34 ++ .../thermal/testing/thermal_aggregation.dtso | 53 +++ .../testing/thermal_aggregation_test.c | 351 +++++++++++++++++ .../testing/thermal_of_aggregation_test.c | 330 ++++++++++++++++ drivers/thermal/thermal_aggregation.c | 252 ++++++++++++ drivers/thermal/thermal_core.c | 49 ++- drivers/thermal/thermal_core.h | 48 ++- drivers/thermal/thermal_helpers.c | 9 +- drivers/thermal/thermal_of.c | 370 ++++++++++++++++-- include/linux/thermal.h | 4 + 14 files changed, 1532 insertions(+), 58 deletions(-) create mode 100644 drivers/thermal/testing/.kunitconfig create mode 100644 drivers/thermal/testing/README.rst create mode 100644 drivers/thermal/testing/thermal_aggregation.dtso create mode 100644 drivers/thermal/testing/thermal_aggregation_test.c create mode 100644 drivers/thermal/testing/thermal_of_aggregation_test.c create mode 100644 drivers/thermal/thermal_aggregation.c
base-commit: 0dd55073c872df387d28480d1197c013423d1705
Signature · 1 line
2.43.0