drivers/thermal/ti-soc-thermal: Add hwmon support

Expose ti-soc-thermal thermal sensors as HWMON devices.

  # sensors
  cpu_thermal-virtual-0
  Adapter: Virtual device
  temp1:        +54.2 C  (crit = +105.0 C)

  dspeve_thermal-virtual-0
  Adapter: Virtual device
  temp1:        +51.4 C  (crit = +105.0 C)

  gpu_thermal-virtual-0
  Adapter: Virtual device
  temp1:        +54.2 C  (crit = +105.0 C)

  iva_thermal-virtual-0
  Adapter: Virtual device
  temp1:        +54.6 C  (crit = +105.0 C)

  core_thermal-virtual-0
  Adapter: Virtual device
  temp1:        +52.6 C  (crit = +105.0 C)

Similar to imx_sc_thermal d2bc4dd91d.

No need to take care of thermal_remove_hwmon_sysfs() since
devm_thermal_add_hwmon_sysfs() (a wrapper around devres) is
used. See c7fc403e40.

Signed-off-by: Romain Naour <romain.naour@smile.fr>
Link: https://lore.kernel.org/r/20220218104725.2718904-1-romain.naour@smile.fr
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
This commit is contained in:
Romain Naour 2022-02-18 11:47:25 +01:00 committed by Daniel Lezcano
parent e8ec6bb302
commit 3a9abd6cec

View File

@ -21,6 +21,7 @@
#include "ti-thermal.h" #include "ti-thermal.h"
#include "ti-bandgap.h" #include "ti-bandgap.h"
#include "../thermal_hwmon.h"
/* common data structures */ /* common data structures */
struct ti_thermal_data { struct ti_thermal_data {
@ -189,6 +190,9 @@ int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id,
ti_bandgap_set_sensor_data(bgp, id, data); ti_bandgap_set_sensor_data(bgp, id, data);
ti_bandgap_write_update_interval(bgp, data->sensor_id, interval); ti_bandgap_write_update_interval(bgp, data->sensor_id, interval);
if (devm_thermal_add_hwmon_sysfs(data->ti_thermal))
dev_warn(bgp->dev, "failed to add hwmon sysfs attributes\n");
return 0; return 0;
} }