mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] hwmon: pmbus: 0-based thermal sensor index, mps,mpq8785 #thermal-sensor-cells
@ 2026-10-01  7:28 Vincent Jardin via B4 Relay
  2026-10-01  7:28 ` [PATCH v2 1/2] hwmon: (pmbus/core) Register the thermal sensors with a 0-based index Vincent Jardin via B4 Relay
  2026-10-01  7:28 ` [PATCH v2 2/2] dt-bindings: hwmon: pmbus: mps,mpq8785: add #thermal-sensor-cells Vincent Jardin via B4 Relay
  0 siblings, 2 replies; 5+ messages in thread
From: Vincent Jardin via B4 Relay @ 2026-10-01  7:28 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 commente on v1 [1].

Patch 2 is the v1 binding change, now with #thermal-sensor-cells = <0>.

[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 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                               | 2 +-
 2 files changed, 4 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] 5+ messages in thread

* [PATCH v2 1/2] hwmon: (pmbus/core) Register the thermal sensors with a 0-based index
  2026-10-01  7:28 [PATCH v2 0/2] hwmon: pmbus: 0-based thermal sensor index, mps,mpq8785 #thermal-sensor-cells Vincent Jardin via B4 Relay
@ 2026-10-01  7:28 ` Vincent Jardin via B4 Relay
  2026-10-01  7:28 ` [PATCH v2 2/2] dt-bindings: hwmon: pmbus: mps,mpq8785: add #thermal-sensor-cells Vincent Jardin via B4 Relay
  1 sibling, 0 replies; 5+ messages in thread
From: Vincent Jardin via B4 Relay @ 2026-10-01  7:28 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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index d69f1bde1795..dc1767d9f1ff 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -1524,7 +1524,7 @@ 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,
+	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] 5+ messages in thread

* [PATCH v2 2/2] dt-bindings: hwmon: pmbus: mps,mpq8785: add #thermal-sensor-cells
  2026-10-01  7:28 [PATCH v2 0/2] hwmon: pmbus: 0-based thermal sensor index, mps,mpq8785 #thermal-sensor-cells Vincent Jardin via B4 Relay
  2026-10-01  7:28 ` [PATCH v2 1/2] hwmon: (pmbus/core) Register the thermal sensors with a 0-based index Vincent Jardin via B4 Relay
@ 2026-10-01  7:28 ` Vincent Jardin via B4 Relay
  2026-10-01 19:19   ` Conor Dooley
  1 sibling, 1 reply; 5+ messages in thread
From: Vincent Jardin via B4 Relay @ 2026-10-01  7:28 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>

Since commit
  3aa74796cfd0 ("hwmon: (pmbus) Register with thermal for PSC_TEMPERATURE")
the PMBus core calls devm_thermal_of_zone_register() for every
temperature input, so the devices of this binding can be referenced as
thermal sensors.

By code review, it should work for the MPQ and MPM device bindings.
They register a single page with PMBUS_HAVE_TEMP through
pmbus_do_probe(), it means that one device has one
temperature input, temp1.

The PMBus core registers the first temperature input as sensor 0, so no
cell is needed.

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] 5+ messages in thread

* Re: [PATCH v2 2/2] dt-bindings: hwmon: pmbus: mps,mpq8785: add #thermal-sensor-cells
  2026-10-01  7:28 ` [PATCH v2 2/2] dt-bindings: hwmon: pmbus: mps,mpq8785: add #thermal-sensor-cells Vincent Jardin via B4 Relay
@ 2026-10-01 19:19   ` Conor Dooley
  2026-10-01 21:43     ` Vincent Jardin
  0 siblings, 1 reply; 5+ messages in thread
From: Conor Dooley @ 2026-10-01 19:19 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: 1992 bytes --]

On Thu, Oct 01, 2026 at 09:28:23AM +0200, Vincent Jardin via B4 Relay wrote:
> From: Vincent Jardin <vjardin@free.fr>
> 
> Since commit
>   3aa74796cfd0 ("hwmon: (pmbus) Register with thermal for PSC_TEMPERATURE")
> the PMBus core calls devm_thermal_of_zone_register() for every
> temperature input, so the devices of this binding can be referenced as
> thermal sensors.

Commit messages for bindings should reference hardware in their
justification, not what a particular OS has decided to do.

> By code review, it should work for the MPQ and MPM device bindings.
> They register a single page with PMBUS_HAVE_TEMP through
> pmbus_do_probe(), it means that one device has one
> temperature input, temp1.
> 
> The PMBus core registers the first temperature input as sensor 0, so no
> cell is needed.

I don't understand this, if it has multiple sensors, each could be
referenced by something and it would need cells. It only has single
input, then that's the justification that needs to be provided here.
What software does, especially in generic code, should not be used to
justify a binding change.

I checked the devices supported by the mpq8785 driver and none of them
actually appear to have temperature inputs at all?

Confused,
Conor.

> 
> 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
> 
> 

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

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

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

Hi Conor,

> I don't understand this, if it has multiple sensors, each could be
> referenced by something and it would need cells. It only has single
> input, then that's the justification that needs to be provided here.
> What software does, especially in generic code, should not be used to
> justify a binding change.
> 
> I checked the devices supported by the mpq8785 driver and none of them
> actually appear to have temperature inputs at all?

Right, none of them has a temperature input pin: the sensor is
internal, not an input. Each device measures the temperature of its
own die.

I hope it avoids the confusion, I'll update the commit log,
  Vincent

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

end of thread, other threads:[~2026-10-01 21:43 UTC | newest]

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

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®