thermal: sun8i: Add hwmon support

Expose sun8i thermal as a HWMON device.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20191228171904.24618-1-tiny.windzz@gmail.com
This commit is contained in:
Yangtao Li 2019-12-28 17:19:04 +00:00 committed by Daniel Lezcano
parent 291292cddc
commit 85f0ad2213

View File

@ -20,6 +20,8 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/thermal.h> #include <linux/thermal.h>
#include "thermal_hwmon.h"
#define MAX_SENSOR_NUM 4 #define MAX_SENSOR_NUM 4
#define FT_TEMP_MASK GENMASK(11, 0) #define FT_TEMP_MASK GENMASK(11, 0)
@ -471,6 +473,10 @@ static int sun8i_ths_register(struct ths_device *tmdev)
&ths_ops); &ths_ops);
if (IS_ERR(tmdev->sensor[i].tzd)) if (IS_ERR(tmdev->sensor[i].tzd))
return PTR_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; return 0;