diff mbox series

[thermal:,thermal/next] thermal/drivers/k3: Add hwmon support

Message ID 165296426176.4207.15051030762623208961.tip-bot2@tip-bot2
State New
Headers show
Series [thermal:,thermal/next] thermal/drivers/k3: Add hwmon support | expand

Commit Message

thermal-bot for Julien Panis May 19, 2022, 12:44 p.m. UTC
The following commit has been merged into the thermal/next branch of thermal:

Commit-ID:     9e5f5f15fef5efd6847b8802e509b67fce72e2fb
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//9e5f5f15fef5efd6847b8802e509b67fce72e2fb
Author:        Massimiliano Minella <massimiliano.minella@gmail.com>
AuthorDate:    Fri, 01 Apr 2022 17:13:51 +02:00
Committer:     Daniel Lezcano <daniel.lezcano@linaro.org>
CommitterDate: Thu, 19 May 2022 12:11:51 +02:00

thermal/drivers/k3: Add hwmon support

Expose the thermal sensors on K3 AM654 as hwmon devices, so that
temperatures could be read using lm-sensors.

Signed-off-by: Massimiliano Minella <massimiliano.minella@gmail.com>
Link: https://lore.kernel.org/r/20220401151656.913166-1-massimiliano.minella@se.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/thermal/k3_bandgap.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/drivers/thermal/k3_bandgap.c b/drivers/thermal/k3_bandgap.c
index 35f41e8..5d0b3ff 100644
--- a/drivers/thermal/k3_bandgap.c
+++ b/drivers/thermal/k3_bandgap.c
@@ -16,6 +16,8 @@ 
 #include <linux/thermal.h>
 #include <linux/types.h>
 
+#include "thermal_hwmon.h"
+
 #define K3_VTM_DEVINFO_PWR0_OFFSET		0x4
 #define K3_VTM_DEVINFO_PWR0_TEMPSENS_CT_MASK	0xf0
 #define K3_VTM_TMPSENS0_CTRL_OFFSET	0x80
@@ -219,6 +221,9 @@  static int k3_bandgap_probe(struct platform_device *pdev)
 			ret = PTR_ERR(data[id].tzd);
 			goto err_alloc;
 		}
+
+		if (devm_thermal_add_hwmon_sysfs(data[id].tzd))
+			dev_warn(dev, "Failed to add hwmon sysfs attributes\n");
 	}
 
 	platform_set_drvdata(pdev, bgp);