Re: [PATCH v1] hwmon: drivetemp: support to be a platform driver for thermal_of

From: Guenter Roeck
Date: Wed Mar 15 2023 - 10:17:02 EST


On 3/15/23 05:16, phinex wrote:
Support thermal zone so that we can just rely on dts to describe a
thermal zone and do the cooling operations.

You can define a comptible string "drivetemp,hdd-sensors" to enable
this, such as

sata_port0: sata-port@0 {
compatible = "drivetemp,hdd-sensors";
#thermal-sensor-cells = <0>;
}

Then define a thermal with this sensor to get it work.

               hdd_thermal: hdd-thermal {
thermal-sensors = <&sata_port0>;
}

In most of the SoC systems, using dts to handle cooling is common.
This can eliminate the usage of user space application to check
the value exported in hwmon and then through sysfs to cooling.

Signed-off-by: phinex <phinex@xxxxxxxxxxx>


The driver registers drivetemp instances with the hwmon core using
HWMON_C_REGISTER_TZ. That means there should already be a thermal zone
for each instance. If that doesn't work, please find out why and fix it
instead of replicating what the hwmon core already is supposed to be
doing.

Guenter