From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.49 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796048386; b=2aGFJ0HUFhxNzwtoWXic89HLEIPS7GWdzmf80AZ9AfVxrQBzSfRlXaz/PVKR9WKnpwW+ xiH4cUFsJXbfb3bedShrbZffn/kXeHqjpx2j48LesIGOmeG/Z6VS6BcJH8I99MgSPSE8w HIzwmvzRIoU24VhNQ77RXw4PlLhsbrYGKrrxEq75vPo/Pa7fxHotQerRd4wuZgAhDRQGA iSGEmxA440GgrUkwKiK2CKPT+WsHh+qb5wFygmDC4OM4zkK8lCyzrbNJrC96jZKBB5oh5 Tu8S786LFmr2cEj1gJG+Wg3nyGkCEteX5TiYU2TmGJZ4Hs5wqY8VFaidjvDNPxo1S1w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796048386; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:Date:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer; bh=VFZS8NaaLgYryUwmL7kHDe5z8C7d8BX2ObN93iatOTU=; b=3+8Kg4ALA7jahe4q+C/oEoHKUQ4EdA5AGmoXo0LMhbh4B/md2g/2oG9ZQDfuWeAPSxP0 p2jyq0eQ2RoxIDESlOeBsqw7zX7EEJyl+SJY5IVGVMhTjTID0ZdwPEyKC8MVDiS9ekcbE MkZrpYdQhmyWbY7WsSr5N9mokiofQ3IDcF0lKOebiCQV1rOLl+EFvJGocr/XQckARokdS 7sw8U+k3STR8zgL8tAXnvmeanVzrxf3TkZKQKMyfWogZPz+ddeLOa9aiMPDFjC/8eDrcv jxxGgHRvJ50u3vDWz+MPnyMRgPScEV/2XyiXszNwBgnAFtHsJepb+7E4SZFXoAerIbA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b="Gu/lEqBL"; arc=none smtp.remote-ip=209.85.128.49 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7109D60A2602 for ; Mon, 30 Nov 2026 14:19:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7109D60A2602 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre.com header.i=@baylibre.com header.a=rsa-sha256 header.s=google header.b=Gu/lEqBL Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4a207b02a2cso75340785e9.1 for ; Mon, 30 Nov 2026 06:19:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1796048385; x=1796653185; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=VFZS8NaaLgYryUwmL7kHDe5z8C7d8BX2ObN93iatOTU=; b=Gu/lEqBLv5IaH/x0lTFOGJaVTiRFObjSOa1ABvr40jVlCBK2J0lsrmhQXsoRCivpJi IcKHjPwS9s35BhVwz9EvuY87G3qxiX5Rs8fcabozSoH9WIbS2oglNQK/OXPOc/e+uO9e FCJq3JJ/X+g1hOBdcAzluWibAjychnGbAVlAtdVa32gJOXU4LGJaqRMp6UJXGq7oN/dW gXIFglciyqjQl5spDOy+r7P8dvu6mjJvteCQe09K/wPp2E4fn3OnmEaRNt9JAgXGdWq3 leJVEIlbFcEZS6GrzCkKcQ1ZFpCAVjN4BrLSQSR79mTFrBYdgkvzDWlIyivqvnmfjICf HAJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796048385; x=1796653185; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=VFZS8NaaLgYryUwmL7kHDe5z8C7d8BX2ObN93iatOTU=; b=a/2VafVqQFsR5PN8n1077h7DU6q5Dr8KnThmMOPEhdchUyjUooaKQq6chN0uoZodJ+ pc4s1wlXVrnrbevBm+fQ9NfKKRlZ9O//6YfgxJzpMLF8eT27Z8b0QTgOIInDRVkMo4V1 Xsp+vvE6B2c37E0GVIn8bls8Hov4Hgo/p4TpKeygsQs/Hye0268WjsD+R9rz0sfiy5DG 7yEFds8yAjeSklPvqEuaDjIMgj/iv9sXfT6HKsgLwxmOaQgymDooClvVe6HJMn5CYdGV x6GnlKDRvJk07Veu24OqNlq3pgl9f0TYigaKi8y9tKPiChXds+WI1jE7qDpf2GYtz1+l B3bg== X-Forwarded-Encrypted: i=1; AL+hErFU6DMuO+KTuL7u6YgBriPl4MGlUKCUNBRj1YWG4m1im7zeQk+qqkIMT6Clnf/tw1/64h6fC8Tqa3sv2RA=@vger.kernel.org X-Gm-Message-State: APuU4Z8ZbCT02c06S80t07BgwyfldnamsAVmykTb4xVHM61zRGhEkdJ0 Ik7alzrWoK0hv/UFa4fwx3bEvWYiloW2RYAknYJNKTJX90FU8US7iGJOiSWSTfdgrd4= X-Gm-Gg: AZFdTZcmMVqkIU9zqgTPfn6E6JKbU3hvJBtj15VeI7zs9zN3IvViqDD4gNWz4+jujtk xb+PcX8ZodQd+bBSywfQBofxVyuFzaEV+YDeXnm1dNDRefdSSz9HCP3kJb7wXOFeQR0/8AsAK/m lDIy9LTd1JAzN1pR8Vin7TRZvKQFRCCQnSPYGuJyfza4r/WwQcROJR7e0weO3nQjB0lruUuxM/N oXIvcf4IDm2RzxJaDaBmf47pgrBaGLSEnGrOE8/rd+EMKvWogCUfedAoOOD7IfM9eMQTGuVyuDR Sgk+P07Jo0BaHjKIwg3EjCYJ+DE6nLvNXKFIwNOh4P9+6dS1jxsdivKRL7OpCRZR+nEvQCqBSC4 GgC0znvmt/XcOg7CIBjMPyF2ygtokeeH5Ci7ulHCENWQqeuwYE6S+H0QJrwccQy2+fhz62sWknf adbhE72fa5cdCEvwJuHdpxYuK+fvoYFBQNHCr3VECtZW5khcgnNyURqxCSm7De3yuuDX31d9SIk jEKvYQag4MZA6WHq5Fp7GPK1Yajqa9OXB5dgWP/7WVDA7d9zuan6U0Bu3nlEt8iKE5lyd0anggX 8nprtiLnjwY8Vo50EDl57IhwSQf0tWlUD24kMxmqCNXGkTtI8R0cmF7V X-Received: by 2002:a05:600c:46d3:b0:4bb:6687:5394 with SMTP id 5b1f17b1804b1-4bb888097b0mr704268235e9.9.1796048384843; Mon, 30 Nov 2026 06:19:44 -0800 (PST) Received: from [127.0.1.1] (82-230-44-19.subs.proxad.net. [82.230.44.19]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4bb906635c7sm624295435e9.2.2026.11.30.06.19.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 06:19:44 -0800 (PST) From: Alexandre Mergnat Date: Mon, 30 Nov 2026 14:19:33 +0000 Subject: [PATCH 3/3] thermal/drivers/mediatek: Add GPUEB thermal driver X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261130-mtk-mfg-thermal-v1-3-e0617e26f902@baylibre.com> References: <20261130-mtk-mfg-thermal-v1-0-e0617e26f902@baylibre.com> In-Reply-To: <20261130-mtk-mfg-thermal-v1-0-e0617e26f902@baylibre.com> To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Nicolas Frattaroli , Ulf Hansson , "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-pm@vger.kernel.org, Alexandre Mergnat X-Mailer: b4 0.16.0 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 --- 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 +#include +#include +#include +#include +#include + +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 "); +MODULE_DESCRIPTION("MediaTek GPUEB thermal sensor driver"); +MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS("MTK_MFG_PM_DOMAIN"); -- 2.43.0