diff mbox series

[v2] thermal/drivers/tsens: register thermal zones as hwmon sensors

Message ID 20220129180750.1882310-1-dmitry.baryshkov@linaro.org
State Accepted
Commit 8556e19d4939fbdb15aee9391f035453c5b2255a
Headers show
Series [v2] thermal/drivers/tsens: register thermal zones as hwmon sensors | expand

Commit Message

Dmitry Baryshkov Jan. 29, 2022, 6:07 p.m. UTC
Register thermal zones as hwmon sensors to let userspace read
CPU temperatures using standard hwmon interface.

Acked-by: Amit Kucheria <amitk@kernel.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/thermal/qcom/tsens.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Daniel Lezcano Jan. 29, 2022, 8:06 p.m. UTC | #1
On 29/01/2022 19:07, Dmitry Baryshkov wrote:
> Register thermal zones as hwmon sensors to let userspace read
> CPU temperatures using standard hwmon interface.
> 
> Acked-by: Amit Kucheria <amitk@kernel.org>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---

Applied, thanks
diff mbox series

Patch

diff --git a/drivers/thermal/qcom/tsens.c b/drivers/thermal/qcom/tsens.c
index 99a8d9f3e03c..154d3cb19c88 100644
--- a/drivers/thermal/qcom/tsens.c
+++ b/drivers/thermal/qcom/tsens.c
@@ -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