* [PATCH] dt-bindings: hwmon: pmbus: mps,mpq8785: add #thermal-sensor-cells
@ 2026-09-30 13:56 ` Vincent Jardin via B4 Relay
0 siblings, 0 replies; 5+ messages in thread
From: Vincent Jardin @ 2026-09-30 13:56 UTC (permalink / raw)
To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Charles Hsu
Cc: linux-hwmon, devicetree, linux-kernel, Vincent Jardin
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 sensor id is the hwmon index of the input (temp1 is 1), so one 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..36760d89f665 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: 1
+
required:
- compatible
- reg
---
base-commit: 4781ca52761e666cf18b591e6bb0478396c90320
change-id: 20260930-for-upstream-dt-mpq8785-thermal-sensor-cells-c77fa6da5406
Best regards,
--
Vincent Jardin <vjardin@free.fr>
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] dt-bindings: hwmon: pmbus: mps,mpq8785: add #thermal-sensor-cells
@ 2026-09-30 13:56 ` Vincent Jardin via B4 Relay
0 siblings, 0 replies; 5+ messages in thread
From: Vincent Jardin via B4 Relay @ 2026-09-30 13:56 UTC (permalink / raw)
To: Guenter Roeck, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Charles Hsu
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 sensor id is the hwmon index of the input (temp1 is 1), so one 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..36760d89f665 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: 1
+
required:
- compatible
- reg
---
base-commit: 4781ca52761e666cf18b591e6bb0478396c90320
change-id: 20260930-for-upstream-dt-mpq8785-thermal-sensor-cells-c77fa6da5406
Best regards,
--
Vincent Jardin <vjardin@free.fr>
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] dt-bindings: hwmon: pmbus: mps,mpq8785: add #thermal-sensor-cells
2026-09-30 13:56 ` Vincent Jardin via B4 Relay
(?)
@ 2026-09-30 14:07 ` sashiko-bot
2026-09-30 17:27 ` Vincent Jardin
-1 siblings, 1 reply; 5+ messages in thread
From: sashiko-bot @ 2026-09-30 14:07 UTC (permalink / raw)
To: Vincent Jardin; +Cc: devicetree, conor+dt, robh, linux-hwmon
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] dt-bindings: incorrect #thermal-sensor-cells constraint for single-sensor device
--
commit e3f74468edb24a9bcc5d029cc615555210a46a78
Author: Vincent Jardin <vjardin@free.fr>
dt-bindings: hwmon: pmbus: mps,mpq8785: add #thermal-sensor-cells
This patch adds the #thermal-sensor-cells property to the mpq8785 binding
schema to allow referencing the device as a thermal sensor. It sets the
cell count to 1 to match the 1-based sensor index used internally by the
PMBus core.
> diff --git a/Documentation/devicetree/bindings/hwmon/pmbus/mps,mpq8785.yaml b/Documentation/devicetree/bindings/hwmon/pmbus/mps,mpq8785.yaml
> --- 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: 1
[Severity: Medium]
Is it correct to set the cell count constraint to 1 for this hardware?
The Devicetree specification generally mandates that single-sensor devices
use a cell count of 0, as no index is needed to identify the sensor. By
forcing this to 1, it appears we might be baking a Linux-specific driver
quirk (the PMBus core's internal 1-based index) into the OS-agnostic
hardware description ABI.
Would it be better to map a Devicetree ID of 0 to the internal hwmon index 1
within the driver code itself, rather than requiring device tree authors to
pass a factually incorrect dummy index in their thermal-sensors phandle?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260930-for-upstream-dt-mpq8785-thermal-sensor-cells-v1-1-6573c765eef8@free.fr?part=1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] dt-bindings: hwmon: pmbus: mps,mpq8785: add #thermal-sensor-cells
2026-09-30 14:07 ` sashiko-bot
@ 2026-09-30 17:27 ` Vincent Jardin
2026-09-30 22:24 ` Guenter Roeck
0 siblings, 1 reply; 5+ messages in thread
From: Vincent Jardin @ 2026-09-30 17:27 UTC (permalink / raw)
To: Guenter Roeck
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Charles Hsu,
linux-hwmon, devicetree, linux-kernel
Hi Guenter,
On Wed, Sep 30, 2026 at 02:07:21PM +0000, sashiko-bot@kernel.org wrote:
> [Severity: Medium]
> Is it correct to set the cell count constraint to 1 for this hardware?
>
> The Devicetree specification generally mandates that single-sensor devices
> use a cell count of 0, as no index is needed to identify the sensor. By
> forcing this to 1, it appears we might be baking a Linux-specific driver
> quirk (the PMBus core's internal 1-based index) into the OS-agnostic
> hardware description ABI.
M. Bot has a point, and it is a PMBus core question, so I would like
your view before a v2 of this binding.
Since the commit
3aa74796cfd0 ("hwmon: (pmbus) Register with thermal for PSC_TEMPERATURE")
pmbus_core registers each temperature input using its hwmon index as the
sensor id, so temp1 is sensor 1.
The hwmon core counts from 0 instead:
for example temp1 is sensor 0 for jc42, tmp401, lm90 or adt7470.
With the 1 based id, a single-sensor PMBus device cannot use
#thermal-sensor-cells = <0>: thermal_of matches a phandle without
cells as id 0, and no PMBus sensor has id 0. That is why this patch
uses const 1.
No current DTS references a PMBus device from a thermal zone, and no
PMBus binding allows #thermal-sensor-cells yet.
Aligning PMBus on the hwmon core would mean:
drivers/hwmon/pmbus/pmbus_core.c
static struct pmbus_sensor *pmbus_add_sensor(struct pmbus_data *data,
...
if (class == PSC_TEMPERATURE && strcmp(type, "input") == 0)
- pmbus_thermal_add_sensor(data, sensor, seq);
+ pmbus_thermal_add_sensor(data, sensor, seq - 1);
return sensor;
}
If you agree, I will send it, with a v2 of this binding using
const: 0, since each device of mps,mpq8785.yaml has a
single temperature input. Otherwise, we should keep const 1.
Best regards,
Vincent
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] dt-bindings: hwmon: pmbus: mps,mpq8785: add #thermal-sensor-cells
2026-09-30 17:27 ` Vincent Jardin
@ 2026-09-30 22:24 ` Guenter Roeck
0 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2026-09-30 22:24 UTC (permalink / raw)
To: Vincent Jardin
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Charles Hsu,
linux-hwmon, devicetree, linux-kernel
On Wed, Sep 30, 2026 at 07:27:43PM +0200, Vincent Jardin wrote:
> Hi Guenter,
>
> On Wed, Sep 30, 2026 at 02:07:21PM +0000, sashiko-bot@kernel.org wrote:
> > [Severity: Medium]
> > Is it correct to set the cell count constraint to 1 for this hardware?
> >
> > The Devicetree specification generally mandates that single-sensor devices
> > use a cell count of 0, as no index is needed to identify the sensor. By
> > forcing this to 1, it appears we might be baking a Linux-specific driver
> > quirk (the PMBus core's internal 1-based index) into the OS-agnostic
> > hardware description ABI.
>
> M. Bot has a point, and it is a PMBus core question, so I would like
> your view before a v2 of this binding.
>
> Since the commit
> 3aa74796cfd0 ("hwmon: (pmbus) Register with thermal for PSC_TEMPERATURE")
> pmbus_core registers each temperature input using its hwmon index as the
> sensor id, so temp1 is sensor 1.
>
> The hwmon core counts from 0 instead:
> for example temp1 is sensor 0 for jc42, tmp401, lm90 or adt7470.
>
> With the 1 based id, a single-sensor PMBus device cannot use
> #thermal-sensor-cells = <0>: thermal_of matches a phandle without
> cells as id 0, and no PMBus sensor has id 0. That is why this patch
> uses const 1.
>
> No current DTS references a PMBus device from a thermal zone, and no
> PMBus binding allows #thermal-sensor-cells yet.
>
> Aligning PMBus on the hwmon core would mean:
>
> drivers/hwmon/pmbus/pmbus_core.c
> static struct pmbus_sensor *pmbus_add_sensor(struct pmbus_data *data,
> ...
> if (class == PSC_TEMPERATURE && strcmp(type, "input") == 0)
> - pmbus_thermal_add_sensor(data, sensor, seq);
> + pmbus_thermal_add_sensor(data, sensor, seq - 1);
>
> return sensor;
> }
>
>
> If you agree, I will send it, with a v2 of this binding using
> const: 0, since each device of mps,mpq8785.yaml has a
> single temperature input. Otherwise, we should keep const 1.
>
Yes, that is a bug. Please send a patch. I'd prefer the index
to be handled in the call to devm_thermal_of_zone_register(),
though, with an added comment explaining that the temperature sensor
index in the PMBus core starts with 1 and the thermal core expects
a 0-based index.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-09-30 22:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-30 13:56 [PATCH] dt-bindings: hwmon: pmbus: mps,mpq8785: add #thermal-sensor-cells Vincent Jardin
2026-09-30 13:56 ` Vincent Jardin via B4 Relay
2026-09-30 14:07 ` sashiko-bot
2026-09-30 17:27 ` Vincent Jardin
2026-09-30 22:24 ` Guenter Roeck
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.