Skip to contentSkip to conversation

thermal: sun8i: Add hwmon support

PATCH Applied Yangtao Li 3 participants 7 messages Dec 28, 2019 – Jan 12, 2020

Subsystems (3)
lore
Share & tools
lore

Yangtao Li

author maintainer
#0 lore raw

PATCH 1/1 thermal: sun8i: Add hwmon support

Expose sun8i thermal as a HWMON device.

---
 drivers/thermal/sun8i_thermal.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/thermal/sun8i_thermal.c +6 -0
index 23a5f4aa4be4..619e75cb41b0 100644
@@ -20,6 +20,8 @@
 #include <linux/slab.h>
 #include <linux/thermal.h>
 
+#include "thermal_hwmon.h"
+
 #define MAX_SENSOR_NUM	4
 
 #define FT_TEMP_MASK				GENMASK(11, 0)
@@ -477,6 +479,10 @@ static int sun8i_ths_register(struct ths_device *tmdev)
 							     &ths_ops);
 		if (IS_ERR(tmdev->sensor[i].tzd))
 			return PTR_ERR(tmdev->sensor[i].tzd);
+
+		if (devm_thermal_add_hwmon_sysfs(tmdev->sensor[i].tzd))
+			dev_warn(tmdev->dev,
+				 "Failed to add hwmon sysfs attributes\n");
 	}
 
 	return 0;
Signature · 1 line
2.17.1
#1 lore raw
Quoted 22 lines · Yangtao Li

Expose sun8i thermal as a HWMON device.

---
 drivers/thermal/sun8i_thermal.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/thermal/sun8i_thermal.c +2 -0
index 23a5f4aa4be4..619e75cb41b0 100644
@@ -20,6 +20,8 @@
 #include <linux/slab.h>
 #include <linux/thermal.h>
 
+#include "thermal_hwmon.h"
+
 #define MAX_SENSOR_NUM 4
 
 #define FT_TEMP_MASK                           GENMASK(11, 0)

drivers/thermal/sun8i_thermal.c static int sun8i_ths_register(struct ths_device *tmdev) · line 485

Quoted 7 lines
drivers/thermal/sun8i_thermal.c +4 -0
@@ -477,6 +479,10 @@ static int sun8i_ths_register(struct ths_device *tmdev)
                                                             &ths_ops);
                if (IS_ERR(tmdev->sensor[i].tzd))
                        return PTR_ERR(tmdev->sensor[i].tzd);
+
+               if (devm_thermal_add_hwmon_sysfs(tmdev->sensor[i].tzd))
+                       dev_warn(tmdev->dev,
+                                "Failed to add hwmon sysfs attributes\n");

Maybe you want a hard failure instead?

ChenYu

Quoted 6 lines
drivers/thermal/sun8i_thermal.c +0 -1
        }
 
        return 0;
--

2.17.1

author maintainer
#2 lore raw

HI Chen-Yu.

Quoted 22 lines · Chen-Yu Tsai
Quoted 20 lines · Yangtao Li

Expose sun8i thermal as a HWMON device.

---
 drivers/thermal/sun8i_thermal.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/thermal/sun8i_thermal.c +2 -0
index 23a5f4aa4be4..619e75cb41b0 100644
@@ -20,6 +20,8 @@
 #include <linux/slab.h>
 #include <linux/thermal.h>
 
+#include "thermal_hwmon.h"
+
 #define MAX_SENSOR_NUM 4
 
Quoted 11 lines

drivers/thermal/sun8i_thermal.c static int sun8i_ths_register(struct ths_device *tmdev) · line 485

Quoted 9 lines
drivers/thermal/sun8i_thermal.c +4 -0
 #define FT_TEMP_MASK                           GENMASK(11, 0)
@@ -477,6 +479,10 @@ static int sun8i_ths_register(struct ths_device *tmdev)
                                                             &ths_ops);
                if (IS_ERR(tmdev->sensor[i].tzd))
                        return PTR_ERR(tmdev->sensor[i].tzd);
+
+               if (devm_thermal_add_hwmon_sysfs(tmdev->sensor[i].tzd))
+                       dev_warn(tmdev->dev,
+                                "Failed to add hwmon sysfs attributes\n");

Maybe you want a hard failure instead?

I don't quite understand what you mean.
What do you think should be done?

MBR,
Yangtao

Quoted 9 lines

ChenYu

Quoted 6 lines
drivers/thermal/sun8i_thermal.c +0 -1
        }
 
        return 0;
--

2.17.1

#3 lore raw
Quoted 38 lines · Frank Lee

HI Chen-Yu.

Quoted 22 lines · Chen-Yu Tsai
Quoted 20 lines · Yangtao Li

Expose sun8i thermal as a HWMON device.

---
 drivers/thermal/sun8i_thermal.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/thermal/sun8i_thermal.c +2 -0
index 23a5f4aa4be4..619e75cb41b0 100644
@@ -20,6 +20,8 @@
 #include <linux/slab.h>
 #include <linux/thermal.h>
 
+#include "thermal_hwmon.h"
+
 #define MAX_SENSOR_NUM 4
 
Quoted 11 lines

drivers/thermal/sun8i_thermal.c static int sun8i_ths_register(struct ths_device *tmdev) · line 485

Quoted 9 lines
drivers/thermal/sun8i_thermal.c +4 -0
 #define FT_TEMP_MASK                           GENMASK(11, 0)
@@ -477,6 +479,10 @@ static int sun8i_ths_register(struct ths_device *tmdev)
                                                             &ths_ops);
                if (IS_ERR(tmdev->sensor[i].tzd))
                        return PTR_ERR(tmdev->sensor[i].tzd);
+
+               if (devm_thermal_add_hwmon_sysfs(tmdev->sensor[i].tzd))
+                       dev_warn(tmdev->dev,
+                                "Failed to add hwmon sysfs attributes\n");

Maybe you want a hard failure instead?

Quoted 2 lines

I don't quite understand what you mean.
What do you think should be done?

Return an error instead of just printing a warning.

ChenYu

Quoted 12 lines

MBR,
Yangtao

Quoted 9 lines

ChenYu

Quoted 6 lines
drivers/thermal/sun8i_thermal.c +0 -1
        }
 
        return 0;
--

2.17.1

author maintainer
#4 lore raw
Quoted 40 lines · Chen-Yu Tsai
Quoted 38 lines · Frank Lee

HI Chen-Yu.

Quoted 33 lines · Chen-Yu Tsai
Quoted 22 lines · Yangtao Li

Expose sun8i thermal as a HWMON device.

---
 drivers/thermal/sun8i_thermal.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/thermal/sun8i_thermal.c +2 -0
index 23a5f4aa4be4..619e75cb41b0 100644
@@ -20,6 +20,8 @@
 #include <linux/slab.h>
 #include <linux/thermal.h>
 
+#include "thermal_hwmon.h"
+
 #define MAX_SENSOR_NUM 4
 
 #define FT_TEMP_MASK                           GENMASK(11, 0)

drivers/thermal/sun8i_thermal.c static int sun8i_ths_register(struct ths_device *tmdev) · line 485

Quoted 7 lines
drivers/thermal/sun8i_thermal.c +4 -0
@@ -477,6 +479,10 @@ static int sun8i_ths_register(struct ths_device *tmdev)
                                                             &ths_ops);
                if (IS_ERR(tmdev->sensor[i].tzd))
                        return PTR_ERR(tmdev->sensor[i].tzd);
+
+               if (devm_thermal_add_hwmon_sysfs(tmdev->sensor[i].tzd))
+                       dev_warn(tmdev->dev,
+                                "Failed to add hwmon sysfs attributes\n");

Maybe you want a hard failure instead?

Quoted 4 lines
Quoted 2 lines

I don't quite understand what you mean.
What do you think should be done?

Return an error instead of just printing a warning.

Sometimes, even if hwmon fails to add, it can still work as a thermal driver. At this time, I don't really want to interrupt the registration of the thermal driver.

Anyone else's opinion here?

Yours,
Ynagtao

Quoted 15 lines

ChenYu

Quoted 12 lines

MBR,
Yangtao

Quoted 9 lines

ChenYu

Quoted 6 lines
drivers/thermal/sun8i_thermal.c +0 -1
        }
 
        return 0;
--

2.17.1

author maintainer
#5 lore raw

HI Daniel:

Quoted 45 lines · Frank Lee
Quoted 43 lines · Chen-Yu Tsai
Quoted 40 lines · Frank Lee

HI Chen-Yu.

Quoted 22 lines · Chen-Yu Tsai
Quoted 20 lines · Yangtao Li

Expose sun8i thermal as a HWMON device.

---
 drivers/thermal/sun8i_thermal.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/thermal/sun8i_thermal.c +2 -0
index 23a5f4aa4be4..619e75cb41b0 100644
@@ -20,6 +20,8 @@
 #include <linux/slab.h>
 #include <linux/thermal.h>
 
+#include "thermal_hwmon.h"
+
 #define MAX_SENSOR_NUM 4
 
Quoted 11 lines

drivers/thermal/sun8i_thermal.c static int sun8i_ths_register(struct ths_device *tmdev) · line 485

Quoted 9 lines
drivers/thermal/sun8i_thermal.c +4 -0
 #define FT_TEMP_MASK                           GENMASK(11, 0)
@@ -477,6 +479,10 @@ static int sun8i_ths_register(struct ths_device *tmdev)
                                                             &ths_ops);
                if (IS_ERR(tmdev->sensor[i].tzd))
                        return PTR_ERR(tmdev->sensor[i].tzd);
+
+               if (devm_thermal_add_hwmon_sysfs(tmdev->sensor[i].tzd))
+                       dev_warn(tmdev->dev,
+                                "Failed to add hwmon sysfs attributes\n");

Maybe you want a hard failure instead?

I don't quite understand what you mean.
What do you think should be done?

Quoted 8 lines
Quoted 1 line

Return an error instead of just printing a warning.

Sometimes, even if hwmon fails to add, it can still work as a thermal driver. At this time, I don't really want to interrupt the registration of the thermal driver.

Anyone else's opinion here?

What's your point? Can you choose this patch?

MBR,
Yangtao

#6 lore raw
Quoted 50 lines · Frank Lee

HI Daniel:

Quoted 47 lines · Frank Lee
Quoted 44 lines · Chen-Yu Tsai
Quoted 38 lines · Frank Lee

HI Chen-Yu.

Quoted 22 lines · Chen-Yu Tsai
Quoted 20 lines · Yangtao Li

Expose sun8i thermal as a HWMON device.

---
 drivers/thermal/sun8i_thermal.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/thermal/sun8i_thermal.c +2 -0
index 23a5f4aa4be4..619e75cb41b0 100644
@@ -20,6 +20,8 @@
 #include <linux/slab.h>
 #include <linux/thermal.h>
 
+#include "thermal_hwmon.h"
+
 #define MAX_SENSOR_NUM 4
 
Quoted 11 lines

drivers/thermal/sun8i_thermal.c static int sun8i_ths_register(struct ths_device *tmdev) · line 485

Quoted 9 lines
drivers/thermal/sun8i_thermal.c +4 -0
 #define FT_TEMP_MASK                           GENMASK(11, 0)
@@ -477,6 +479,10 @@ static int sun8i_ths_register(struct ths_device *tmdev)
                                                             &ths_ops);
                if (IS_ERR(tmdev->sensor[i].tzd))
                        return PTR_ERR(tmdev->sensor[i].tzd);
+
+               if (devm_thermal_add_hwmon_sysfs(tmdev->sensor[i].tzd))
+                       dev_warn(tmdev->dev,
+                                "Failed to add hwmon sysfs attributes\n");

Maybe you want a hard failure instead?

Quoted 2 lines

I don't quite understand what you mean.
What do you think should be done?

Return an error instead of just printing a warning.

Quoted 8 lines
Quoted 6 lines

Sometimes, even if hwmon fails to add, it can still work as a thermal driver. At this time, I don't really want to interrupt the registration of the thermal driver.

Anyone else's opinion here?

What's your point? Can you choose this patch?

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