1 From 496f4b08981d8a788ad5a2073fa1c65a2af1862b Mon Sep 17 00:00:00 2001
2 From: Chen-Yu Tsai <wenst@chromium.org>
3 Date: Tue, 13 Jun 2023 17:13:16 +0800
4 Subject: [PATCH 22/42] thermal/drivers/mediatek/lvts_thermal: Register thermal
7 Register thermal zones as hwmon sensors to let userspace read
8 temperatures using standard hwmon interface.
10 Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
11 Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
12 Link: https://lore.kernel.org/r/20230613091317.1691247-1-wenst@chromium.org
14 drivers/thermal/mediatek/lvts_thermal.c | 5 +++++
15 1 file changed, 5 insertions(+)
17 --- a/drivers/thermal/mediatek/lvts_thermal.c
18 +++ b/drivers/thermal/mediatek/lvts_thermal.c
20 #include <linux/thermal.h>
21 #include <dt-bindings/thermal/mediatek,lvts-thermal.h>
23 +#include "../thermal_hwmon.h"
25 #define LVTS_MONCTL0(__base) (__base + 0x0000)
26 #define LVTS_MONCTL1(__base) (__base + 0x0004)
27 #define LVTS_MONCTL2(__base) (__base + 0x0008)
28 @@ -996,6 +998,9 @@ static int lvts_ctrl_start(struct device
32 + if (devm_thermal_add_hwmon_sysfs(dev, tz))
33 + dev_warn(dev, "zone %d: Failed to add hwmon sysfs attributes\n", dt_id);
36 * The thermal zone pointer will be needed in the
37 * interrupt handler, we store it in the sensor