Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
To: Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Ulf Hansson <ulfh@kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Daniel Lezcano <daniel.lezcano@kernel.org>,
	Zhang Rui <rui.zhang@intel.com>,
	Lukasz Luba <lukasz.luba@arm.com>,
	Alexandre Mergnat <amergnat@baylibre.com>
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 <amergnat@baylibre.com>,
	Moudy Ho <moudy.ho@mediatek.com>
Subject: Re: [PATCH 0/3] Add the MT8196 GPU temperature sensor
Date: Tue, 01 Dec 2026 14:10:25 +0100	[thread overview]
Message-ID: <Vrdt09nZT2iMW5lPBHQhyQ@collabora.com> (raw)
In-Reply-To: <20261130-mtk-mfg-thermal-v1-0-e0617e26f902@baylibre.com>

Commenting as someone with some experience with the hardware

On Monday, 30 November 2026 15:19:30 Central European Standard Time Alexandre Mergnat wrote:
> No mainline driver reports the temperature of the MT8196 GPU, so a
> thermal zone cannot throttle the GPU when it heats up. This series
> takes the temperature that the GPUEB, the microcontroller managing
> the GPU power and frequency, reports to the kernel, and makes it a
> thermal sensor that a device tree thermal zone can use.
> 
> The usual way to get this temperature would be to extend the driver of
> the SoC thermal controller (LVTS) to its GPU sensors. This series uses
> the value that the GPU firmware reports instead, because the firmware
> already reads these sensors.

Makes sense. We also have to do this for clocks here iirc, and the
shader-present efuse of course. While it would've been nice to have
the "real" source of that info, proxying it through the GPUEB firmware
is the most reliable path since we don't know what other clocks and
things it uses to get those ready, much less the addresses.

> Any read clears the flag that marks a new
> measurement, so this flag cannot be shared by two readers: a read by
> one makes the other miss that a new measurement is there. A prototype
> Linux reader of these sensors often found the flag already cleared
> without having read it.

Okay yeah that's extra lovely then and reinforces the need to do this
through the firmware.

> On the test board, the value that the firmware
> reported stayed within one degree of the average of these sensors.

Is any sensor compensation already done as part of the GPUEB firmware?
Usually hardware has some factory calibration fused into OTP registers,
though I don't know whether that's the case specifically for MT8196.

> 
> Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com>
> ---
> Alexandre Mergnat (2):
>       pmdomain: mediatek: mfg: Expose GPU temperature
>       thermal/drivers/mediatek: Add GPUEB thermal driver
> 
> Moudy Ho (1):
>       dt-bindings: power: mt8196-gpufreq: Add #thermal-sensor-cells
> 
>  .../bindings/power/mediatek,mt8196-gpufreq.yaml    |  4 ++
>  drivers/pmdomain/mediatek/Kconfig                  |  1 +
>  drivers/pmdomain/mediatek/mtk-mfg-pmdomain.c       | 29 ++++++++++++
>  drivers/thermal/mediatek/Kconfig                   |  9 ++++
>  drivers/thermal/mediatek/Makefile                  |  1 +
>  drivers/thermal/mediatek/gpueb_thermal.c           | 52 ++++++++++++++++++++++
>  include/linux/soc/mediatek/mtk-mfg.h               | 13 ++++++
>  7 files changed, 109 insertions(+)
> ---
> base-commit: f66469d9905b39d2c260a15d7d6db450f4db67c1
> change-id: 20261115-mtk-mfg-thermal-9f4a7cc786ae
> 
> Best regards,
> --  
> Alexandre Mergnat <amergnat@baylibre.com>
> 
> 

ACK from me for the general approach, as for implementation I haven't
looked too closely at it but am wondering whether this also means I messed
up when making the mtk-mfg-pmdomain.c driver a clock provider, instead of
having a clock provider driver suckling on an auxiliary bus there. Any
thoughts on whether that should be refactored, i.e. if there's a benefit?

Kind regards,
Nicolas Frattaroli




      parent reply	other threads:[~2026-12-01 13:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 14:19 [PATCH 0/3] Add the MT8196 GPU temperature sensor Alexandre Mergnat
2026-11-30 14:19 ` [PATCH 1/3] dt-bindings: power: mt8196-gpufreq: Add #thermal-sensor-cells Alexandre Mergnat
2026-11-30 14:19 ` [PATCH 2/3] pmdomain: mediatek: mfg: Expose GPU temperature Alexandre Mergnat
2026-11-30 14:19 ` [PATCH 3/3] thermal/drivers/mediatek: Add GPUEB thermal driver Alexandre Mergnat
2026-11-30 15:31   ` Uwe Kleine-König
2026-12-01 13:10 ` Nicolas Frattaroli [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Vrdt09nZT2iMW5lPBHQhyQ@collabora.com \
    --to=nicolas.frattaroli@collabora.com \
    --cc=amergnat@baylibre.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=conor+dt@kernel.org \
    --cc=daniel.lezcano@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=matthias.bgg@gmail.com \
    --cc=moudy.ho@mediatek.com \
    --cc=rafael@kernel.org \
    --cc=robh@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=ulfh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox