Skip to contentSkip to conversation

thermal/drivers/tsens: register thermal zones as hwmon sensors

PATCH Applied Dmitry Baryshkov 3 participants 3 messages Jan 29, 2022 – Mar 8, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 thermal/drivers/tsens: register thermal zones as hwmon sensors

Register thermal zones as hwmon sensors to let userspace read CPU temperatures using standard hwmon interface.

---
 drivers/thermal/qcom/tsens.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/thermal/qcom/tsens.c +5 -0
index 99a8d9f3e03c..154d3cb19c88 100644
@@ -18,6 +18,7 @@
 #include <linux/regmap.h>
 #include <linux/slab.h>
 #include <linux/thermal.h>
+#include "../thermal_hwmon.h"
 #include "tsens.h"
 
 /**
@@ -1060,6 +1061,10 @@ static int tsens_register(struct tsens_priv *priv)
 		priv->sensor[i].tzd = tzd;
 		if (priv->ops->enable)
 			priv->ops->enable(priv, i);
+
+		if (devm_thermal_add_hwmon_sysfs(tzd))
+			dev_warn(priv->dev,
+				 "Failed to add hwmon sysfs attributes\n");
 	}
 
 	/* VER_0 require to set MIN and MAX THRESH
Signature · 1 line
2.34.1
#1 lore raw
Quoted 6 lines · Dmitry Baryshkov

Register thermal zones as hwmon sensors to let userspace read CPU temperatures using standard hwmon interface.

---

Applied, thanks

Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#2 lore raw
In reply to Dmitry Baryshkov
The following commit has been merged into the thermal/next branch of thermal:

The following commit has been merged into the thermal/next branch of thermal:

Commit-ID:     8556e19d4939fbdb15aee9391f035453c5b2255a
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//8556e19d4939fbdb15aee9391f035453c5b2255a
Author:        Dmitry Baryshkov <[email protected]>
AuthorDate:    Sat, 29 Jan 2022 21:07:50 +03:00
Committer:     Daniel Lezcano <[email protected]>
CommitterDate: Tue, 08 Mar 2022 21:26:08 +01:00

thermal/drivers/tsens: register thermal zones as hwmon sensors

Register thermal zones as hwmon sensors to let userspace read CPU temperatures using standard hwmon interface.

---
 drivers/thermal/qcom/tsens.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/thermal/qcom/tsens.c +5 -0
index 99a8d9f..154d3cb 100644
@@ -18,6 +18,7 @@
 #include <linux/regmap.h>
 #include <linux/slab.h>
 #include <linux/thermal.h>
+#include "../thermal_hwmon.h"
 #include "tsens.h"
 
 /**
@@ -1060,6 +1061,10 @@ static int tsens_register(struct tsens_priv *priv)
 		priv->sensor[i].tzd = tzd;
 		if (priv->ops->enable)
 			priv->ops->enable(priv, i);
+
+		if (devm_thermal_add_hwmon_sysfs(tzd))
+			dev_warn(priv->dev,
+				 "Failed to add hwmon sysfs attributes\n");
 	}
 
 	/* VER_0 require to set MIN and MAX THRESH