Re: [PATCH v3 2/4] hwmon: (lm90) Use hwmon_notify_event()

From: Guenter Roeck
Date: Mon Feb 21 2022 - 13:40:38 EST


On 2/21/22 08:22, Jon Hunter wrote:

On 21/02/2022 16:16, Jon Hunter wrote:

On 21/02/2022 16:02, Guenter Roeck wrote:

...

The platform I see this on does use device-tree and it does have a node for the ti,tmp451 device which uses the lm90 device. This platform uses the device-tree source arch/arm64/boot/dts/nvidia/tegra194-p2972-0000.dts and the tmp451 node is in arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi.


Interesting. It appears that the call to devm_thermal_zone_of_sensor_register()
in the hwmon core nevertheless returns -ENODEV which is not handled properly
in the hwmon core. I can see a number of reasons for this to happen:
- there is no devicetree node for the lm90 device
- there is no thermal-zones devicetree node
- there is no thermal zone entry in the thermal-zones node which matches
   the sensor


So we definitely have the node for the lm90 device and a thermal-zones node, but I do not see a thermal-sensor node. Maybe this is what we are missing?

Actually, that is not true. We do have thermal-sensor nodes in arch/arm64/boot/dts/nvidia/tegra194.dtsi.


There is probably a zone to sensor id mismatch. hwmon sends the sensor index
as sensor_id to the thermal subsystem. Those sensor IDs would be 0, 1, and
possibly 2 for the lm90 driver. Assuming this should match the thermal-sensors
values in arch/arm64/boot/dts/nvidia/tegra194.dtsi, those start with 2,
so there would be a likely mismatch. Also, all those dtsi entries match
against pbmp/thermal, not against the lm90 sensor(s).

Thanks,
Guenter