[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20230314093213.2450396-1-wenst@chromium.org>
Date: Tue, 14 Mar 2023 17:32:13 +0800
From: Chen-Yu Tsai <wenst@...omium.org>
To: "Rafael J. Wysocki" <rafael@...nel.org>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Amit Kucheria <amitk@...nel.org>,
Zhang Rui <rui.zhang@...el.com>
Cc: Chen-Yu Tsai <wenst@...omium.org>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>,
Balsam CHIHI <bchihi@...libre.com>, linux-pm@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH] thermal/drivers/mediatek/lvts_thermal: Register thermal zones as hwmon sensors
Register thermal zones as hwmon sensors to let userspace read
temperatures using standard hwmon interface.
Signed-off-by: Chen-Yu Tsai <wenst@...omium.org>
---
drivers/thermal/mediatek/lvts_thermal.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
index 0557d1c61b9e..15f317c42718 100644
--- a/drivers/thermal/mediatek/lvts_thermal.c
+++ b/drivers/thermal/mediatek/lvts_thermal.c
@@ -19,6 +19,8 @@
#include <linux/thermal.h>
#include <dt-bindings/thermal/mediatek,lvts-thermal.h>
+#include "../thermal_hwmon.h"
+
#define LVTS_MONCTL0(__base) (__base + 0x0000)
#define LVTS_MONCTL1(__base) (__base + 0x0004)
#define LVTS_MONCTL2(__base) (__base + 0x0008)
@@ -996,6 +998,9 @@ static int lvts_ctrl_start(struct device *dev, struct lvts_ctrl *lvts_ctrl)
return PTR_ERR(tz);
}
+ if (devm_thermal_add_hwmon_sysfs(dev, chip->tz_dev))
+ dev_warn(dev, "zone %d: Failed to add hwmon sysfs attributes\n", dt_id);
+
/*
* The thermal zone pointer will be needed in the
* interrupt handler, we store it in the sensor
--
2.40.0.rc1.284.g88254d51c5-goog
Powered by blists - more mailing lists