Skip to contentSkip to conversation

thermal: rockchip: enable hwmon

PATCH In review Chen-Yu Tsai 2 participants 3 messages Dec 17, 2019

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

PATCH 1/1 thermal: rockchip: enable hwmon

From: Chen-Yu Tsai <[email protected]>

By default of-based thermal driver do not have hwmon entries registered.

Do this explicitly so users can use standard hwmon interfaces and tools to read the temperature.

This is based on similar changes for bcm2835_thermal in commit d56c19d07e0b ("thermal: bcm2835: enable hwmon explicitly").

---
 drivers/thermal/rockchip_thermal.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/thermal/rockchip_thermal.c +7 -1
index 9ed8085bb792..d53ba7dabf16 100644
@@ -19,6 +19,8 @@
 #include <linux/mfd/syscon.h>
 #include <linux/pinctrl/consumer.h>
 
+#include "thermal_hwmon.h"
+
 /*
  * If the temperature over a period of time High,
  * the resulting TSHUT gave CRU module,let it reset the entire chip,
@@ -1210,7 +1212,11 @@ rockchip_thermal_register_sensor(struct platform_device *pdev,
 		return error;
 	}
 
-	return 0;
+	/* thermal_zone doesn't enable hwmon as default, enable it here */
+	sensor->tzd->tzp->no_hwmon = false;
+	error = thermal_add_hwmon_sysfs(sensor->tzd);
+
+	return error;
 }
 
 /**
Signature · 1 line
2.24.0
#1 lore raw

Hi Chen-Yu,

Quoted 9 lines · Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

By default of-based thermal driver do not have hwmon entries registered.

Do this explicitly so users can use standard hwmon interfaces and tools to read the temperature.

This is based on similar changes for bcm2835_thermal in commit d56c19d07e0b ("thermal: bcm2835: enable hwmon explicitly").

Thanks for submitting this patch, but it is duplicate with:

https://lore.kernel.org/linux-arm-kernel/[email protected]/

which I picked up.

-- Daniel

Quoted 32 lines
---
 drivers/thermal/rockchip_thermal.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/thermal/rockchip_thermal.c +7 -1
index 9ed8085bb792..d53ba7dabf16 100644
@@ -19,6 +19,8 @@
 #include <linux/mfd/syscon.h>
 #include <linux/pinctrl/consumer.h>
 
+#include "thermal_hwmon.h"
+
 /*
  * If the temperature over a period of time High,
  * the resulting TSHUT gave CRU module,let it reset the entire chip,
@@ -1210,7 +1212,11 @@ rockchip_thermal_register_sensor(struct platform_device *pdev,
 		return error;
 	}
 
-	return 0;
+	/* thermal_zone doesn't enable hwmon as default, enable it here */
+	sensor->tzd->tzp->no_hwmon = false;
+	error = thermal_add_hwmon_sysfs(sensor->tzd);
+
+	return error;
 }
 
 /**
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
Quoted 12 lines · Daniel Lezcano

Hi Chen-Yu,

Quoted 7 lines · Chen-Yu Tsai

From: Chen-Yu Tsai <[email protected]>

By default of-based thermal driver do not have hwmon entries registered.

Do this explicitly so users can use standard hwmon interfaces and tools to read the temperature.

Quoted 8 lines
Quoted 2 lines

This is based on similar changes for bcm2835_thermal in commit d56c19d07e0b ("thermal: bcm2835: enable hwmon explicitly").

Thanks for submitting this patch, but it is duplicate with:

https://lore.kernel.org/linux-arm-kernel/[email protected]/

which I picked up.

No problem. Thanks for the pointer.

ChenYu

Quoted 44 lines

-- Daniel

Quoted 22 lines
---
 drivers/thermal/rockchip_thermal.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/thermal/rockchip_thermal.c +2 -0
index 9ed8085bb792..d53ba7dabf16 100644
@@ -19,6 +19,8 @@
 #include <linux/mfd/syscon.h>
 #include <linux/pinctrl/consumer.h>
 
+#include "thermal_hwmon.h"
+
 /*
  * If the temperature over a period of time High,
  * the resulting TSHUT gave CRU module,let it reset the entire chip,
@@ -1210,7 +1212,11 @@ rockchip_thermal_register_sensor(struct platform_device *pdev,
              return error;
      }

drivers/thermal/rockchip_thermal.c rockchip_thermal_register_sensor(struct platform_device *pdev, · line 1222

Quoted 10 lines
drivers/thermal/rockchip_thermal.c +5 -1
 
-     return 0;
+     /* thermal_zone doesn't enable hwmon as default, enable it here */
+     sensor->tzd->tzp->no_hwmon = false;
+     error = thermal_add_hwmon_sysfs(sensor->tzd);
+
+     return error;
 }
 
 /**

--
<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