From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.50 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796048385; b=EKM+hll5XbQ672oEgEpzqwWGxuRVqlT8XS7yTWRy8m+rb3INVAq4EJhhd6uMp70/W8jg BBq6hR33420simbhSpEjjYrZdoz7Mg8vMlMJUhEAxkl1uGhGjUk1/z6OkOTmmN6qQygRq XfelFKgD2paJXIoOtrIoFmgVFul2pOOETtfs5z7m8xFneFzrchKzdmhnD5zGy0cs5sRqu ZddaaKFeksUe+wzEUycNkEkBtjW6u9Ix149eelPny+YYYJn7Y2LcI1gTjYjDBdtMUMyJR msEeqJJh9XVjrLnS3jePdhXxDTl6k5UVmBjG9OEzaJVaHsF25N09gURUwqNjBNChdpQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796048385; 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=fjureq0/S9Mjc6o9KFCmV/KGmOKiayHaO5NxqhnV6K8=; b=UIWTolpNc6tOxRysw98II6wdn2K3T9UHJs3PuUdzY58yGP0+FSgTBEbtUn51iUCcWi/L fHV4Puun8wHYVJQUowI6kYvLO0ndmC4ydjEAQbQqZzGgU0YkwArvOLbJWoaW6YH8jY3gX CcCRwgcSWvDLDwV+Ru2/roMitnx5dy7XetOoJFiDjiDwPiwr2VG0BY5mG6uJerGAZUjnM EX34qDswAbAvCQv4DKJKLhSpd7HvFe8xAOrr6jYd5EI55XEDSBxd2Nqb3RtLUB10jbbxr Lu8aQz8C5QQ6/g2H7GfQrCZhtdgbuvdx72xYMIvdwAMEIFQ7LNGOUgkw0KMIrDgqdtg== 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=Z2ntWHDK; arc=none smtp.remote-ip=209.85.128.50 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (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 24AD2606A6A7 for ; Mon, 30 Nov 2026 14:19:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 24AD2606A6A7 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=Z2ntWHDK Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-4bb6057b333so52350725e9.3 for ; Mon, 30 Nov 2026 06:19:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1796048383; x=1796653183; 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=fjureq0/S9Mjc6o9KFCmV/KGmOKiayHaO5NxqhnV6K8=; b=Z2ntWHDKxGELtet9DJoe5wk52S8Qa83/QXabF8C7Itg/7Mkyawu6zED30FOuXSmHu9 d2zrfR+j/gqV01BhjKZoF7HQDCecZ+FX2IEklUtq/ymL+4wMKDhYBic5aPWoDCg01Qmk PeN3CzID5ezufJhLf9lnabgoMy2hVQj8C5NQRl4c/X2w7te7KfWPdp4JqljXBLFzUaEj 0iedhvPYJKWTmGQRpvHc44lGZoz3cMX8WOgBGGFsedIcWk5AIdmlz7605ltdWnBG3gcC xe7BdeDShT2lVHHO/nXedbgXr1Ufp34IOHBF+z4+uHwKH0lpyK+gCTISEZq5Qfz26se+ LaXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796048383; x=1796653183; 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=fjureq0/S9Mjc6o9KFCmV/KGmOKiayHaO5NxqhnV6K8=; b=JCtMAk6QD0IuFfkW5GTDucK3qQ+RWZ2sCa73GyIDPSUnU28zshXv1u53I7ebz8r0Kt iLnzuwK+z0E5G3Cb1q4+oPDkJpHRsl39W99LCJx0ezxG2zVS+o6pTtmIx4wrzG6tZGnE tS/AvGhDiu5FS8E5IeVHG+NzMtANFMzn4cSnGQhvUGNCGtSCTxnIgxRPrFslxuOlDzjU UII587WyvF6nT5pb4zim1hbW1h0AbTNx+vZ/38D5lmwkPlmWufekNPegLbIEQqlHcrZo 3YbHWF4QR/JO/zVoNUhJHH30NHlAaBCchJArBz0veVwBMkbu/JHIJVAaFECMnuafzB38 hXiw== X-Forwarded-Encrypted: i=1; AL+hErGnWeIBdQsTUaZZH75DNmeDy7QyE+nKreVmgYvvgLL0z5XveVAtufRluN3VLX/Zjptj3O1J8B91eDUaDwk=@vger.kernel.org X-Gm-Message-State: APuU4Z/vVXK30ED6JNJlI6Bg2tArhefrtFfRBg8DX7QYozE9yjxIJBYu rA84SNwtvK/TWG1JQFDotxqAesKLmpFXNRorYm/GYPCvAv3CWlHkSOZSJZCkLSVvyRY= X-Gm-Gg: AZFdTZfGZid6Veh5d0kNCn4Jn4d4U3u7C5wUY+KEZsa5uODBlGEmHwtzRQUHyyaReEx 7319pIt7/uZWZgT97+oWXKUMXTpx5HXNUtFtj1ndF67jZbJDAtBq9b5biXCeEVavacd8dKAWjd4 K/PGLerNXfXtJcBRRjWhhfyw7IIXrzTmwpYhZHcNgDrKs7vWhMJKpYMsJ8BNzkq9Cn/Wx5WP9fx DsV9WAllkdLMOMg7GPYeZ03mzJra7OhkhyP0y2qqtF8lsWbOtrMEN/gl+NZXwX1FmLLm6zuxakB eLQiNPGvUOTKo7uCYzqmJ4addH95ioau3YYUQr+zEwe2bFiShc1BeP9/LNWb/RN1k/iJpM4HyD/ l4eTPm02VSCB5OwsD+pcrAubNSGXAXnOvYi4uZ9dol9jNb3d9Rmd39CYG8tvwIKayK1YS95n4mW zgfTdjG5OQ5tDDJ8R7PafVmA7zLSiRcix4IbtW4vuvRe3hJhW96AIv5R36U80dw+cQqWDSZZyQ8 GxonfH6kpzc5LPyDSaszMxhxHhsSPLaVipsBIwg2kB93j+CbsbXjkjvyoUAuZBXrU3/rALaUW3f mDY2MguA14mLNK8OsgB0XawzQDpxGQWnIfEksN9vDK5G/ClvtdAujG5+ X-Received: by 2002:a05:600c:5303:b0:4ba:495c:2f5d with SMTP id 5b1f17b1804b1-4bb8880767amr618760225e9.9.1796048383529; Mon, 30 Nov 2026 06:19:43 -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.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 06:19:43 -0800 (PST) From: Alexandre Mergnat Date: Mon, 30 Nov 2026 14:19:32 +0000 Subject: [PATCH 2/3] pmdomain: mediatek: mfg: Expose GPU temperature 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-2-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 The GPUEB reports the GPU temperature in the shared memory that mtk-mfg maps, but mtk-mfg does not read it, so no thermal zone can use it. Create an auxiliary device for a thermal driver, and export to it a function that returns the temperature reported by the GPUEB. Signed-off-by: Alexandre Mergnat --- drivers/pmdomain/mediatek/Kconfig | 1 + drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c | 29 ++++++++++++++++++++++++++++ include/linux/soc/mediatek/mtk-mfg.h | 13 +++++++++++++ 3 files changed, 43 insertions(+) diff --git a/drivers/pmdomain/mediatek/Kconfig b/drivers/pmdomain/mediatek/Kconfig index a2eb704a773c..b7c0fa40b9cf 100644 --- a/drivers/pmdomain/mediatek/Kconfig +++ b/drivers/pmdomain/mediatek/Kconfig @@ -32,6 +32,7 @@ config MTK_MFG_PM_DOMAIN depends on PM depends on OF depends on COMMON_CLK + select AUXILIARY_BUS select MAILBOX select PM_GENERIC_DOMAINS imply MTK_GPUEB_MBOX diff --git a/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c b/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c index 1417ffc22b3e..28f6d84a2774 100644 --- a/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c +++ b/drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c @@ -5,6 +5,7 @@ * Copyright (C) 2025, Collabora Ltd. */ +#include #include #include #include @@ -22,6 +23,7 @@ #include #include #include +#include #include #define GPR_LP_STATE 0x0028 @@ -908,6 +910,28 @@ static int mtk_mfg_init_nvmem_provider(struct mtk_mfg *mfg) return 0; } +/** + * mtk_mfg_get_temp() - Get the GPU temperature reported by the GPUEB + * @adev: the auxiliary device created by mtk-mfg + * @temp: the temperature in millidegrees Celsius + * + * Return: 0 on success, -ENODATA while the GPU is off, as the GPUEB does not + * update the temperature then. + */ +int mtk_mfg_get_temp(struct auxiliary_device *adev, int *temp) +{ + struct mtk_mfg *mfg = dev_get_drvdata(adev->dev.parent); + + if (READ_ONCE(mfg->pd.status) != GENPD_STATE_ON) + return -ENODATA; + + *temp = (s32)readl(mfg->shared_mem + GF_REG_TEMP_RAW) * + MILLIDEGREE_PER_DEGREE; + + return 0; +} +EXPORT_SYMBOL_NS_GPL(mtk_mfg_get_temp, "MTK_MFG_PM_DOMAIN"); + static int mtk_mfg_probe(struct platform_device *pdev) { struct mtk_mfg *mfg; @@ -1024,6 +1048,11 @@ static int mtk_mfg_probe(struct platform_device *pdev) if (ret) goto err_power_off; + if (!devm_auxiliary_device_create(dev, "thermal", NULL)) { + ret = -ENODEV; + goto err_power_off; + } + ret = of_genpd_add_provider_simple(dev->of_node, &mfg->pd); if (ret) { dev_err_probe(dev, ret, "Failed to add pmdomain provider\n"); diff --git a/include/linux/soc/mediatek/mtk-mfg.h b/include/linux/soc/mediatek/mtk-mfg.h new file mode 100644 index 000000000000..8ca41b7faffd --- /dev/null +++ b/include/linux/soc/mediatek/mtk-mfg.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2026 BayLibre, SAS + */ + +#ifndef __MTK_MFG_H +#define __MTK_MFG_H + +struct auxiliary_device; + +int mtk_mfg_get_temp(struct auxiliary_device *adev, int *temp); + +#endif /* __MTK_MFG_H */ -- 2.43.0