[PATCH 3/3] thermal/drivers/mediatek: Add GPUEB thermal driver

Alexandre Mergnat amergnat at baylibre.com
Mon Nov 30 06:19:33 PST 2026


Add a driver for the auxiliary device that the mtk-mfg power domain
driver creates on MT8196. It registers the GPU temperature that the
GPUEB reports as a thermal sensor, so that a thermal zone can monitor
the GPU.

The auxiliary device shares the device tree node of the gpufreq device,
so a thermal zone selects this sensor by referring to that node.

Signed-off-by: Alexandre Mergnat <amergnat at baylibre.com>
---
 drivers/thermal/mediatek/Kconfig         |  9 ++++++
 drivers/thermal/mediatek/Makefile        |  1 +
 drivers/thermal/mediatek/gpueb_thermal.c | 52 ++++++++++++++++++++++++++++++++
 3 files changed, 62 insertions(+)

diff --git a/drivers/thermal/mediatek/Kconfig b/drivers/thermal/mediatek/Kconfig
index d82c86d9be56..a721b75d0790 100644
--- a/drivers/thermal/mediatek/Kconfig
+++ b/drivers/thermal/mediatek/Kconfig
@@ -34,4 +34,13 @@ config MTK_LVTS_THERMAL_DEBUGFS
        help
          Enable this option to debug the internals of the device driver.
 
+config MTK_GPUEB_THERMAL
+	tristate "GPUEB GPU temperature driver for MediaTek SoCs"
+	depends on MTK_MFG_PM_DOMAIN
+	help
+	  Enable this option if you want to get GPU temperature
+	  information for MediaTek SoCs such as the MT8196.
+	  The temperature is reported by the GPUEB, the microcontroller
+	  that manages the GPU power and frequency.
+
 endif
diff --git a/drivers/thermal/mediatek/Makefile b/drivers/thermal/mediatek/Makefile
index 1c6daa1e644b..3ec5295e8514 100644
--- a/drivers/thermal/mediatek/Makefile
+++ b/drivers/thermal/mediatek/Makefile
@@ -1,2 +1,3 @@
 obj-$(CONFIG_MTK_SOC_THERMAL)	+= auxadc_thermal.o
 obj-$(CONFIG_MTK_LVTS_THERMAL)	+= lvts_thermal.o
+obj-$(CONFIG_MTK_GPUEB_THERMAL)	+= gpueb_thermal.o
diff --git a/drivers/thermal/mediatek/gpueb_thermal.c b/drivers/thermal/mediatek/gpueb_thermal.c
new file mode 100644
index 000000000000..f63b5751a0c0
--- /dev/null
+++ b/drivers/thermal/mediatek/gpueb_thermal.c
@@ -0,0 +1,52 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2026 BayLibre, SAS
+ */
+
+#include <linux/auxiliary_bus.h>
+#include <linux/err.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+#include <linux/soc/mediatek/mtk-mfg.h>
+#include <linux/thermal.h>
+
+static int gpueb_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
+{
+	/* GPU off: -ENODATA would get the zone disabled by the thermal core */
+	if (mtk_mfg_get_temp(thermal_zone_device_priv(tz), temp))
+		*temp = THERMAL_TEMP_INVALID;
+
+	return 0;
+}
+
+static const struct thermal_zone_device_ops gpueb_thermal_ops = {
+	.get_temp = gpueb_thermal_get_temp,
+};
+
+static int gpueb_thermal_probe(struct auxiliary_device *adev,
+			       const struct auxiliary_device_id *id)
+{
+	struct thermal_zone_device *tz;
+
+	tz = devm_thermal_of_zone_register(&adev->dev, 0, adev,
+					   &gpueb_thermal_ops);
+
+	return PTR_ERR_OR_ZERO(tz);
+}
+
+static const struct auxiliary_device_id gpueb_thermal_id_table[] = {
+	{ .name = "mtk_mfg_pmdomain.thermal" },
+	{ }
+};
+MODULE_DEVICE_TABLE(auxiliary, gpueb_thermal_id_table);
+
+static struct auxiliary_driver gpueb_thermal_driver = {
+	.id_table = gpueb_thermal_id_table,
+	.probe = gpueb_thermal_probe,
+};
+module_auxiliary_driver(gpueb_thermal_driver);
+
+MODULE_AUTHOR("Alexandre Mergnat <amergnat at baylibre.com>");
+MODULE_DESCRIPTION("MediaTek GPUEB thermal sensor driver");
+MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS("MTK_MFG_PM_DOMAIN");

-- 
2.43.0




More information about the linux-arm-kernel mailing list