mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3 0/2] hwmon: pmbus: 0-based thermal sensor index, mps,mpq8785 #thermal-sensor-cells
@ 2026-10-01 21:47 Vincent Jardin via B4 Relay
  2026-10-01 21:47 ` [PATCH v3 1/2] hwmon: (pmbus/core) Register the thermal sensors with a 0-based index Vincent Jardin via B4 Relay
  2026-10-01 21:47 ` [PATCH v3 2/2] dt-bindings: hwmon: pmbus: mps,mpq8785: add #thermal-sensor-cells Vincent Jardin via B4 Relay
  0 siblings, 2 replies; 4+ messages in thread
From: Vincent Jardin via B4 Relay @ 2026-10-01 21:47 UTC (permalink / raw)
  To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Charles Hsu, Eduardo Valentin
  Cc: linux-hwmon, devicetree, linux-kernel, Vincent Jardin, stable+noautosel

The PMBus core registers its temperature inputs with the thermal core
from index 1, while the thermal core expects a 0-based index.

Patch 1 fixes it, as Guenter commented on v1 [1].

Patch 2 allows #thermal-sensor-cells = <0> in the mps,mpq8785 binding:
each of its devices has a single temperature sensor, on its die.

[1] https://lore.kernel.org/r/37298c5b-aa6b-473a-8e22-d29ddec12c04@roeck-us.net

To: Guenter Roeck <linux@roeck-us.net>
To: Rob Herring <robh@kernel.org>
To: Krzysztof Kozlowski <krzk+dt@kernel.org>
To: Conor Dooley <conor+dt@kernel.org>
To: Charles Hsu <ythsu0511@gmail.com>
To: Eduardo Valentin <eduval@amazon.com>
Cc: linux-hwmon@vger.kernel.org
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Vincent Jardin <vjardin@free.fr>

Changes in v3:
- Patch 1: comment devm_thermal_of_zone_register() for 1-based PMBus index (Guenter)
- Patch 2: commit message enriched with hardware,
           one internal die temperature sensor per device (Conor)
- Link to v2: https://lore.kernel.org/r/20261001-for-upstream-dt-mpq8785-thermal-sensor-cells-v2-0-07d368dcc662@free.fr

Changes in v2:
- New patch 1: register the PMBus thermal sensors with a 0-based index (Sashiko, Guenter)
- Patch 2: #thermal-sensor-cells const: 0 instead of 1
- Link to v1: https://lore.kernel.org/r/20260930-for-upstream-dt-mpq8785-thermal-sensor-cells-v1-1-6573c765eef8@free.fr

---
Vincent Jardin (2):
      hwmon: (pmbus/core) Register the thermal sensors with a 0-based index
      dt-bindings: hwmon: pmbus: mps,mpq8785: add #thermal-sensor-cells

 Documentation/devicetree/bindings/hwmon/pmbus/mps,mpq8785.yaml | 3 +++
 drivers/hwmon/pmbus/pmbus_core.c                               | 7 ++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
---
base-commit: 4781ca52761e666cf18b591e6bb0478396c90320
change-id: 20260930-for-upstream-dt-mpq8785-thermal-sensor-cells-c77fa6da5406

Best regards,
-- 
Vincent Jardin <vjardin@free.fr>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v3 1/2] hwmon: (pmbus/core) Register the thermal sensors with a 0-based index
  2026-10-01 21:47 [PATCH v3 0/2] hwmon: pmbus: 0-based thermal sensor index, mps,mpq8785 #thermal-sensor-cells Vincent Jardin via B4 Relay
@ 2026-10-01 21:47 ` Vincent Jardin via B4 Relay
  2026-10-01 21:47 ` [PATCH v3 2/2] dt-bindings: hwmon: pmbus: mps,mpq8785: add #thermal-sensor-cells Vincent Jardin via B4 Relay
  1 sibling, 0 replies; 4+ messages in thread
From: Vincent Jardin via B4 Relay @ 2026-10-01 21:47 UTC (permalink / raw)
  To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Charles Hsu, Eduardo Valentin
  Cc: linux-hwmon, devicetree, linux-kernel, Vincent Jardin, stable+noautosel

From: Vincent Jardin <vjardin@free.fr>

Since commit
  3aa74796cfd0 ("hwmon: (pmbus) Register with thermal for PSC_TEMPERATURE")
pmbus_core registers each temperature input with the thermal core using
its hwmon index as the sensor id. That index starts at 1, so temp1 is
registered as sensor 1.

The thermal core expects a 0-based id, which is what the hwmon core
passes for the drivers that set HWMON_C_REGISTER_TZ:
thermal_of matches a thermal-sensors phandle without cells as id 0, so a
PMBus device with a single temperature input cannot
use #thermal-sensor-cells = <0>.

Cc: stable+noautosel@kernel.org # changes the DT-visible sensor id, no in-tree user
Fixes: 3aa74796cfd0 ("hwmon: (pmbus) Register with thermal for PSC_TEMPERATURE")
Signed-off-by: Vincent Jardin <vjardin@free.fr>
---
 drivers/hwmon/pmbus/pmbus_core.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index d69f1bde1795..af13408c62f9 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -1524,7 +1524,12 @@ static int pmbus_thermal_add_sensor(struct pmbus_data *pmbus_data,
 	tdata->sensor = sensor;
 	tdata->pmbus_data = pmbus_data;
 
-	tzd = devm_thermal_of_zone_register(dev, index, tdata,
+	/*
+	 * The PMBus core numbers its temperature sensors from 1, as the
+	 * hwmon tempN attributes, while the thermal core expects a 0-based
+	 * sensor index.
+	 */
+	tzd = devm_thermal_of_zone_register(dev, index - 1, tdata,
 					    &pmbus_thermal_ops);
 	/*
 	 * If CONFIG_THERMAL_OF is disabled, this returns -ENODEV,

-- 
2.43.0



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v3 2/2] dt-bindings: hwmon: pmbus: mps,mpq8785: add #thermal-sensor-cells
  2026-10-01 21:47 [PATCH v3 0/2] hwmon: pmbus: 0-based thermal sensor index, mps,mpq8785 #thermal-sensor-cells Vincent Jardin via B4 Relay
  2026-10-01 21:47 ` [PATCH v3 1/2] hwmon: (pmbus/core) Register the thermal sensors with a 0-based index Vincent Jardin via B4 Relay
@ 2026-10-01 21:47 ` Vincent Jardin via B4 Relay
  2026-10-02 16:50   ` Conor Dooley
  1 sibling, 1 reply; 4+ messages in thread
From: Vincent Jardin via B4 Relay @ 2026-10-01 21:47 UTC (permalink / raw)
  To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Charles Hsu, Eduardo Valentin
  Cc: linux-hwmon, devicetree, linux-kernel, Vincent Jardin

From: Vincent Jardin <vjardin@free.fr>

Each device of this binding has a single temperature sensor: the
internal sensor of its die, which the device also uses for its
over-temperature protection. It is read over PMBus with
READ_TEMPERATURE_1 (8Dh). The sensor is internal, not an input:
none of these devices has a pin for an external temperature sensor.

Allow a thermal zone to use the device as its sensor, to monitor the
regulator's temperature. With a single sensor per device, no cell is
needed.

The MPM82504 has four channels, each with its own PMBus address set by
its own ADDR pin, so each channel is described by its own node.

Signed-off-by: Vincent Jardin <vjardin@free.fr>
---
 Documentation/devicetree/bindings/hwmon/pmbus/mps,mpq8785.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/hwmon/pmbus/mps,mpq8785.yaml b/Documentation/devicetree/bindings/hwmon/pmbus/mps,mpq8785.yaml
index d7a32fb3b7af..6257a8030e53 100644
--- a/Documentation/devicetree/bindings/hwmon/pmbus/mps,mpq8785.yaml
+++ b/Documentation/devicetree/bindings/hwmon/pmbus/mps,mpq8785.yaml
@@ -34,6 +34,9 @@ properties:
     maximum: 4095
     default: 706
 
+  "#thermal-sensor-cells":
+    const: 0
+
 required:
   - compatible
   - reg

-- 
2.43.0



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 2/2] dt-bindings: hwmon: pmbus: mps,mpq8785: add #thermal-sensor-cells
  2026-10-01 21:47 ` [PATCH v3 2/2] dt-bindings: hwmon: pmbus: mps,mpq8785: add #thermal-sensor-cells Vincent Jardin via B4 Relay
@ 2026-10-02 16:50   ` Conor Dooley
  0 siblings, 0 replies; 4+ messages in thread
From: Conor Dooley @ 2026-10-02 16:50 UTC (permalink / raw)
  To: vjardin
  Cc: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Charles Hsu, Eduardo Valentin, linux-hwmon, devicetree,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1556 bytes --]

On Thu, Oct 01, 2026 at 11:47:40PM +0200, Vincent Jardin via B4 Relay wrote:
> From: Vincent Jardin <vjardin@free.fr>
> 
> Each device of this binding has a single temperature sensor: the
> internal sensor of its die, which the device also uses for its
> over-temperature protection. It is read over PMBus with
> READ_TEMPERATURE_1 (8Dh). The sensor is internal, not an input:
> none of these devices has a pin for an external temperature sensor.
> 
> Allow a thermal zone to use the device as its sensor, to monitor the
> regulator's temperature. With a single sensor per device, no cell is
> needed.
> 
> The MPM82504 has four channels, each with its own PMBus address set by
> its own ADDR pin, so each channel is described by its own node.
> 
> Signed-off-by: Vincent Jardin <vjardin@free.fr>

Acked-by: Conor Dooley <conor.dooley@microchip.com>
pw-bot: not-applicable

> ---
>  Documentation/devicetree/bindings/hwmon/pmbus/mps,mpq8785.yaml | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/hwmon/pmbus/mps,mpq8785.yaml b/Documentation/devicetree/bindings/hwmon/pmbus/mps,mpq8785.yaml
> index d7a32fb3b7af..6257a8030e53 100644
> --- a/Documentation/devicetree/bindings/hwmon/pmbus/mps,mpq8785.yaml
> +++ b/Documentation/devicetree/bindings/hwmon/pmbus/mps,mpq8785.yaml
> @@ -34,6 +34,9 @@ properties:
>      maximum: 4095
>      default: 706
>  
> +  "#thermal-sensor-cells":
> +    const: 0
> +
>  required:
>    - compatible
>    - reg
> 
> -- 
> 2.43.0
> 
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-02 16:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-01 21:47 [PATCH v3 0/2] hwmon: pmbus: 0-based thermal sensor index, mps,mpq8785 #thermal-sensor-cells Vincent Jardin via B4 Relay
2026-10-01 21:47 ` [PATCH v3 1/2] hwmon: (pmbus/core) Register the thermal sensors with a 0-based index Vincent Jardin via B4 Relay
2026-10-01 21:47 ` [PATCH v3 2/2] dt-bindings: hwmon: pmbus: mps,mpq8785: add #thermal-sensor-cells Vincent Jardin via B4 Relay
2026-10-02 16:50   ` Conor Dooley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®