Re: [PATCH 2/2] thermal: mediatek: lvts: Add MT8189 support

Philipp Zabel
2026-04-27T09:15:05Z

On Mo, 2026-04-27 at 14:48 +0800, mtk36707 wrote:
> From: Kuanfu Lu <kuanfu.lu@mediatek.com>
>
> Add LVTS thermal support for MediaTek MT8189 by adding MT8189-specific
> controller/sensor topology and platform data for the MCU and AP domains.
>
> MT8189 differs from previous SoCs in a few aspects, so extend the driver
> to handle these variations:
> - Program the hardware thermal shutdown threshold (tshut) using raw units.
> - Add per-SoC feature flags to skip clock gating and reset control when
> they are not required, and to enable Stage-3 monitor interrupt setup.
> - Pass SoC data into lvts_irq_init() and lvts_ctrl_configure() so the
> initialization can be configured per platform.
>
> This enables monitoring of MT8189 CPU clusters and AP domain sensors
> (SOC/APU/GPU) with the existing LVTS driver.
>
> Signed-off-by: Kuanfu Lu <kuanfu.lu@mediatek.com>
> ---
> drivers/thermal/mediatek/lvts_thermal.c | 142 +++++++++++++++++++++---
> 1 file changed, 129 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
> index a9617d5e0077..9dbd9191e3ba 100644
> --- a/drivers/thermal/mediatek/lvts_thermal.c
> +++ b/drivers/thermal/mediatek/lvts_thermal.c
[...]
> @@ -1470,10 +1482,12 @@ static int lvts_probe(struct platform_device *pdev)
> if (IS_ERR(lvts_td->base))
> return dev_err_probe(dev, PTR_ERR(lvts_td->base), "Failed to map io resource\n");
>
> - lvts_td->reset = devm_reset_control_get_by_index(dev, 0);

First of all, this should have been:

lvts_td->reset = devm_reset_control_get_exclusive(dev, NULL);

since there is only a single reset control defined in the binding.

> - if (IS_ERR(lvts_td->reset))
> - return dev_err_probe(dev, PTR_ERR(lvts_td->reset), "Failed to get reset control\n");
> -
> + if (!lvts_data->reset_no_need) {
> + lvts_td->reset = devm_reset_control_get_by_index(dev, 0);

So this can be changed to

lvts_td->reset = devm_reset_control_get_optional_exclusive(dev, NULL);

instead. There is no need for the reset_no_need parameter at all.
Whether the reset control is required or not is already specified in
the device tree bindings.

> + if (IS_ERR(lvts_td->reset))
> + return dev_err_probe(dev, PTR_ERR(lvts_td->reset),
> + "Failed to get reset control\n");
> + }
> irq = platform_get_irq(pdev, 0);
> if (irq < 0)
> return irq;

regards
Philipp