Skip to contentSkip to conversation

thermal: imx_sc_thermal: Add hwmon support

PATCH In review Anson Huang 2 participants 2 messages Mar 26, 2020 – Apr 2, 2020

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

PATCH 1/1 thermal: imx_sc_thermal: Add hwmon support

Expose i.MX SC thermal sensors as HWMON devices.

---
 drivers/thermal/imx_sc_thermal.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/thermal/imx_sc_thermal.c +4 -0
index a8723b1..b2b68c9 100644
@@ -14,6 +14,7 @@
 #include <linux/thermal.h>
 
 #include "thermal_core.h"
+#include "thermal_hwmon.h"
 
 #define IMX_SC_MISC_FUNC_GET_TEMP	13
 
@@ -115,6 +116,9 @@ static int imx_sc_thermal_probe(struct platform_device *pdev)
 			ret = PTR_ERR(sensor->tzd);
 			break;
 		}
+
+		if (devm_thermal_add_hwmon_sysfs(sensor->tzd))
+			dev_warn(&pdev->dev, "failed to add hwmon sysfs attributes\n");
 	}
 
 	of_node_put(sensor_np);
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Anson Huang

Expose i.MX SC thermal sensors as HWMON devices.

Quoted 29 lines
---
 drivers/thermal/imx_sc_thermal.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/thermal/imx_sc_thermal.c +4 -1
index a8723b1..b2b68c9 100644
@@ -14,6 +14,7 @@
 #include <linux/thermal.h>
 
 #include "thermal_core.h"
+#include "thermal_hwmon.h"
 
 #define IMX_SC_MISC_FUNC_GET_TEMP      13
 
@@ -115,6 +116,9 @@ static int imx_sc_thermal_probe(struct platform_device *pdev)
                        ret = PTR_ERR(sensor->tzd);
                        break;
                }
+
+               if (devm_thermal_add_hwmon_sysfs(sensor->tzd))
+                       dev_warn(&pdev->dev, "failed to add hwmon sysfs attributes\n");
        }
 
        of_node_put(sensor_np);
--

2.7.4