From: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>
To: daniel.lezcano@oss.qualcomm.com, rafael@kernel.org
Cc: Zhang Rui <rui.zhang@intel.com>,
Lukasz Luba <lukasz.luba@arm.com>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Anvesh Jain P <anvesh.p@oss.qualcomm.com>,
Ulf Hansson <ulf.hansson@oss.qualcomm.com>,
linux-pm@vger.kernel.org
Subject: [PATCH v1 00/12] thermal: Add multi-source thermal zone aggregation
Date: Thu, 19 Nov 2026 10:46:42 +0100 [thread overview]
Message-ID: <20261119094706.3439040-1-daniel.lezcano@oss.qualcomm.com> (raw)
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
--
2.43.0
next reply other threads:[~2026-11-19 9:47 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 9:46 Daniel Lezcano [this message]
2026-11-19 9:46 ` [PATCH v1 01/12] thermal: core: Add thermal zone device reference helpers Daniel Lezcano
2026-11-19 9:46 ` [PATCH v1 02/12] thermal: core: Introduce private thermal zone aggregation structures Daniel Lezcano
2026-11-19 9:46 ` [PATCH v1 03/12] thermal: core: Validate thermal zone aggregation descriptions Daniel Lezcano
2026-11-19 9:46 ` [PATCH v1 04/12] thermal: core: Initialize thermal zone aggregation coefficients Daniel Lezcano
2026-11-19 9:46 ` [PATCH v1 05/12] thermal: core: Dispatch aggregate temperature reads Daniel Lezcano
2026-11-19 9:46 ` [PATCH v1 06/12] thermal: core: Calculate aggregated thermal zone temperatures Daniel Lezcano
2026-11-19 9:46 ` [PATCH v1 07/12] thermal: core: Initialize aggregation during zone registration Daniel Lezcano
2026-11-19 9:46 ` [PATCH v1 08/12] thermal: of: Separate zone parsing from sensor lookup Daniel Lezcano
2026-11-19 9:46 ` [PATCH v1 09/12] thermal: of: Track registered hardware temperature sources Daniel Lezcano
2026-11-19 9:46 ` [PATCH v1 10/12] thermal: of: Instantiate aggregates after their source zones Daniel Lezcano
2026-11-19 9:46 ` [PATCH v1 11/12] dt-bindings: thermal: Describe multi-source zone aggregation Daniel Lezcano
2026-11-19 9:46 ` [PATCH v1 12/12] thermal: testing: Add KUnit coverage for " Daniel Lezcano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261119094706.3439040-1-daniel.lezcano@oss.qualcomm.com \
--to=daniel.lezcano@oss.qualcomm.com \
--cc=anvesh.p@oss.qualcomm.com \
--cc=krzk+dt@kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=rafael@kernel.org \
--cc=robh@kernel.org \
--cc=rui.zhang@intel.com \
--cc=ulf.hansson@oss.qualcomm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox