[PATCH] thermal: imx8mm: register with hwmon subsystem

Lucas Stach l.stach at pengutronix.de
Fri Jul 22 09:58:15 PDT 2022


Provide standard sensor monitoring via the HWMON subsystem by
registering the sensors with hwmon when CONFIG_THERMAL_HWMON is
enabled.

Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
---
 drivers/thermal/imx8mm_thermal.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/thermal/imx8mm_thermal.c b/drivers/thermal/imx8mm_thermal.c
index af666bd9e8d4..74120edbbdfd 100644
--- a/drivers/thermal/imx8mm_thermal.c
+++ b/drivers/thermal/imx8mm_thermal.c
@@ -16,6 +16,7 @@
 #include <linux/thermal.h>
 
 #include "thermal_core.h"
+#include "thermal_hwmon.h"
 
 #define TER			0x0	/* TMU enable */
 #define TPS			0x4
@@ -176,6 +177,10 @@ static int imx8mm_tmu_probe(struct platform_device *pdev)
 			goto disable_clk;
 		}
 		tmu->sensors[i].hw_id = i;
+
+		if (devm_thermal_add_hwmon_sysfs(tmu->sensors[i].tzd))
+			dev_warn(&pdev->dev,
+				 "Failed to add hwmon sysfs attributes\n");
 	}
 
 	platform_set_drvdata(pdev, tmu);
-- 
2.30.2




More information about the linux-arm-kernel mailing list