Devicetree
 help / color / mirror / Atom feed
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,
	Daniel Lezcano <daniel.lezcano@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND
	FLATTENED DEVICE TREE BINDINGS),
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCH v1 11/12] dt-bindings: thermal: Describe multi-source zone aggregation
Date: Thu, 19 Nov 2026 10:46:53 +0100	[thread overview]
Message-ID: <20261119094706.3439040-12-daniel.lezcano@oss.qualcomm.com> (raw)
In-Reply-To: <20261119094706.3439040-1-daniel.lezcano@oss.qualcomm.com>

Allow multiple hardware thermal sensor references and associate supplied
coefficients positionally with those references. Use signed cells to
represent existing negative calibration values and aggregate offsets.

Document approximate averaging when multi-source coefficients are absent,
with unity gain for one source. Explicit multi-source multipliers retain
the unscaled affine interpretation and are not normalized. Require
nonzero explicit multipliers to distinguish supplied values from the
core initializer default request.

Preserve existing single-source sensor-specific slope and offset
interpretations, including zero values and driver-specific scaling.
Add examples of averaging and explicit signed multi-source combinations.

Signed-off-by: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>
---
 .../bindings/thermal/thermal-zones.yaml       | 46 ++++++++++++++++---
 1 file changed, 39 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/thermal/thermal-zones.yaml b/Documentation/devicetree/bindings/thermal/thermal-zones.yaml
index 72e419124f98..10cf1fb8cb9a 100644
--- a/Documentation/devicetree/bindings/thermal/thermal-zones.yaml
+++ b/Documentation/devicetree/bindings/thermal/thermal-zones.yaml
@@ -95,10 +95,13 @@ patternProperties:
 
       thermal-sensors:
         $ref: /schemas/types.yaml#/definitions/phandle-array
-        maxItems: 1
-        description:
-          The thermal sensor phandle and sensor specifier used to monitor this
-          thermal zone.
+        description: |
+          A list of hardware thermal sensor provider phandles and sensor
+          specifiers used to monitor this thermal zone. Each entry uses the
+          number of specifier cells defined by its provider's
+          #thermal-sensor-cells. Multiple entries describe an aggregation of
+          the corresponding source zone temperatures. Thermal zone nodes are
+          not referenced by this property.
 
       coefficients:
         $ref: /schemas/types.yaml#/definitions/int32-array
@@ -110,9 +113,23 @@ patternProperties:
             z = c0 * x0 + c1 * x1 + ... + c(n-1) * x(n-1) + cn
           where c0, c1, .., cn are the coefficients.
 
-          Coefficients default to 1 in case this property is not specified. The
-          coefficients are ordered and are matched with sensors by means of the
-          sensor ID. Additional coefficients are interpreted as constant offset.
+          For multiple sources, the first n coefficients correspond to entries
+          in thermal-sensors in list order, not to provider-specific sensor IDs.
+          Supply all n multipliers, optionally followed by the constant offset
+          in millicelsius. Multipliers are signed nonzero unscaled integers;
+          there is no implicit divisor or normalization for supplied values.
+          An omitted offset is zero.
+
+          When coefficients are absent for a multi-source zone, the temperature
+          is the approximate arithmetic mean of the source zone temperatures.
+          Contributions are distributed as evenly as possible in source order
+          with a total gain of one. A single source consequently has a default
+          multiplier of one.
+
+          Existing single-source hardware zones retain their sensor-specific
+          slope and offset calibration interpretation, including signed or zero
+          values and any sensor-specific scaling. Their default slope is one
+          and default offset is zero.
 
       sustainable-power:
         $ref: /schemas/types.yaml#/definitions/uint32
@@ -339,6 +356,21 @@ examples:
 
             /* ... */
 
+            // With no coefficients, use approximately equal contributions.
+            skin-thermal {
+                    polling-delay-passive = <250>;
+                    polling-delay = <1000>;
+                    thermal-sensors = <&tsens0 1>, <&tsens0 5>;
+            };
+
+            // Explicit multipliers are not normalized: board = 2*T0 - T1 - 1000.
+            board-thermal {
+                    polling-delay-passive = <250>;
+                    polling-delay = <1000>;
+                    thermal-sensors = <&tsens0 1>, <&tsens0 5>;
+                    coefficients = <2 (-1) (-1000)>;
+            };
+
             gpu-top-thermal {
                     polling-delay-passive = <250>;
                     polling-delay = <1000>;
-- 
2.43.0


           reply	other threads:[~2026-11-19  9:47 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20261119094706.3439040-1-daniel.lezcano@oss.qualcomm.com>]

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-12-daniel.lezcano@oss.qualcomm.com \
    --to=daniel.lezcano@oss.qualcomm.com \
    --cc=anvesh.p@oss.qualcomm.com \
    --cc=conor+dt@kernel.org \
    --cc=daniel.lezcano@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.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