mediatek: copy patches-6.1 to patches-6.6
[openwrt/staging/981213.git] / target / linux / mediatek / patches-6.6 / 830-v6.4-26-thermal-drivers-mediatek-lvts_thermal-Register-therm.patch
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
5 zones as hwmon sensors
6
7 Register thermal zones as hwmon sensors to let userspace read
8 temperatures using standard hwmon interface.
9
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
13 ---
14 drivers/thermal/mediatek/lvts_thermal.c | 5 +++++
15 1 file changed, 5 insertions(+)
16
17 --- a/drivers/thermal/mediatek/lvts_thermal.c
18 +++ b/drivers/thermal/mediatek/lvts_thermal.c
19 @@ -19,6 +19,8 @@
20 #include <linux/thermal.h>
21 #include <dt-bindings/thermal/mediatek,lvts-thermal.h>
22
23 +#include "../thermal_hwmon.h"
24 +
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
29 return PTR_ERR(tz);
30 }
31
32 + if (devm_thermal_add_hwmon_sysfs(dev, tz))
33 + dev_warn(dev, "zone %d: Failed to add hwmon sysfs attributes\n", dt_id);
34 +
35 /*
36 * The thermal zone pointer will be needed in the
37 * interrupt handler, we store it in the sensor