* [PATCH 1/2] dt-bindings: thermal: mediatek: Add MT8189 LVTS bindings @ 2026-04-27 6:48 mtk36707 2026-04-27 6:48 ` [PATCH 2/2] thermal: mediatek: lvts: Add MT8189 support mtk36707 2026-04-27 8:24 ` [PATCH 1/2] dt-bindings: thermal: mediatek: Add MT8189 LVTS bindings Rob Herring (Arm) 0 siblings, 2 replies; 4+ messages in thread From: mtk36707 @ 2026-04-27 6:48 UTC (permalink / raw) To: Rafael J . Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Philipp Zabel, Matthias Brugger, AngeloGioacchino Del Regno, Balsam CHIHI Cc: linux-pm, devicetree, linux-kernel, linux-arm-kernel, linux-mediatek, jarried.lin, vince-wl.liu, justin.yeh, Kuanfu Lu From: Kuanfu Lu <kuanfu.lu@mediatek.com> Add support for the MediaTek MT8189 LVTS thermal controller to the device tree bindings. This includes new compatible strings and required properties for MT8189. Signed-off-by: Kuanfu Lu <kuanfu.lu@mediatek.com> --- .../thermal/mediatek,lvts-thermal.yaml | 27 +++++++++++++++++-- .../thermal/mediatek,lvts-thermal.h | 20 ++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/thermal/mediatek,lvts-thermal.yaml b/Documentation/devicetree/bindings/thermal/mediatek,lvts-thermal.yaml index 975235130670..64fc6b5385de 100644 --- a/Documentation/devicetree/bindings/thermal/mediatek,lvts-thermal.yaml +++ b/Documentation/devicetree/bindings/thermal/mediatek,lvts-thermal.yaml @@ -23,6 +23,8 @@ properties: - mediatek,mt8186-lvts - mediatek,mt8188-lvts-ap - mediatek,mt8188-lvts-mcu + - mediatek,mt8189-lvts-ap + - mediatek,mt8189-lvts-mcu - mediatek,mt8192-lvts-ap - mediatek,mt8192-lvts-mcu - mediatek,mt8195-lvts-ap @@ -61,6 +63,21 @@ properties: allOf: - $ref: thermal-sensor.yaml# + - if: + properties: + compatible: + contains: + enum: + - mediatek,mt8189-lvts-ap + - mediatek,mt8189-lvts-mcu + then: + properties: + nvmem-cells: + minItems: 2 + + nvmem-cell-names: + minItems: 2 + - if: properties: compatible: @@ -78,6 +95,10 @@ allOf: nvmem-cell-names: maxItems: 1 + required: + - clocks + - resets + - if: properties: compatible: @@ -94,12 +115,14 @@ allOf: nvmem-cell-names: minItems: 2 + required: + - clocks + - resets + required: - compatible - reg - interrupts - - clocks - - resets - nvmem-cells - nvmem-cell-names diff --git a/include/dt-bindings/thermal/mediatek,lvts-thermal.h b/include/dt-bindings/thermal/mediatek,lvts-thermal.h index 350f98178b26..3f493d7f13b3 100644 --- a/include/dt-bindings/thermal/mediatek,lvts-thermal.h +++ b/include/dt-bindings/thermal/mediatek,lvts-thermal.h @@ -45,6 +45,26 @@ #define MT8188_AP_CAM1 6 #define MT8188_AP_CAM2 7 +#define MT8189_MCU_BIG_CPU1 0 +#define MT8189_MCU_BIG_CPU2 1 +#define MT8189_MCU_BIG_CPU3 2 +#define MT8189_MCU_BIG_CPU4 3 +#define MT8189_MCU_LITTLE_CPU1 4 +#define MT8189_MCU_LITTLE_CPU2 5 +#define MT8189_MCU_LITTLE_CPU3 6 +#define MT8189_MCU_LITTLE_CPU4 7 +#define MT8189_MCU_LITTLE_CPU5 8 +#define MT8189_MCU_LITTLE_CPU6 9 +#define MT8189_MCU_LITTLE_CPU7 10 +#define MT8189_MCU_LITTLE_CPU8 11 + +#define MT8189_AP_SOC1 12 +#define MT8189_AP_SOC2 13 +#define MT8189_AP_SOC3 14 +#define MT8189_AP_APU 15 +#define MT8189_AP_GPU1 16 +#define MT8189_AP_GPU2 17 + #define MT8195_MCU_BIG_CPU0 0 #define MT8195_MCU_BIG_CPU1 1 #define MT8195_MCU_BIG_CPU2 2 -- 2.45.2 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] thermal: mediatek: lvts: Add MT8189 support 2026-04-27 6:48 [PATCH 1/2] dt-bindings: thermal: mediatek: Add MT8189 LVTS bindings mtk36707 @ 2026-04-27 6:48 ` mtk36707 2026-04-27 9:14 ` Philipp Zabel 2026-04-27 8:24 ` [PATCH 1/2] dt-bindings: thermal: mediatek: Add MT8189 LVTS bindings Rob Herring (Arm) 1 sibling, 1 reply; 4+ messages in thread From: mtk36707 @ 2026-04-27 6:48 UTC (permalink / raw) To: Rafael J . Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Philipp Zabel, Matthias Brugger, AngeloGioacchino Del Regno, Balsam CHIHI Cc: linux-pm, devicetree, linux-kernel, linux-arm-kernel, linux-mediatek, jarried.lin, vince-wl.liu, justin.yeh, Kuanfu Lu 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 @@ -70,6 +70,7 @@ #define LVTS_HW_FILTER 0x0 #define LVTS_TSSEL_CONF 0x13121110 #define LVTS_CALSCALE_CONF 0x300 +#define LVTS_MONINT_CONF_STAGE3 BIT(31) #define LVTS_MONINT_OFFSET_HIGH_INTEN_SENSOR0 BIT(3) #define LVTS_MONINT_OFFSET_HIGH_INTEN_SENSOR1 BIT(8) @@ -159,6 +160,9 @@ struct lvts_data { int temp_offset; int gt_calib_bit_offset; unsigned int def_calibration; + bool clock_gate_no_need; + bool reset_no_need; + bool conf_stage3_need; u16 msr_offset; }; @@ -1044,7 +1048,7 @@ static void lvts_write_config(struct lvts_ctrl *lvts_ctrl, const u32 *cmds, int } } -static int lvts_irq_init(struct lvts_ctrl *lvts_ctrl) +static int lvts_irq_init(struct lvts_ctrl *lvts_ctrl, const struct lvts_data *lvts_data) { /* * LVTS_PROTCTL : Thermal Protection Sensor Selection @@ -1079,7 +1083,11 @@ static int lvts_irq_init(struct lvts_ctrl *lvts_ctrl) * The LVTS_MONINT register layout is the same as the LVTS_MONINTSTS * register, except we set the bits to enable the interrupt. */ - writel(0, LVTS_MONINT(lvts_ctrl->base)); + + if (lvts_data->conf_stage3_need) + writel(LVTS_MONINT_CONF_STAGE3, LVTS_MONINT(lvts_ctrl->base)); + else + writel(0, LVTS_MONINT(lvts_ctrl->base)); return 0; } @@ -1177,7 +1185,8 @@ static int lvts_ctrl_calibrate(struct device *dev, struct lvts_ctrl *lvts_ctrl) return 0; } -static int lvts_ctrl_configure(struct device *dev, struct lvts_ctrl *lvts_ctrl) +static int lvts_ctrl_configure(struct device *dev, struct lvts_ctrl *lvts_ctrl, + const struct lvts_data *lvts_data) { u32 value; @@ -1279,7 +1288,7 @@ static int lvts_ctrl_configure(struct device *dev, struct lvts_ctrl *lvts_ctrl) value = LVTS_FILTER_INTERVAL << 16 | LVTS_SENSOR_INTERVAL; writel(value, LVTS_MONCTL2(lvts_ctrl->base)); - return lvts_irq_init(lvts_ctrl); + return lvts_irq_init(lvts_ctrl, lvts_data); } static int lvts_ctrl_start(struct device *dev, struct lvts_ctrl *lvts_ctrl) @@ -1420,13 +1429,13 @@ static int lvts_domain_init(struct device *dev, struct lvts_domain *lvts_td, return ret; } - ret = lvts_ctrl_calibrate(dev, lvts_ctrl); + ret = lvts_ctrl_calibrate(dev, lvts_ctrl, lvts_data); if (ret) { dev_dbg(dev, "Failed to calibrate controller"); return ret; } - ret = lvts_ctrl_configure(dev, lvts_ctrl); + ret = lvts_ctrl_configure(dev, lvts_ctrl, lvts_data); if (ret) { dev_dbg(dev, "Failed to configure controller"); return ret; @@ -1458,9 +1467,12 @@ static int lvts_probe(struct platform_device *pdev) if (!lvts_data) return -ENODEV; - lvts_td->clk = devm_clk_get_enabled(dev, NULL); - if (IS_ERR(lvts_td->clk)) - return dev_err_probe(dev, PTR_ERR(lvts_td->clk), "Failed to retrieve clock\n"); + if (!lvts_data->clock_gate_no_need) { + lvts_td->clk = devm_clk_get_enabled(dev, NULL); + if (IS_ERR(lvts_td->clk)) + return dev_err_probe(dev, PTR_ERR(lvts_td->clk), + "Failed to retrieve clock\n"); + } res = platform_get_mem_or_io(pdev, 0); if (!res) @@ -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); - 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); + 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; @@ -1742,6 +1756,78 @@ static const struct lvts_ctrl_data mt8188_lvts_ap_data_ctrl[] = { } }; +static const struct lvts_ctrl_data mt8189_lvts_mcu_data_ctrl[] = { + { + .lvts_sensor = { + { .dt_id = MT8189_MCU_LITTLE_CPU1, + .cal_offsets = { 4, 5, 6 } }, + { .dt_id = MT8189_MCU_LITTLE_CPU2, + .cal_offsets = { 8, 9, 10 } }, + { .dt_id = MT8189_MCU_LITTLE_CPU3, + .cal_offsets = { 12, 13, 14 } }, + { .dt_id = MT8189_MCU_LITTLE_CPU4, + .cal_offsets = { 16, 17, 18 } } + }, + VALID_SENSOR_MAP(1, 1, 1, 1), + .offset = 0x0, + }, + { + .lvts_sensor = { + { .dt_id = MT8189_MCU_LITTLE_CPU5, + .cal_offsets = { 24, 25, 26 } }, + { .dt_id = MT8189_MCU_LITTLE_CPU6, + .cal_offsets = { 28, 29, 30 } }, + { .dt_id = MT8189_MCU_LITTLE_CPU7, + .cal_offsets = { 32, 33, 34 } }, + { .dt_id = MT8189_MCU_LITTLE_CPU8, + .cal_offsets = { 36, 37, 38 } } + }, + VALID_SENSOR_MAP(1, 1, 1, 1), + .offset = 0x100, + }, + { + .lvts_sensor = { + { .dt_id = MT8189_MCU_BIG_CPU1, + .cal_offsets = { 44, 45, 46 } }, + { .dt_id = MT8189_MCU_BIG_CPU2, + .cal_offsets = { 48, 49, 50 } }, + { .dt_id = MT8189_MCU_BIG_CPU3, + .cal_offsets = { 52, 53, 54 } }, + { .dt_id = MT8189_MCU_BIG_CPU4, + .cal_offsets = { 56, 57, 58 } } + }, + VALID_SENSOR_MAP(1, 1, 1, 1), + .offset = 0x200, + } +}; + +static const struct lvts_ctrl_data mt8189_lvts_ap_data_ctrl[] = { + { + .lvts_sensor = { + { .dt_id = MT8189_AP_SOC1, + .cal_offsets = { 64, 65, 66 } }, + { .dt_id = MT8189_AP_SOC2, + .cal_offsets = { 68, 69, 70 } }, + { .dt_id = MT8189_AP_SOC3, + .cal_offsets = { 72, 73, 74 } }, + { .dt_id = MT8189_AP_APU, + .cal_offsets = { 76, 77, 78 } } + }, + VALID_SENSOR_MAP(1, 1, 1, 1), + .offset = 0x0, + }, + { + .lvts_sensor = { + { .dt_id = MT8189_AP_GPU1, + .cal_offsets = { 84, 85, 86 } }, + { .dt_id = MT8189_AP_GPU2, + .cal_offsets = { 88, 89, 90 } } + }, + VALID_SENSOR_MAP(1, 1, 0, 0), + .offset = 0x100, + } +}; + static const struct lvts_ctrl_data mt8192_lvts_mcu_data_ctrl[] = { { .lvts_sensor = { @@ -2087,6 +2173,34 @@ static const struct lvts_data mt8188_lvts_ap_data = { .ops = &lvts_platform_ops_mt7988, }; +static const struct lvts_data mt8189_lvts_ap_data = { + .lvts_ctrl = mt8189_lvts_ap_data_ctrl, + .conn_cmd = default_conn_cmds, + .init_cmd = default_init_cmds, + .num_lvts_ctrl = ARRAY_SIZE(mt8189_lvts_ap_data_ctrl), + .num_conn_cmd = ARRAY_SIZE(default_conn_cmds), + .num_init_cmd = ARRAY_SIZE(default_init_cmds), + .temp_factor = LVTS_COEFF_A_MT8195, + .temp_offset = LVTS_COEFF_B_MT8195, + .gt_calib_bit_offset = 0, + .def_calibration = 35000, + .clock_gate_no_need = true, + .reset_no_need = true, + .conf_stage3_need = true, +}; + +static const struct lvts_data mt8189_lvts_mcu_data = { + .lvts_ctrl = mt8189_lvts_mcu_data_ctrl, + .num_lvts_ctrl = ARRAY_SIZE(mt8189_lvts_mcu_data_ctrl), + .temp_factor = LVTS_COEFF_A_MT8195, + .temp_offset = LVTS_COEFF_B_MT8195, + .gt_calib_bit_offset = 0, + .def_calibration = 35000, + .clock_gate_no_need = true, + .reset_no_need = true, + .conf_stage3_need = true, +}; + static const struct lvts_data mt8192_lvts_mcu_data = { .lvts_ctrl = mt8192_lvts_mcu_data_ctrl, .conn_cmd = default_conn_cmds, @@ -2177,6 +2291,8 @@ static const struct of_device_id lvts_of_match[] = { { .compatible = "mediatek,mt8186-lvts", .data = &mt8186_lvts_data }, { .compatible = "mediatek,mt8188-lvts-mcu", .data = &mt8188_lvts_mcu_data }, { .compatible = "mediatek,mt8188-lvts-ap", .data = &mt8188_lvts_ap_data }, + { .compatible = "mediatek,mt8189-lvts-mcu", .data = &mt8189_lvts_mcu_data }, + { .compatible = "mediatek,mt8189-lvts-ap", .data = &mt8189_lvts_ap_data }, { .compatible = "mediatek,mt8192-lvts-mcu", .data = &mt8192_lvts_mcu_data }, { .compatible = "mediatek,mt8192-lvts-ap", .data = &mt8192_lvts_ap_data }, { .compatible = "mediatek,mt8195-lvts-mcu", .data = &mt8195_lvts_mcu_data }, -- 2.45.2 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] thermal: mediatek: lvts: Add MT8189 support 2026-04-27 6:48 ` [PATCH 2/2] thermal: mediatek: lvts: Add MT8189 support mtk36707 @ 2026-04-27 9:14 ` Philipp Zabel 0 siblings, 0 replies; 4+ messages in thread From: Philipp Zabel @ 2026-04-27 9:14 UTC (permalink / raw) To: mtk36707, Rafael J . Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger, AngeloGioacchino Del Regno, Balsam CHIHI Cc: linux-pm, devicetree, linux-kernel, linux-arm-kernel, linux-mediatek, jarried.lin, vince-wl.liu, justin.yeh 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] dt-bindings: thermal: mediatek: Add MT8189 LVTS bindings 2026-04-27 6:48 [PATCH 1/2] dt-bindings: thermal: mediatek: Add MT8189 LVTS bindings mtk36707 2026-04-27 6:48 ` [PATCH 2/2] thermal: mediatek: lvts: Add MT8189 support mtk36707 @ 2026-04-27 8:24 ` Rob Herring (Arm) 1 sibling, 0 replies; 4+ messages in thread From: Rob Herring (Arm) @ 2026-04-27 8:24 UTC (permalink / raw) To: mtk36707 Cc: Krzysztof Kozlowski, Conor Dooley, AngeloGioacchino Del Regno, Rafael J . Wysocki, devicetree, Matthias Brugger, Balsam CHIHI, linux-arm-kernel, vince-wl.liu, Philipp Zabel, justin.yeh, linux-mediatek, jarried.lin, Daniel Lezcano, Lukasz Luba, linux-kernel, Zhang Rui, linux-pm On Mon, 27 Apr 2026 14:48:29 +0800, mtk36707 wrote: > From: Kuanfu Lu <kuanfu.lu@mediatek.com> > > Add support for the MediaTek MT8189 LVTS thermal controller to > the device tree bindings. This includes new compatible strings > and required properties for MT8189. > > Signed-off-by: Kuanfu Lu <kuanfu.lu@mediatek.com> > --- > .../thermal/mediatek,lvts-thermal.yaml | 27 +++++++++++++++++-- > .../thermal/mediatek,lvts-thermal.h | 20 ++++++++++++++ > 2 files changed, 45 insertions(+), 2 deletions(-) > My bot found errors running 'make dt_binding_check' on your patch: yamllint warnings/errors: ./Documentation/devicetree/bindings/thermal/mediatek,lvts-thermal.yaml:99:11: [warning] wrong indentation: expected 8 but found 10 (indentation) ./Documentation/devicetree/bindings/thermal/mediatek,lvts-thermal.yaml:119:11: [warning] wrong indentation: expected 8 but found 10 (indentation) dtschema/dtc warnings/errors: doc reference errors (make refcheckdocs): See https://patchwork.kernel.org/project/devicetree/patch/20260427065236.1685057-1-kuanfu.lu@mediatek.com The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch. If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date: pip3 install dtschema --upgrade Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-04-27 9:15 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-04-27 6:48 [PATCH 1/2] dt-bindings: thermal: mediatek: Add MT8189 LVTS bindings mtk36707 2026-04-27 6:48 ` [PATCH 2/2] thermal: mediatek: lvts: Add MT8189 support mtk36707 2026-04-27 9:14 ` Philipp Zabel 2026-04-27 8:24 ` [PATCH 1/2] dt-bindings: thermal: mediatek: Add MT8189 LVTS bindings Rob Herring (Arm)
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox