Linux thermal framework: Why does devm_thermal_of_zone_register() create two thermal zones for a single DT thermal zone?

I'm adding thermal framework support to the Linux lm75 hwmon driver (TMP100 sensors) on an embedded Linux system.

I added a thermal zone in my device tree:

The sensor node is:

In the modified lm75 driver I register the sensor with:

The thermal zone appears to work i get the temperature and all, however, I only have one thermal zone in the DT, but Linux creates two thermal zones:

both give :

Both thermal zones report the same type and the same temperature value.

I currently have only a single TMP100 sensor physically connected and only one thermal zone defined in the device tree. Prior to adding the thermal-zone node to the DT and calling devm_thermal_of_zone_register() from the driver, no thermal zones appeared under /sys/class/thermal/.

Relevant output:

From my understanding, there should be a single thermal zone corresponding to the DT node, so I am trying to understand why two thermal zones are being created. so my main question is

1. Why does registering a single sensor and defining a single DT
thermal zone result in two thermal zones appearing in sysfs, both
named zone0-thermal?

2. Am I using the thermal framework incorrectly, or is
devm_thermal_of_zone_register() expected to create an additional
thermal zone instance?

3. Is devm_thermal_of_zone_register() the correct API for this purpose, or should a different registration mechanism be used?

Additional context:

• Kernel: Xilinx Linux 6.6.x

• Platform: Zynq UltraScale+ MPSoC on a custom carrier board

• I noticed that many in-tree drivers in this kernel use
devm_thermal_of_zone_register(), so I followed that approach.

• Most documentation and examples I found reference
devm_thermal_zone_of_sensor_register(), but that API does not appear
to be available in this kernel tree.

添加评论
点赞收藏
点踩分享查看原文
评论
?
参与讨论