* [PATCH v4 1/9] dt-bindings: thermal: mediatek: Add LVTS thermal controller support for MT8196
2025-11-21 11:16 [PATCH v4 0/9] Add thermal sensor driver support for Mediatek MT8196 Laura Nao
@ 2025-11-21 11:16 ` Laura Nao
2025-11-21 11:16 ` [PATCH v4 2/9] thermal/drivers/mediatek/lvts: Make number of calibration offsets configurable Laura Nao
` (7 subsequent siblings)
8 siblings, 0 replies; 18+ messages in thread
From: Laura Nao @ 2025-11-21 11:16 UTC (permalink / raw)
To: srini, robh, krzk+dt, conor+dt, rafael, daniel.lezcano, rui.zhang,
lukasz.luba, matthias.bgg, angelogioacchino.delregno
Cc: nfraprado, arnd, colin.i.king, u.kleine-koenig, andrew-ct.chen,
lala.lin, bchihi, frank-w, wenst, fshao, devicetree, linux-kernel,
linux-pm, linux-arm-kernel, linux-mediatek, kernel, Laura Nao,
Krzysztof Kozlowski
Add LVTS thermal controller binding for MediaTek MT8196.
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de>
Signed-off-by: Laura Nao <laura.nao@collabora.com>
---
.../bindings/thermal/mediatek,lvts-thermal.yaml | 2 ++
.../dt-bindings/thermal/mediatek,lvts-thermal.h | 26 ++++++++++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/Documentation/devicetree/bindings/thermal/mediatek,lvts-thermal.yaml b/Documentation/devicetree/bindings/thermal/mediatek,lvts-thermal.yaml
index 0259cd3ce9c5..beccdabe110b 100644
--- a/Documentation/devicetree/bindings/thermal/mediatek,lvts-thermal.yaml
+++ b/Documentation/devicetree/bindings/thermal/mediatek,lvts-thermal.yaml
@@ -26,6 +26,8 @@ properties:
- mediatek,mt8192-lvts-mcu
- mediatek,mt8195-lvts-ap
- mediatek,mt8195-lvts-mcu
+ - mediatek,mt8196-lvts-ap
+ - mediatek,mt8196-lvts-mcu
reg:
maxItems: 1
diff --git a/include/dt-bindings/thermal/mediatek,lvts-thermal.h b/include/dt-bindings/thermal/mediatek,lvts-thermal.h
index ddc7302a510a..0ec8ad184d47 100644
--- a/include/dt-bindings/thermal/mediatek,lvts-thermal.h
+++ b/include/dt-bindings/thermal/mediatek,lvts-thermal.h
@@ -80,4 +80,30 @@
#define MT8192_AP_MD1 15
#define MT8192_AP_MD2 16
+#define MT8196_MCU_MEDIUM_CPU6_0 0
+#define MT8196_MCU_MEDIUM_CPU6_1 1
+#define MT8196_MCU_DSU2 2
+#define MT8196_MCU_DSU3 3
+#define MT8196_MCU_LITTLE_CPU3 4
+#define MT8196_MCU_LITTLE_CPU0 5
+#define MT8196_MCU_LITTLE_CPU1 6
+#define MT8196_MCU_LITTLE_CPU2 7
+#define MT8196_MCU_MEDIUM_CPU4_0 8
+#define MT8196_MCU_MEDIUM_CPU4_1 9
+#define MT8196_MCU_MEDIUM_CPU5_0 10
+#define MT8196_MCU_MEDIUM_CPU5_1 11
+#define MT8196_MCU_DSU0 12
+#define MT8196_MCU_DSU1 13
+#define MT8196_MCU_BIG_CPU7_0 14
+#define MT8196_MCU_BIG_CPU7_1 15
+
+#define MT8196_AP_TOP0 0
+#define MT8196_AP_TOP1 1
+#define MT8196_AP_TOP2 2
+#define MT8196_AP_TOP3 3
+#define MT8196_AP_BOT0 4
+#define MT8196_AP_BOT1 5
+#define MT8196_AP_BOT2 6
+#define MT8196_AP_BOT3 7
+
#endif /* __MEDIATEK_LVTS_DT_H */
--
2.39.5
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v4 2/9] thermal/drivers/mediatek/lvts: Make number of calibration offsets configurable
2025-11-21 11:16 [PATCH v4 0/9] Add thermal sensor driver support for Mediatek MT8196 Laura Nao
2025-11-21 11:16 ` [PATCH v4 1/9] dt-bindings: thermal: mediatek: Add LVTS thermal controller support for MT8196 Laura Nao
@ 2025-11-21 11:16 ` Laura Nao
2025-11-24 18:25 ` Daniel Lezcano
2025-11-21 11:16 ` [PATCH v4 3/9] thermal/drivers/mediatek/lvts: Fail probe if temp_factor is zero Laura Nao
` (6 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Laura Nao @ 2025-11-21 11:16 UTC (permalink / raw)
To: srini, robh, krzk+dt, conor+dt, rafael, daniel.lezcano, rui.zhang,
lukasz.luba, matthias.bgg, angelogioacchino.delregno
Cc: nfraprado, arnd, colin.i.king, u.kleine-koenig, andrew-ct.chen,
lala.lin, bchihi, frank-w, wenst, fshao, devicetree, linux-kernel,
linux-pm, linux-arm-kernel, linux-mediatek, kernel, Laura Nao
MT8196/MT6991 use 2-byte eFuse calibration data, whereas other SoCs
supported by the driver rely on 3 bytes. Make the number of calibration
bytes per sensor configurable, enabling support for SoCs with varying
calibration formats.
Reviewed-by: Fei Shao <fshao@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de>
Signed-off-by: Laura Nao <laura.nao@collabora.com>
---
drivers/thermal/mediatek/lvts_thermal.c | 32 ++++++++++++++++++++++----------
1 file changed, 22 insertions(+), 10 deletions(-)
diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
index ab55b20cda47..1c54d0b75b1a 100644
--- a/drivers/thermal/mediatek/lvts_thermal.c
+++ b/drivers/thermal/mediatek/lvts_thermal.c
@@ -96,12 +96,14 @@
#define LVTS_MINIMUM_THRESHOLD 20000
+#define LVTS_MAX_CAL_OFFSETS 3
+
static int golden_temp = LVTS_GOLDEN_TEMP_DEFAULT;
static int golden_temp_offset;
struct lvts_sensor_data {
int dt_id;
- u8 cal_offsets[3];
+ u8 cal_offsets[LVTS_MAX_CAL_OFFSETS];
};
struct lvts_ctrl_data {
@@ -127,6 +129,7 @@ struct lvts_data {
const struct lvts_ctrl_data *lvts_ctrl;
const u32 *conn_cmd;
const u32 *init_cmd;
+ int num_cal_offsets;
int num_lvts_ctrl;
int num_conn_cmd;
int num_init_cmd;
@@ -711,7 +714,7 @@ static int lvts_calibration_init(struct device *dev, struct lvts_ctrl *lvts_ctrl
u8 *efuse_calibration,
size_t calib_len)
{
- int i;
+ int i, j;
u32 gt;
/* A zero value for gt means that device has invalid efuse data */
@@ -720,17 +723,18 @@ static int lvts_calibration_init(struct device *dev, struct lvts_ctrl *lvts_ctrl
lvts_for_each_valid_sensor(i, lvts_ctrl_data) {
const struct lvts_sensor_data *sensor =
&lvts_ctrl_data->lvts_sensor[i];
+ u32 calib = 0;
- if (sensor->cal_offsets[0] >= calib_len ||
- sensor->cal_offsets[1] >= calib_len ||
- sensor->cal_offsets[2] >= calib_len)
- return -EINVAL;
+ for (j = 0; j < lvts_ctrl->lvts_data->num_cal_offsets; j++) {
+ u8 offset = sensor->cal_offsets[j];
+
+ if (offset >= calib_len)
+ return -EINVAL;
+ calib |= efuse_calibration[offset] << (8 * j);
+ }
if (gt) {
- lvts_ctrl->calibration[i] =
- (efuse_calibration[sensor->cal_offsets[0]] << 0) +
- (efuse_calibration[sensor->cal_offsets[1]] << 8) +
- (efuse_calibration[sensor->cal_offsets[2]] << 16);
+ lvts_ctrl->calibration[i] = calib;
} else if (lvts_ctrl->lvts_data->def_calibration) {
lvts_ctrl->calibration[i] = lvts_ctrl->lvts_data->def_calibration;
} else {
@@ -1763,6 +1767,7 @@ static const struct lvts_data mt7988_lvts_ap_data = {
.temp_factor = LVTS_COEFF_A_MT7988,
.temp_offset = LVTS_COEFF_B_MT7988,
.gt_calib_bit_offset = 24,
+ .num_cal_offsets = 3,
};
static const struct lvts_data mt8186_lvts_data = {
@@ -1776,6 +1781,7 @@ static const struct lvts_data mt8186_lvts_data = {
.temp_offset = LVTS_COEFF_B_MT7988,
.gt_calib_bit_offset = 24,
.def_calibration = 19000,
+ .num_cal_offsets = 3,
};
static const struct lvts_data mt8188_lvts_mcu_data = {
@@ -1789,6 +1795,7 @@ static const struct lvts_data mt8188_lvts_mcu_data = {
.temp_offset = LVTS_COEFF_B_MT8195,
.gt_calib_bit_offset = 20,
.def_calibration = 35000,
+ .num_cal_offsets = 3,
};
static const struct lvts_data mt8188_lvts_ap_data = {
@@ -1802,6 +1809,7 @@ static const struct lvts_data mt8188_lvts_ap_data = {
.temp_offset = LVTS_COEFF_B_MT8195,
.gt_calib_bit_offset = 20,
.def_calibration = 35000,
+ .num_cal_offsets = 3,
};
static const struct lvts_data mt8192_lvts_mcu_data = {
@@ -1815,6 +1823,7 @@ static const struct lvts_data mt8192_lvts_mcu_data = {
.temp_offset = LVTS_COEFF_B_MT8195,
.gt_calib_bit_offset = 24,
.def_calibration = 35000,
+ .num_cal_offsets = 3,
};
static const struct lvts_data mt8192_lvts_ap_data = {
@@ -1828,6 +1837,7 @@ static const struct lvts_data mt8192_lvts_ap_data = {
.temp_offset = LVTS_COEFF_B_MT8195,
.gt_calib_bit_offset = 24,
.def_calibration = 35000,
+ .num_cal_offsets = 3,
};
static const struct lvts_data mt8195_lvts_mcu_data = {
@@ -1841,6 +1851,7 @@ static const struct lvts_data mt8195_lvts_mcu_data = {
.temp_offset = LVTS_COEFF_B_MT8195,
.gt_calib_bit_offset = 24,
.def_calibration = 35000,
+ .num_cal_offsets = 3,
};
static const struct lvts_data mt8195_lvts_ap_data = {
@@ -1854,6 +1865,7 @@ static const struct lvts_data mt8195_lvts_ap_data = {
.temp_offset = LVTS_COEFF_B_MT8195,
.gt_calib_bit_offset = 24,
.def_calibration = 35000,
+ .num_cal_offsets = 3,
};
static const struct of_device_id lvts_of_match[] = {
--
2.39.5
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH v4 2/9] thermal/drivers/mediatek/lvts: Make number of calibration offsets configurable
2025-11-21 11:16 ` [PATCH v4 2/9] thermal/drivers/mediatek/lvts: Make number of calibration offsets configurable Laura Nao
@ 2025-11-24 18:25 ` Daniel Lezcano
2025-11-25 11:06 ` Laura Nao
0 siblings, 1 reply; 18+ messages in thread
From: Daniel Lezcano @ 2025-11-24 18:25 UTC (permalink / raw)
To: Laura Nao, srini, robh, krzk+dt, conor+dt, rafael, rui.zhang,
lukasz.luba, matthias.bgg, angelogioacchino.delregno
Cc: nfraprado, arnd, colin.i.king, u.kleine-koenig, andrew-ct.chen,
lala.lin, bchihi, frank-w, wenst, fshao, devicetree, linux-kernel,
linux-pm, linux-arm-kernel, linux-mediatek, kernel
On 11/21/25 12:16, Laura Nao wrote:
> MT8196/MT6991 use 2-byte eFuse calibration data, whereas other SoCs
> supported by the driver rely on 3 bytes. Make the number of calibration
> bytes per sensor configurable, enabling support for SoCs with varying
> calibration formats.
>
> Reviewed-by: Fei Shao <fshao@chromium.org>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> Tested-by: Frank Wunderlich <frank-w@public-files.de>
> Signed-off-by: Laura Nao <laura.nao@collabora.com>
> ---
> drivers/thermal/mediatek/lvts_thermal.c | 32 ++++++++++++++++++++++----------
> 1 file changed, 22 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
> index ab55b20cda47..1c54d0b75b1a 100644
> --- a/drivers/thermal/mediatek/lvts_thermal.c
> +++ b/drivers/thermal/mediatek/lvts_thermal.c
> @@ -96,12 +96,14 @@
>
> #define LVTS_MINIMUM_THRESHOLD 20000
>
> +#define LVTS_MAX_CAL_OFFSETS 3
I suggest LVTS_NUM_CAL_OFFSETS then below,
> +
> static int golden_temp = LVTS_GOLDEN_TEMP_DEFAULT;
> static int golden_temp_offset;
>
> struct lvts_sensor_data {
> int dt_id;
> - u8 cal_offsets[3];
> + u8 cal_offsets[LVTS_MAX_CAL_OFFSETS];
> };
>
> struct lvts_ctrl_data {
> @@ -127,6 +129,7 @@ struct lvts_data {
> const struct lvts_ctrl_data *lvts_ctrl;
> const u32 *conn_cmd;
> const u32 *init_cmd;
> + int num_cal_offsets;
> int num_lvts_ctrl;
> int num_conn_cmd;
> int num_init_cmd;
> @@ -711,7 +714,7 @@ static int lvts_calibration_init(struct device *dev, struct lvts_ctrl *lvts_ctrl
> u8 *efuse_calibration,
> size_t calib_len)
> {
> - int i;
> + int i, j;
> u32 gt;
>
> /* A zero value for gt means that device has invalid efuse data */
> @@ -720,17 +723,18 @@ static int lvts_calibration_init(struct device *dev, struct lvts_ctrl *lvts_ctrl
> lvts_for_each_valid_sensor(i, lvts_ctrl_data) {
> const struct lvts_sensor_data *sensor =
> &lvts_ctrl_data->lvts_sensor[i];
> + u32 calib = 0;
>
> - if (sensor->cal_offsets[0] >= calib_len ||
> - sensor->cal_offsets[1] >= calib_len ||
> - sensor->cal_offsets[2] >= calib_len)
> - return -EINVAL;
> + for (j = 0; j < lvts_ctrl->lvts_data->num_cal_offsets; j++) {
> + u8 offset = sensor->cal_offsets[j];
> +
> + if (offset >= calib_len)
> + return -EINVAL;
> + calib |= efuse_calibration[offset] << (8 * j);
May be worth for a comment here, ideally a separate function to clarify
the code
> + }
>
> if (gt) {
> - lvts_ctrl->calibration[i] =
> - (efuse_calibration[sensor->cal_offsets[0]] << 0) +
> - (efuse_calibration[sensor->cal_offsets[1]] << 8) +
> - (efuse_calibration[sensor->cal_offsets[2]] << 16);
> + lvts_ctrl->calibration[i] = calib;
> } else if (lvts_ctrl->lvts_data->def_calibration) {
> lvts_ctrl->calibration[i] = lvts_ctrl->lvts_data->def_calibration;
> } else {
> @@ -1763,6 +1767,7 @@ static const struct lvts_data mt7988_lvts_ap_data = {
> .temp_factor = LVTS_COEFF_A_MT7988,
> .temp_offset = LVTS_COEFF_B_MT7988,
> .gt_calib_bit_offset = 24,
> + .num_cal_offsets = 3,
LVTS_NUM_CAL_OFFSETS
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH v4 2/9] thermal/drivers/mediatek/lvts: Make number of calibration offsets configurable
2025-11-24 18:25 ` Daniel Lezcano
@ 2025-11-25 11:06 ` Laura Nao
0 siblings, 0 replies; 18+ messages in thread
From: Laura Nao @ 2025-11-25 11:06 UTC (permalink / raw)
To: daniel.lezcano
Cc: andrew-ct.chen, angelogioacchino.delregno, arnd, bchihi,
colin.i.king, conor+dt, devicetree, frank-w, fshao, kernel,
krzk+dt, lala.lin, laura.nao, linux-arm-kernel, linux-kernel,
linux-mediatek, linux-pm, lukasz.luba, matthias.bgg, nfraprado,
rafael, robh, rui.zhang, srini, u.kleine-koenig, wenst
On 11/24/25 19:25, Daniel Lezcano wrote:
> On 11/21/25 12:16, Laura Nao wrote:
>> MT8196/MT6991 use 2-byte eFuse calibration data, whereas other SoCs
>> supported by the driver rely on 3 bytes. Make the number of calibration
>> bytes per sensor configurable, enabling support for SoCs with varying
>> calibration formats.
>>
>> Reviewed-by: Fei Shao <fshao@chromium.org>
>> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>> Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>> Tested-by: Frank Wunderlich <frank-w@public-files.de>
>> Signed-off-by: Laura Nao <laura.nao@collabora.com>
>> ---
>> drivers/thermal/mediatek/lvts_thermal.c | 32 ++++++++++++++++++++++----------
>> 1 file changed, 22 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
>> index ab55b20cda47..1c54d0b75b1a 100644
>> --- a/drivers/thermal/mediatek/lvts_thermal.c
>> +++ b/drivers/thermal/mediatek/lvts_thermal.c
>> @@ -96,12 +96,14 @@
>> #define LVTS_MINIMUM_THRESHOLD 20000
>> +#define LVTS_MAX_CAL_OFFSETS 3
>
> I suggest LVTS_NUM_CAL_OFFSETS then below,
>
Right - as this is SoC-specific, I can define:
#define LVTS_NUM_CAL_OFFSETS_MT7988 3
#define LVTS_NUM_CAL_OFFSETS_MT8196 2
>> +
>> static int golden_temp = LVTS_GOLDEN_TEMP_DEFAULT;
>> static int golden_temp_offset;
>> struct lvts_sensor_data {
>> int dt_id;
>> - u8 cal_offsets[3];
>> + u8 cal_offsets[LVTS_MAX_CAL_OFFSETS];
>> };
>> struct lvts_ctrl_data {
>> @@ -127,6 +129,7 @@ struct lvts_data {
>> const struct lvts_ctrl_data *lvts_ctrl;
>> const u32 *conn_cmd;
>> const u32 *init_cmd;
>> + int num_cal_offsets;
>> int num_lvts_ctrl;
>> int num_conn_cmd;
>> int num_init_cmd;
>> @@ -711,7 +714,7 @@ static int lvts_calibration_init(struct device *dev, struct lvts_ctrl *lvts_ctrl
>> u8 *efuse_calibration,
>> size_t calib_len)
>> {
>> - int i;
>> + int i, j;
>> u32 gt;
>> /* A zero value for gt means that device has invalid efuse data */
>> @@ -720,17 +723,18 @@ static int lvts_calibration_init(struct device *dev, struct lvts_ctrl *lvts_ctrl
>> lvts_for_each_valid_sensor(i, lvts_ctrl_data) {
>> const struct lvts_sensor_data *sensor =
>> &lvts_ctrl_data->lvts_sensor[i];
>> + u32 calib = 0;
>> - if (sensor->cal_offsets[0] >= calib_len ||
>> - sensor->cal_offsets[1] >= calib_len ||
>> - sensor->cal_offsets[2] >= calib_len)
>> - return -EINVAL;
>> + for (j = 0; j < lvts_ctrl->lvts_data->num_cal_offsets; j++) {
>> + u8 offset = sensor->cal_offsets[j];
>> +
>> + if (offset >= calib_len)
>> + return -EINVAL;
>> + calib |= efuse_calibration[offset] << (8 * j);
>
> May be worth for a comment here, ideally a separate function to clarify the code
>
Ack - will do.
>> + }
>> if (gt) {
>> - lvts_ctrl->calibration[i] =
>> - (efuse_calibration[sensor->cal_offsets[0]] << 0) +
>> - (efuse_calibration[sensor->cal_offsets[1]] << 8) +
>> - (efuse_calibration[sensor->cal_offsets[2]] << 16);
>> + lvts_ctrl->calibration[i] = calib;
>> } else if (lvts_ctrl->lvts_data->def_calibration) {
>> lvts_ctrl->calibration[i] = lvts_ctrl->lvts_data->def_calibration;
>> } else {
>> @@ -1763,6 +1767,7 @@ static const struct lvts_data mt7988_lvts_ap_data = {
>> .temp_factor = LVTS_COEFF_A_MT7988,
>> .temp_offset = LVTS_COEFF_B_MT7988,
>> .gt_calib_bit_offset = 24,
>> + .num_cal_offsets = 3,
>
> LVTS_NUM_CAL_OFFSETS
>
>
I'll submit a v5 with the required changes.
Thanks!
Laura
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v4 3/9] thermal/drivers/mediatek/lvts: Fail probe if temp_factor is zero
2025-11-21 11:16 [PATCH v4 0/9] Add thermal sensor driver support for Mediatek MT8196 Laura Nao
2025-11-21 11:16 ` [PATCH v4 1/9] dt-bindings: thermal: mediatek: Add LVTS thermal controller support for MT8196 Laura Nao
2025-11-21 11:16 ` [PATCH v4 2/9] thermal/drivers/mediatek/lvts: Make number of calibration offsets configurable Laura Nao
@ 2025-11-21 11:16 ` Laura Nao
2025-11-21 13:00 ` AngeloGioacchino Del Regno
2025-11-24 17:56 ` Daniel Lezcano
2025-11-21 11:16 ` [PATCH v4 4/9] thermal: mediatek: lvts: Add platform ops to support alternative conversion logic Laura Nao
` (5 subsequent siblings)
8 siblings, 2 replies; 18+ messages in thread
From: Laura Nao @ 2025-11-21 11:16 UTC (permalink / raw)
To: srini, robh, krzk+dt, conor+dt, rafael, daniel.lezcano, rui.zhang,
lukasz.luba, matthias.bgg, angelogioacchino.delregno
Cc: nfraprado, arnd, colin.i.king, u.kleine-koenig, andrew-ct.chen,
lala.lin, bchihi, frank-w, wenst, fshao, devicetree, linux-kernel,
linux-pm, linux-arm-kernel, linux-mediatek, kernel, Laura Nao
temp_factor is used in lvts_temp_to_raw() and lvts_raw_to_temp(). If
platform data is incorrect and temp_factor is zero, it could cause a
division by zero. Fail the probe early to prevent a kernel crash.
Signed-off-by: Laura Nao <laura.nao@collabora.com>
---
drivers/thermal/mediatek/lvts_thermal.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
index 1c54d0b75b1a..b49441d82ffd 100644
--- a/drivers/thermal/mediatek/lvts_thermal.c
+++ b/drivers/thermal/mediatek/lvts_thermal.c
@@ -1346,6 +1346,11 @@ static int lvts_probe(struct platform_device *pdev)
if (irq < 0)
return irq;
+ if (!lvts_data->temp_factor)
+ return dev_err_probe(
+ dev, -EINVAL,
+ "temp_factor should never be zero; check platform data.\n");
+
golden_temp_offset = lvts_data->temp_offset;
ret = lvts_domain_init(dev, lvts_td, lvts_data);
--
2.39.5
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH v4 3/9] thermal/drivers/mediatek/lvts: Fail probe if temp_factor is zero
2025-11-21 11:16 ` [PATCH v4 3/9] thermal/drivers/mediatek/lvts: Fail probe if temp_factor is zero Laura Nao
@ 2025-11-21 13:00 ` AngeloGioacchino Del Regno
2025-11-24 17:56 ` Daniel Lezcano
1 sibling, 0 replies; 18+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-11-21 13:00 UTC (permalink / raw)
To: Laura Nao, srini, robh, krzk+dt, conor+dt, rafael, daniel.lezcano,
rui.zhang, lukasz.luba, matthias.bgg
Cc: nfraprado, arnd, colin.i.king, u.kleine-koenig, andrew-ct.chen,
lala.lin, bchihi, frank-w, wenst, fshao, devicetree, linux-kernel,
linux-pm, linux-arm-kernel, linux-mediatek, kernel
Il 21/11/25 12:16, Laura Nao ha scritto:
> temp_factor is used in lvts_temp_to_raw() and lvts_raw_to_temp(). If
> platform data is incorrect and temp_factor is zero, it could cause a
> division by zero. Fail the probe early to prevent a kernel crash.
>
> Signed-off-by: Laura Nao <laura.nao@collabora.com>
> ---
> drivers/thermal/mediatek/lvts_thermal.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
> index 1c54d0b75b1a..b49441d82ffd 100644
> --- a/drivers/thermal/mediatek/lvts_thermal.c
> +++ b/drivers/thermal/mediatek/lvts_thermal.c
> @@ -1346,6 +1346,11 @@ static int lvts_probe(struct platform_device *pdev)
> if (irq < 0)
> return irq;
>
> + if (!lvts_data->temp_factor)
> + return dev_err_probe(
> + dev, -EINVAL,
> + "temp_factor should never be zero; check platform data.\n");
> +
return dev_err_probe(dev, -EINVAL,
"temp_factor should never be zero; check platform data.\n");
That's the only nitpick that I've got here, and I'm fine either way, anyway, as
this then kind of boils down to personal preference, in a way.
So, regardless of this getting fixed (by the maintainer or by you) or not:
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> golden_temp_offset = lvts_data->temp_offset;
>
> ret = lvts_domain_init(dev, lvts_td, lvts_data);
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v4 3/9] thermal/drivers/mediatek/lvts: Fail probe if temp_factor is zero
2025-11-21 11:16 ` [PATCH v4 3/9] thermal/drivers/mediatek/lvts: Fail probe if temp_factor is zero Laura Nao
2025-11-21 13:00 ` AngeloGioacchino Del Regno
@ 2025-11-24 17:56 ` Daniel Lezcano
2025-11-25 11:08 ` Laura Nao
1 sibling, 1 reply; 18+ messages in thread
From: Daniel Lezcano @ 2025-11-24 17:56 UTC (permalink / raw)
To: Laura Nao, srini, robh, krzk+dt, conor+dt, rafael, rui.zhang,
lukasz.luba, matthias.bgg, angelogioacchino.delregno
Cc: nfraprado, arnd, colin.i.king, u.kleine-koenig, andrew-ct.chen,
lala.lin, bchihi, frank-w, wenst, fshao, devicetree, linux-kernel,
linux-pm, linux-arm-kernel, linux-mediatek, kernel
On 11/21/25 12:16, Laura Nao wrote:
> temp_factor is used in lvts_temp_to_raw() and lvts_raw_to_temp(). If
> platform data is incorrect and temp_factor is zero, it could cause a
> division by zero. Fail the probe early to prevent a kernel crash.
>
> Signed-off-by: Laura Nao <laura.nao@collabora.com>
> ---
> drivers/thermal/mediatek/lvts_thermal.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
> index 1c54d0b75b1a..b49441d82ffd 100644
> --- a/drivers/thermal/mediatek/lvts_thermal.c
> +++ b/drivers/thermal/mediatek/lvts_thermal.c
> @@ -1346,6 +1346,11 @@ static int lvts_probe(struct platform_device *pdev)
> if (irq < 0)
> return irq;
>
> + if (!lvts_data->temp_factor)
> + return dev_err_probe(
> + dev, -EINVAL,
> + "temp_factor should never be zero; check platform data.\n");
> +
From my POV, this is not really useful. The temp_factor is set for each
version statically in the code. The scope is limited to the driver, IOW
it is not a parameter other subsystems passes to the driver.
If it is NULL, then shame on the submitter who did not test the driver
before sending ;)
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v4 3/9] thermal/drivers/mediatek/lvts: Fail probe if temp_factor is zero
2025-11-24 17:56 ` Daniel Lezcano
@ 2025-11-25 11:08 ` Laura Nao
0 siblings, 0 replies; 18+ messages in thread
From: Laura Nao @ 2025-11-25 11:08 UTC (permalink / raw)
To: daniel.lezcano
Cc: andrew-ct.chen, angelogioacchino.delregno, arnd, bchihi,
colin.i.king, conor+dt, devicetree, frank-w, fshao, kernel,
krzk+dt, lala.lin, laura.nao, linux-arm-kernel, linux-kernel,
linux-mediatek, linux-pm, lukasz.luba, matthias.bgg, nfraprado,
rafael, robh, rui.zhang, srini, u.kleine-koenig, wenst
On 11/24/25 18:56, Daniel Lezcano wrote:
> On 11/21/25 12:16, Laura Nao wrote:
>> temp_factor is used in lvts_temp_to_raw() and lvts_raw_to_temp(). If
>> platform data is incorrect and temp_factor is zero, it could cause a
>> division by zero. Fail the probe early to prevent a kernel crash.
>>
>> Signed-off-by: Laura Nao <laura.nao@collabora.com>
>> ---
>> drivers/thermal/mediatek/lvts_thermal.c | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
>> index 1c54d0b75b1a..b49441d82ffd 100644
>> --- a/drivers/thermal/mediatek/lvts_thermal.c
>> +++ b/drivers/thermal/mediatek/lvts_thermal.c
>> @@ -1346,6 +1346,11 @@ static int lvts_probe(struct platform_device *pdev)
>> if (irq < 0)
>> return irq;
>> + if (!lvts_data->temp_factor)
>> + return dev_err_probe(
>> + dev, -EINVAL,
>> + "temp_factor should never be zero; check platform data.\n");
>> +
>
> From my POV, this is not really useful. The temp_factor is set for each version statically in the code. The scope is limited to the driver, IOW it is not a parameter other subsystems passes to the driver.
>
> If it is NULL, then shame on the submitter who did not test the driver before sending ;)
>
Ack - I'll drop the patch in the next revision.
Thanks,
Laura
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v4 4/9] thermal: mediatek: lvts: Add platform ops to support alternative conversion logic
2025-11-21 11:16 [PATCH v4 0/9] Add thermal sensor driver support for Mediatek MT8196 Laura Nao
` (2 preceding siblings ...)
2025-11-21 11:16 ` [PATCH v4 3/9] thermal/drivers/mediatek/lvts: Fail probe if temp_factor is zero Laura Nao
@ 2025-11-21 11:16 ` Laura Nao
2025-11-21 13:00 ` AngeloGioacchino Del Regno
2025-11-21 11:16 ` [PATCH v4 5/9] thermal/drivers/mediatek/lvts: Add lvts_temp_to_raw variant Laura Nao
` (4 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Laura Nao @ 2025-11-21 11:16 UTC (permalink / raw)
To: srini, robh, krzk+dt, conor+dt, rafael, daniel.lezcano, rui.zhang,
lukasz.luba, matthias.bgg, angelogioacchino.delregno
Cc: nfraprado, arnd, colin.i.king, u.kleine-koenig, andrew-ct.chen,
lala.lin, bchihi, frank-w, wenst, fshao, devicetree, linux-kernel,
linux-pm, linux-arm-kernel, linux-mediatek, kernel, Laura Nao
Introduce lvts_platform_ops struct to support SoC-specific versions of
lvts_raw_to_temp() and lvts_temp_to_raw() conversion functions.
This is in preparation for supporting SoCs like MT8196/MT6991, which
require a different lvts_temp_to_raw() implementation.
Signed-off-by: Laura Nao <laura.nao@collabora.com>
---
drivers/thermal/mediatek/lvts_thermal.c | 39 ++++++++++++++++++++++++++++-----
1 file changed, 34 insertions(+), 5 deletions(-)
diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
index b49441d82ffd..d713c46c21fc 100644
--- a/drivers/thermal/mediatek/lvts_thermal.c
+++ b/drivers/thermal/mediatek/lvts_thermal.c
@@ -125,8 +125,14 @@ struct lvts_ctrl_data {
continue; \
else
+struct lvts_platform_ops {
+ int (*lvts_raw_to_temp)(u32 raw_temp, int temp_factor);
+ u32 (*lvts_temp_to_raw)(int temperature, int temp_factor);
+};
+
struct lvts_data {
const struct lvts_ctrl_data *lvts_ctrl;
+ const struct lvts_platform_ops *ops;
const u32 *conn_cmd;
const u32 *init_cmd;
int num_cal_offsets;
@@ -272,7 +278,17 @@ static inline int lvts_debugfs_init(struct device *dev,
#endif
-static int lvts_raw_to_temp(u32 raw_temp, int temp_factor)
+static int lvts_raw_to_temp(u32 raw_temp, const struct lvts_data *lvts_data)
+{
+ return lvts_data->ops->lvts_raw_to_temp(raw_temp & 0xFFFF, lvts_data->temp_factor);
+}
+
+static u32 lvts_temp_to_raw(int temperature, const struct lvts_data *lvts_data)
+{
+ return lvts_data->ops->lvts_temp_to_raw(temperature, lvts_data->temp_factor);
+}
+
+static int lvts_raw_to_temp_mt7988(u32 raw_temp, int temp_factor)
{
int temperature;
@@ -282,7 +298,7 @@ static int lvts_raw_to_temp(u32 raw_temp, int temp_factor)
return temperature;
}
-static u32 lvts_temp_to_raw(int temperature, int temp_factor)
+static u32 lvts_temp_to_raw_mt7988(int temperature, int temp_factor)
{
u32 raw_temp = ((s64)(golden_temp_offset - temperature)) << 14;
@@ -329,7 +345,7 @@ static int lvts_get_temp(struct thermal_zone_device *tz, int *temp)
if (rc)
return -EAGAIN;
- *temp = lvts_raw_to_temp(value & 0xFFFF, lvts_data->temp_factor);
+ *temp = lvts_raw_to_temp(value, lvts_data);
return 0;
}
@@ -399,8 +415,8 @@ static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high)
const struct lvts_data *lvts_data = lvts_ctrl->lvts_data;
void __iomem *base = lvts_sensor->base;
u32 raw_low = lvts_temp_to_raw(low != -INT_MAX ? low : LVTS_MINIMUM_THRESHOLD,
- lvts_data->temp_factor);
- u32 raw_high = lvts_temp_to_raw(high, lvts_data->temp_factor);
+ lvts_data);
+ u32 raw_high = lvts_temp_to_raw(high, lvts_data);
bool should_update_thresh;
lvts_sensor->low_thresh = low;
@@ -1762,6 +1778,11 @@ static const struct lvts_ctrl_data mt8195_lvts_ap_data_ctrl[] = {
}
};
+static const struct lvts_platform_ops lvts_platform_ops_mt7988 = {
+ .lvts_raw_to_temp = lvts_raw_to_temp_mt7988,
+ .lvts_temp_to_raw = lvts_temp_to_raw_mt7988,
+};
+
static const struct lvts_data mt7988_lvts_ap_data = {
.lvts_ctrl = mt7988_lvts_ap_data_ctrl,
.conn_cmd = mt7988_conn_cmds,
@@ -1773,6 +1794,7 @@ static const struct lvts_data mt7988_lvts_ap_data = {
.temp_offset = LVTS_COEFF_B_MT7988,
.gt_calib_bit_offset = 24,
.num_cal_offsets = 3,
+ .ops = &lvts_platform_ops_mt7988,
};
static const struct lvts_data mt8186_lvts_data = {
@@ -1787,6 +1809,7 @@ static const struct lvts_data mt8186_lvts_data = {
.gt_calib_bit_offset = 24,
.def_calibration = 19000,
.num_cal_offsets = 3,
+ .ops = &lvts_platform_ops_mt7988,
};
static const struct lvts_data mt8188_lvts_mcu_data = {
@@ -1801,6 +1824,7 @@ static const struct lvts_data mt8188_lvts_mcu_data = {
.gt_calib_bit_offset = 20,
.def_calibration = 35000,
.num_cal_offsets = 3,
+ .ops = &lvts_platform_ops_mt7988,
};
static const struct lvts_data mt8188_lvts_ap_data = {
@@ -1815,6 +1839,7 @@ static const struct lvts_data mt8188_lvts_ap_data = {
.gt_calib_bit_offset = 20,
.def_calibration = 35000,
.num_cal_offsets = 3,
+ .ops = &lvts_platform_ops_mt7988,
};
static const struct lvts_data mt8192_lvts_mcu_data = {
@@ -1829,6 +1854,7 @@ static const struct lvts_data mt8192_lvts_mcu_data = {
.gt_calib_bit_offset = 24,
.def_calibration = 35000,
.num_cal_offsets = 3,
+ .ops = &lvts_platform_ops_mt7988,
};
static const struct lvts_data mt8192_lvts_ap_data = {
@@ -1843,6 +1869,7 @@ static const struct lvts_data mt8192_lvts_ap_data = {
.gt_calib_bit_offset = 24,
.def_calibration = 35000,
.num_cal_offsets = 3,
+ .ops = &lvts_platform_ops_mt7988,
};
static const struct lvts_data mt8195_lvts_mcu_data = {
@@ -1857,6 +1884,7 @@ static const struct lvts_data mt8195_lvts_mcu_data = {
.gt_calib_bit_offset = 24,
.def_calibration = 35000,
.num_cal_offsets = 3,
+ .ops = &lvts_platform_ops_mt7988,
};
static const struct lvts_data mt8195_lvts_ap_data = {
@@ -1871,6 +1899,7 @@ static const struct lvts_data mt8195_lvts_ap_data = {
.gt_calib_bit_offset = 24,
.def_calibration = 35000,
.num_cal_offsets = 3,
+ .ops = &lvts_platform_ops_mt7988,
};
static const struct of_device_id lvts_of_match[] = {
--
2.39.5
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH v4 4/9] thermal: mediatek: lvts: Add platform ops to support alternative conversion logic
2025-11-21 11:16 ` [PATCH v4 4/9] thermal: mediatek: lvts: Add platform ops to support alternative conversion logic Laura Nao
@ 2025-11-21 13:00 ` AngeloGioacchino Del Regno
2025-11-21 13:02 ` Frank Wunderlich
0 siblings, 1 reply; 18+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-11-21 13:00 UTC (permalink / raw)
To: Laura Nao, srini, robh, krzk+dt, conor+dt, rafael, daniel.lezcano,
rui.zhang, lukasz.luba, matthias.bgg
Cc: nfraprado, arnd, colin.i.king, u.kleine-koenig, andrew-ct.chen,
lala.lin, bchihi, frank-w, wenst, fshao, devicetree, linux-kernel,
linux-pm, linux-arm-kernel, linux-mediatek, kernel
Il 21/11/25 12:16, Laura Nao ha scritto:
> Introduce lvts_platform_ops struct to support SoC-specific versions of
> lvts_raw_to_temp() and lvts_temp_to_raw() conversion functions.
>
> This is in preparation for supporting SoCs like MT8196/MT6991, which
> require a different lvts_temp_to_raw() implementation.
>
> Signed-off-by: Laura Nao <laura.nao@collabora.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v4 4/9] thermal: mediatek: lvts: Add platform ops to support alternative conversion logic
2025-11-21 13:00 ` AngeloGioacchino Del Regno
@ 2025-11-21 13:02 ` Frank Wunderlich
2025-11-25 11:10 ` Laura Nao
0 siblings, 1 reply; 18+ messages in thread
From: Frank Wunderlich @ 2025-11-21 13:02 UTC (permalink / raw)
To: AngeloGioacchino Del Regno, Laura Nao, srini, robh, krzk+dt,
conor+dt, rafael, daniel.lezcano, rui.zhang, lukasz.luba,
matthias.bgg
Cc: nfraprado, arnd, colin.i.king, u.kleine-koenig, andrew-ct.chen,
lala.lin, bchihi, wenst, fshao, devicetree, linux-kernel,
linux-pm, linux-arm-kernel, linux-mediatek, kernel
Am 21. November 2025 14:00:29 MEZ schrieb AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>:
>Il 21/11/25 12:16, Laura Nao ha scritto:
>> Introduce lvts_platform_ops struct to support SoC-specific versions of
>> lvts_raw_to_temp() and lvts_temp_to_raw() conversion functions.
>>
>> This is in preparation for supporting SoCs like MT8196/MT6991, which
>> require a different lvts_temp_to_raw() implementation.
>>
>> Signed-off-by: Laura Nao <laura.nao@collabora.com>
>
>Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>
>
Should this patch not have same prefix like the others?
regards Frank
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH v4 4/9] thermal: mediatek: lvts: Add platform ops to support alternative conversion logic
2025-11-21 13:02 ` Frank Wunderlich
@ 2025-11-25 11:10 ` Laura Nao
0 siblings, 0 replies; 18+ messages in thread
From: Laura Nao @ 2025-11-25 11:10 UTC (permalink / raw)
To: frank-w
Cc: andrew-ct.chen, angelogioacchino.delregno, arnd, bchihi,
colin.i.king, conor+dt, daniel.lezcano, devicetree, fshao, kernel,
krzk+dt, lala.lin, laura.nao, linux-arm-kernel, linux-kernel,
linux-mediatek, linux-pm, lukasz.luba, matthias.bgg, nfraprado,
rafael, robh, rui.zhang, srini, u.kleine-koenig, wenst
On 11/21/25 14:02, Frank Wunderlich wrote:
> Am 21. November 2025 14:00:29 MEZ schrieb AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>:
>> Il 21/11/25 12:16, Laura Nao ha scritto:
>>> Introduce lvts_platform_ops struct to support SoC-specific versions of
>>> lvts_raw_to_temp() and lvts_temp_to_raw() conversion functions.
>>>
>>> This is in preparation for supporting SoCs like MT8196/MT6991, which
>>> require a different lvts_temp_to_raw() implementation.
>>>
>>> Signed-off-by: Laura Nao <laura.nao@collabora.com>
>>
>> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>>
>>
>
> Should this patch not have same prefix like the others?
>
>
Whoops, that's right. I'll fix this, thanks for the heads up!
Best,
Laura
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v4 5/9] thermal/drivers/mediatek/lvts: Add lvts_temp_to_raw variant
2025-11-21 11:16 [PATCH v4 0/9] Add thermal sensor driver support for Mediatek MT8196 Laura Nao
` (3 preceding siblings ...)
2025-11-21 11:16 ` [PATCH v4 4/9] thermal: mediatek: lvts: Add platform ops to support alternative conversion logic Laura Nao
@ 2025-11-21 11:16 ` Laura Nao
2025-11-21 11:16 ` [PATCH v4 6/9] thermal/drivers/mediatek/lvts: Add support for ATP mode Laura Nao
` (3 subsequent siblings)
8 siblings, 0 replies; 18+ messages in thread
From: Laura Nao @ 2025-11-21 11:16 UTC (permalink / raw)
To: srini, robh, krzk+dt, conor+dt, rafael, daniel.lezcano, rui.zhang,
lukasz.luba, matthias.bgg, angelogioacchino.delregno
Cc: nfraprado, arnd, colin.i.king, u.kleine-koenig, andrew-ct.chen,
lala.lin, bchihi, frank-w, wenst, fshao, devicetree, linux-kernel,
linux-pm, linux-arm-kernel, linux-mediatek, kernel, Laura Nao
MT8196/MT6991 require a different version of lvts_temp_to_raw(),
specifically the multiplicative inverse of the existing implementation.
Introduce a variant of the function with inverted calculation logic to
match this requirement.
This ensures accurate raw value generation for temperature
thresholds, avoiding spurious thermal interrupts or unintended hardware
resets on MT8196/MT6991.
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Fei Shao <fshao@chromium.org>
Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de>
Signed-off-by: Laura Nao <laura.nao@collabora.com>
---
drivers/thermal/mediatek/lvts_thermal.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
index d713c46c21fc..3e05b29f7b05 100644
--- a/drivers/thermal/mediatek/lvts_thermal.c
+++ b/drivers/thermal/mediatek/lvts_thermal.c
@@ -307,6 +307,15 @@ static u32 lvts_temp_to_raw_mt7988(int temperature, int temp_factor)
return raw_temp;
}
+static u32 lvts_temp_to_raw_mt8196(int temperature, int temp_factor)
+{
+ u32 raw_temp;
+
+ raw_temp = temperature - golden_temp_offset;
+
+ return div_s64((s64)temp_factor << 14, raw_temp);
+}
+
static int lvts_get_temp(struct thermal_zone_device *tz, int *temp)
{
struct lvts_sensor *lvts_sensor = thermal_zone_device_priv(tz);
--
2.39.5
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v4 6/9] thermal/drivers/mediatek/lvts: Add support for ATP mode
2025-11-21 11:16 [PATCH v4 0/9] Add thermal sensor driver support for Mediatek MT8196 Laura Nao
` (4 preceding siblings ...)
2025-11-21 11:16 ` [PATCH v4 5/9] thermal/drivers/mediatek/lvts: Add lvts_temp_to_raw variant Laura Nao
@ 2025-11-21 11:16 ` Laura Nao
2025-11-21 11:16 ` [PATCH v4 7/9] thermal/drivers/mediatek/lvts: Support MSR offset for 16-bit calibration data Laura Nao
` (2 subsequent siblings)
8 siblings, 0 replies; 18+ messages in thread
From: Laura Nao @ 2025-11-21 11:16 UTC (permalink / raw)
To: srini, robh, krzk+dt, conor+dt, rafael, daniel.lezcano, rui.zhang,
lukasz.luba, matthias.bgg, angelogioacchino.delregno
Cc: nfraprado, arnd, colin.i.king, u.kleine-koenig, andrew-ct.chen,
lala.lin, bchihi, frank-w, wenst, fshao, devicetree, linux-kernel,
linux-pm, linux-arm-kernel, linux-mediatek, kernel, Laura Nao
MT8196/MT6991 uses ATP (Abnormal Temperature Prevention) mode to detect
abnormal temperature conditions, which involves reading temperature data
from a dedicated set of registers separate from the ones used for
immediate and filtered modes.
Add support for ATP mode and its relative registers to ensure accurate
temperature readings and proper thermal management on MT8196/MT6991
devices.
While at it, convert mode defines to enum.
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Fei Shao <fshao@chromium.org>
Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de>
Signed-off-by: Laura Nao <laura.nao@collabora.com>
---
drivers/thermal/mediatek/lvts_thermal.c | 44 +++++++++++++++++++++++++++------
1 file changed, 37 insertions(+), 7 deletions(-)
diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
index 3e05b29f7b05..d1bfbcb1a7d0 100644
--- a/drivers/thermal/mediatek/lvts_thermal.c
+++ b/drivers/thermal/mediatek/lvts_thermal.c
@@ -44,6 +44,10 @@
#define LVTS_EDATA01(__base) (__base + 0x0058)
#define LVTS_EDATA02(__base) (__base + 0x005C)
#define LVTS_EDATA03(__base) (__base + 0x0060)
+#define LVTS_ATP0(__base) (__base + 0x0070)
+#define LVTS_ATP1(__base) (__base + 0x0074)
+#define LVTS_ATP2(__base) (__base + 0x0078)
+#define LVTS_ATP3(__base) (__base + 0x007C)
#define LVTS_MSR0(__base) (__base + 0x0090)
#define LVTS_MSR1(__base) (__base + 0x0094)
#define LVTS_MSR2(__base) (__base + 0x0098)
@@ -88,9 +92,6 @@
#define LVTS_COEFF_A_MT7988 -204650
#define LVTS_COEFF_B_MT7988 204650
-#define LVTS_MSR_IMMEDIATE_MODE 0
-#define LVTS_MSR_FILTERED_MODE 1
-
#define LVTS_MSR_READ_TIMEOUT_US 400
#define LVTS_MSR_READ_WAIT_US (LVTS_MSR_READ_TIMEOUT_US / 2)
@@ -101,6 +102,12 @@
static int golden_temp = LVTS_GOLDEN_TEMP_DEFAULT;
static int golden_temp_offset;
+enum lvts_msr_mode {
+ LVTS_MSR_IMMEDIATE_MODE,
+ LVTS_MSR_FILTERED_MODE,
+ LVTS_MSR_ATP_MODE,
+};
+
struct lvts_sensor_data {
int dt_id;
u8 cal_offsets[LVTS_MAX_CAL_OFFSETS];
@@ -110,7 +117,7 @@ struct lvts_ctrl_data {
struct lvts_sensor_data lvts_sensor[LVTS_SENSOR_MAX];
u8 valid_sensor_mask;
int offset;
- int mode;
+ enum lvts_msr_mode mode;
};
#define VALID_SENSOR_MAP(s0, s1, s2, s3) \
@@ -211,6 +218,10 @@ static const struct debugfs_reg32 lvts_regs[] = {
LVTS_DEBUG_FS_REGS(LVTS_EDATA01),
LVTS_DEBUG_FS_REGS(LVTS_EDATA02),
LVTS_DEBUG_FS_REGS(LVTS_EDATA03),
+ LVTS_DEBUG_FS_REGS(LVTS_ATP0),
+ LVTS_DEBUG_FS_REGS(LVTS_ATP1),
+ LVTS_DEBUG_FS_REGS(LVTS_ATP2),
+ LVTS_DEBUG_FS_REGS(LVTS_ATP3),
LVTS_DEBUG_FS_REGS(LVTS_MSR0),
LVTS_DEBUG_FS_REGS(LVTS_MSR1),
LVTS_DEBUG_FS_REGS(LVTS_MSR2),
@@ -627,6 +638,13 @@ static int lvts_sensor_init(struct device *dev, struct lvts_ctrl *lvts_ctrl,
LVTS_IMMD3(lvts_ctrl->base)
};
+ void __iomem *atp_regs[] = {
+ LVTS_ATP0(lvts_ctrl->base),
+ LVTS_ATP1(lvts_ctrl->base),
+ LVTS_ATP2(lvts_ctrl->base),
+ LVTS_ATP3(lvts_ctrl->base)
+ };
+
int i;
lvts_for_each_valid_sensor(i, lvts_ctrl_data) {
@@ -662,8 +680,20 @@ static int lvts_sensor_init(struct device *dev, struct lvts_ctrl *lvts_ctrl,
/*
* Each sensor has its own register address to read from.
*/
- lvts_sensor[i].msr = lvts_ctrl_data->mode == LVTS_MSR_IMMEDIATE_MODE ?
- imm_regs[i] : msr_regs[i];
+ switch (lvts_ctrl_data->mode) {
+ case LVTS_MSR_IMMEDIATE_MODE:
+ lvts_sensor[i].msr = imm_regs[i];
+ break;
+ case LVTS_MSR_FILTERED_MODE:
+ lvts_sensor[i].msr = msr_regs[i];
+ break;
+ case LVTS_MSR_ATP_MODE:
+ lvts_sensor[i].msr = atp_regs[i];
+ break;
+ default:
+ lvts_sensor[i].msr = imm_regs[i];
+ break;
+ }
lvts_sensor[i].low_thresh = INT_MIN;
lvts_sensor[i].high_thresh = INT_MIN;
@@ -913,7 +943,7 @@ static void lvts_ctrl_monitor_enable(struct device *dev, struct lvts_ctrl *lvts_
u32 sensor_map = 0;
int i;
- if (lvts_ctrl->mode != LVTS_MSR_FILTERED_MODE)
+ if (lvts_ctrl->mode == LVTS_MSR_IMMEDIATE_MODE)
return;
if (enable) {
--
2.39.5
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v4 7/9] thermal/drivers/mediatek/lvts: Support MSR offset for 16-bit calibration data
2025-11-21 11:16 [PATCH v4 0/9] Add thermal sensor driver support for Mediatek MT8196 Laura Nao
` (5 preceding siblings ...)
2025-11-21 11:16 ` [PATCH v4 6/9] thermal/drivers/mediatek/lvts: Add support for ATP mode Laura Nao
@ 2025-11-21 11:16 ` Laura Nao
2025-11-21 11:16 ` [PATCH v4 8/9] thermal/drivers/mediatek/lvts_thermal: Add MT8196 support Laura Nao
2025-11-21 11:16 ` [PATCH v4 9/9] dt-bindings: nvmem: mediatek: efuse: Add support for MT8196 Laura Nao
8 siblings, 0 replies; 18+ messages in thread
From: Laura Nao @ 2025-11-21 11:16 UTC (permalink / raw)
To: srini, robh, krzk+dt, conor+dt, rafael, daniel.lezcano, rui.zhang,
lukasz.luba, matthias.bgg, angelogioacchino.delregno
Cc: nfraprado, arnd, colin.i.king, u.kleine-koenig, andrew-ct.chen,
lala.lin, bchihi, frank-w, wenst, fshao, devicetree, linux-kernel,
linux-pm, linux-arm-kernel, linux-mediatek, kernel, Laura Nao
On MT8196/MT6991, per-sensor calibration data read from eFuses is
16-bit. When the LVTS controller operates in 16-bit mode, a fixed offset
must be added to MSR values during post-processing to obtain correct
temperature readings. Introduce a new msr_offset field in lvts_data,
program the respective register and apply the offset to the calibration
data read from eFuses.
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de>
Signed-off-by: Laura Nao <laura.nao@collabora.com>
---
drivers/thermal/mediatek/lvts_thermal.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
index d1bfbcb1a7d0..6558994cbee0 100644
--- a/drivers/thermal/mediatek/lvts_thermal.c
+++ b/drivers/thermal/mediatek/lvts_thermal.c
@@ -44,6 +44,7 @@
#define LVTS_EDATA01(__base) (__base + 0x0058)
#define LVTS_EDATA02(__base) (__base + 0x005C)
#define LVTS_EDATA03(__base) (__base + 0x0060)
+#define LVTS_MSROFT(__base) (__base + 0x006C)
#define LVTS_ATP0(__base) (__base + 0x0070)
#define LVTS_ATP1(__base) (__base + 0x0074)
#define LVTS_ATP2(__base) (__base + 0x0078)
@@ -150,6 +151,7 @@ struct lvts_data {
int temp_offset;
int gt_calib_bit_offset;
unsigned int def_calibration;
+ u16 msr_offset;
};
struct lvts_sensor {
@@ -218,6 +220,7 @@ static const struct debugfs_reg32 lvts_regs[] = {
LVTS_DEBUG_FS_REGS(LVTS_EDATA01),
LVTS_DEBUG_FS_REGS(LVTS_EDATA02),
LVTS_DEBUG_FS_REGS(LVTS_EDATA03),
+ LVTS_DEBUG_FS_REGS(LVTS_MSROFT),
LVTS_DEBUG_FS_REGS(LVTS_ATP0),
LVTS_DEBUG_FS_REGS(LVTS_ATP1),
LVTS_DEBUG_FS_REGS(LVTS_ATP2),
@@ -790,6 +793,8 @@ static int lvts_calibration_init(struct device *dev, struct lvts_ctrl *lvts_ctrl
if (gt) {
lvts_ctrl->calibration[i] = calib;
+ if (lvts_ctrl->lvts_data->msr_offset)
+ lvts_ctrl->calibration[i] += lvts_ctrl->lvts_data->msr_offset;
} else if (lvts_ctrl->lvts_data->def_calibration) {
lvts_ctrl->calibration[i] = lvts_ctrl->lvts_data->def_calibration;
} else {
@@ -1097,6 +1102,17 @@ static int lvts_ctrl_calibrate(struct device *dev, struct lvts_ctrl *lvts_ctrl)
for (i = 0; i < LVTS_SENSOR_MAX; i++)
writel(lvts_ctrl->calibration[i], lvts_edata[i]);
+ /* LVTS_MSROFT : Constant offset applied to MSR values
+ * for post-processing
+ *
+ * Bits:
+ *
+ * 20-0 : Constant data added to MSR values
+ */
+ if (lvts_ctrl->lvts_data->msr_offset)
+ writel(lvts_ctrl->lvts_data->msr_offset,
+ LVTS_MSROFT(lvts_ctrl->base));
+
return 0;
}
--
2.39.5
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v4 8/9] thermal/drivers/mediatek/lvts_thermal: Add MT8196 support
2025-11-21 11:16 [PATCH v4 0/9] Add thermal sensor driver support for Mediatek MT8196 Laura Nao
` (6 preceding siblings ...)
2025-11-21 11:16 ` [PATCH v4 7/9] thermal/drivers/mediatek/lvts: Support MSR offset for 16-bit calibration data Laura Nao
@ 2025-11-21 11:16 ` Laura Nao
2025-11-21 11:16 ` [PATCH v4 9/9] dt-bindings: nvmem: mediatek: efuse: Add support for MT8196 Laura Nao
8 siblings, 0 replies; 18+ messages in thread
From: Laura Nao @ 2025-11-21 11:16 UTC (permalink / raw)
To: srini, robh, krzk+dt, conor+dt, rafael, daniel.lezcano, rui.zhang,
lukasz.luba, matthias.bgg, angelogioacchino.delregno
Cc: nfraprado, arnd, colin.i.king, u.kleine-koenig, andrew-ct.chen,
lala.lin, bchihi, frank-w, wenst, fshao, devicetree, linux-kernel,
linux-pm, linux-arm-kernel, linux-mediatek, kernel, Laura Nao
Add LVTS driver support for MT8196.
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de>
Signed-off-by: Laura Nao <laura.nao@collabora.com>
---
drivers/thermal/mediatek/lvts_thermal.c | 164 ++++++++++++++++++++++++++++++++
1 file changed, 164 insertions(+)
diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
index 6558994cbee0..c1e20150b92c 100644
--- a/drivers/thermal/mediatek/lvts_thermal.c
+++ b/drivers/thermal/mediatek/lvts_thermal.c
@@ -92,6 +92,10 @@
#define LVTS_COEFF_B_MT8195 250460
#define LVTS_COEFF_A_MT7988 -204650
#define LVTS_COEFF_B_MT7988 204650
+#define LVTS_COEFF_A_MT8196 391460
+#define LVTS_COEFF_B_MT8196 -391460
+
+#define LVTS_MSR_OFFSET_MT8196 -984
#define LVTS_MSR_READ_TIMEOUT_US 400
#define LVTS_MSR_READ_WAIT_US (LVTS_MSR_READ_TIMEOUT_US / 2)
@@ -763,6 +767,39 @@ static int lvts_sensor_init(struct device *dev, struct lvts_ctrl *lvts_ctrl,
* <-----ap--tc#3-----> <-----sensor#7-----> <-----sensor#8----->
* 0x40 | 0x41 | 0x42 | 0x43 | 0x44 | 0x45 | 0x46 | 0x47 | 0x48
*
+ * MT8196 :
+ * Stream index map for MCU Domain mt8196 :
+ *
+ * <-sensor#1--> <-sensor#0--> <-sensor#3--> <-sensor#2-->
+ * 0x04 | 0x05 | 0x06 | 0x07 | 0x08 | 0x09 | 0x0A | 0x0B
+ *
+ * <-sensor#5--> <-sensor#4--> <-sensor#7--> <-sensor#6-->
+ * 0x0C | 0x0D | 0x0E | 0x0F | 0x10 | 0x11 | 0x12 | 0x13
+ *
+ * <-sensor#9--> <-sensor#8--> <-sensor#11-> <-sensor#10->
+ * 0x14 | 0x15 | 0x16 | 0x17 | 0x18 | 0x19 | 0x1A | 0X1B
+ *
+ * <-sensor#13-> <-sensor#12-> <-sensor#15-> <-sensor#14->
+ * 0x1C | 0x1D | 0x1E | 0x1F | 0x20 | 0x21 | 0x22 | 0x23
+ *
+ * Stream index map for APU Domain mt8196 :
+ *
+ * <-sensor#1--> <-sensor#0--> <-sensor#3--> <-sensor#2-->
+ * 0x24 | 0x25 | 0x26 | 0x27 | 0x28 | 0x29 | 0x2A | 0x2B
+ *
+ * Stream index map for GPU Domain mt8196 :
+ *
+ * <-sensor#1--> <-sensor#0-->
+ * 0x2C | 0x2D | 0x2E | 0x2F
+ *
+ * Stream index map for AP Domain mt8196 :
+ *
+ * <-sensor#1--> <-sensor#0--> <-sensor#3--> <-sensor#2-->
+ * 0x30 | 0x31 | 0x32 | 0x33 | 0x34 | 0x35 | 0x36 | 0x37
+ *
+ * <-sensor#5--> <-sensor#4--> <-sensor#6--> <-sensor#7-->
+ * 0x38 | 0x39 | 0x3A | 0x3B | 0x3C | 0x3D | 0x3E | 0x3F
+ *
* Note: In some cases, values don't strictly follow a little endian ordering.
* The data description gives byte offsets constituting each calibration value
* for each sensor.
@@ -1833,11 +1870,112 @@ static const struct lvts_ctrl_data mt8195_lvts_ap_data_ctrl[] = {
}
};
+static const struct lvts_ctrl_data mt8196_lvts_mcu_data_ctrl[] = {
+ {
+ .lvts_sensor = {
+ { .dt_id = MT8196_MCU_MEDIUM_CPU6_0,
+ .cal_offsets = { 0x06, 0x07 } },
+ { .dt_id = MT8196_MCU_MEDIUM_CPU6_1,
+ .cal_offsets = { 0x04, 0x05 } },
+ { .dt_id = MT8196_MCU_DSU2,
+ .cal_offsets = { 0x0A, 0x0B } },
+ { .dt_id = MT8196_MCU_DSU3,
+ .cal_offsets = { 0x08, 0x09 } }
+ },
+ VALID_SENSOR_MAP(1, 1, 1, 1),
+ .offset = 0x0,
+ .mode = LVTS_MSR_ATP_MODE,
+ },
+ {
+ .lvts_sensor = {
+ { .dt_id = MT8196_MCU_LITTLE_CPU3,
+ .cal_offsets = { 0x0E, 0x0F } },
+ { .dt_id = MT8196_MCU_LITTLE_CPU0,
+ .cal_offsets = { 0x0C, 0x0D } },
+ { .dt_id = MT8196_MCU_LITTLE_CPU1,
+ .cal_offsets = { 0x12, 0x13 } },
+ { .dt_id = MT8196_MCU_LITTLE_CPU2,
+ .cal_offsets = { 0x10, 0x11 } }
+ },
+ VALID_SENSOR_MAP(1, 1, 1, 1),
+ .offset = 0x100,
+ .mode = LVTS_MSR_ATP_MODE,
+ },
+ {
+ .lvts_sensor = {
+ { .dt_id = MT8196_MCU_MEDIUM_CPU4_0,
+ .cal_offsets = { 0x16, 0x17 } },
+ { .dt_id = MT8196_MCU_MEDIUM_CPU4_1,
+ .cal_offsets = { 0x14, 0x15 } },
+ { .dt_id = MT8196_MCU_MEDIUM_CPU5_0,
+ .cal_offsets = { 0x1A, 0x1B } },
+ { .dt_id = MT8196_MCU_MEDIUM_CPU5_1,
+ .cal_offsets = { 0x18, 0x19 } }
+ },
+ VALID_SENSOR_MAP(1, 1, 1, 1),
+ .offset = 0x200,
+ .mode = LVTS_MSR_ATP_MODE,
+ },
+ {
+ .lvts_sensor = {
+ { .dt_id = MT8196_MCU_DSU0,
+ .cal_offsets = { 0x1E, 0x1F } },
+ { .dt_id = MT8196_MCU_DSU1,
+ .cal_offsets = { 0x1C, 0x1D } },
+ { .dt_id = MT8196_MCU_BIG_CPU7_0,
+ .cal_offsets = { 0x22, 0x23 } },
+ { .dt_id = MT8196_MCU_BIG_CPU7_1,
+ .cal_offsets = { 0x20, 0x21 } }
+ },
+ VALID_SENSOR_MAP(1, 1, 1, 1),
+ .offset = 0x300,
+ .mode = LVTS_MSR_ATP_MODE,
+ }
+};
+
+static const struct lvts_ctrl_data mt8196_lvts_ap_data_ctrl[] = {
+ {
+ .lvts_sensor = {
+ { .dt_id = MT8196_AP_TOP0,
+ .cal_offsets = { 0x32, 0x33 } },
+ { .dt_id = MT8196_AP_TOP1,
+ .cal_offsets = { 0x30, 0x31 } },
+ { .dt_id = MT8196_AP_TOP2,
+ .cal_offsets = { 0x36, 0x37 } },
+ { .dt_id = MT8196_AP_TOP3,
+ .cal_offsets = { 0x34, 0x35 } }
+ },
+ VALID_SENSOR_MAP(1, 1, 1, 1),
+ .offset = 0x0,
+ .mode = LVTS_MSR_ATP_MODE,
+ },
+ {
+ .lvts_sensor = {
+ { .dt_id = MT8196_AP_BOT0,
+ .cal_offsets = { 0x3A, 0x3B } },
+ { .dt_id = MT8196_AP_BOT1,
+ .cal_offsets = { 0x38, 0x39 } },
+ { .dt_id = MT8196_AP_BOT2,
+ .cal_offsets = { 0x3E, 0x3F } },
+ { .dt_id = MT8196_AP_BOT3,
+ .cal_offsets = { 0x3C, 0x3D } }
+ },
+ VALID_SENSOR_MAP(1, 1, 1, 1),
+ .offset = 0x100,
+ .mode = LVTS_MSR_ATP_MODE,
+ }
+};
+
static const struct lvts_platform_ops lvts_platform_ops_mt7988 = {
.lvts_raw_to_temp = lvts_raw_to_temp_mt7988,
.lvts_temp_to_raw = lvts_temp_to_raw_mt7988,
};
+static const struct lvts_platform_ops lvts_platform_ops_mt8196 = {
+ .lvts_raw_to_temp = lvts_raw_to_temp_mt7988,
+ .lvts_temp_to_raw = lvts_temp_to_raw_mt8196,
+};
+
static const struct lvts_data mt7988_lvts_ap_data = {
.lvts_ctrl = mt7988_lvts_ap_data_ctrl,
.conn_cmd = mt7988_conn_cmds,
@@ -1957,6 +2095,30 @@ static const struct lvts_data mt8195_lvts_ap_data = {
.ops = &lvts_platform_ops_mt7988,
};
+static const struct lvts_data mt8196_lvts_mcu_data = {
+ .lvts_ctrl = mt8196_lvts_mcu_data_ctrl,
+ .num_lvts_ctrl = ARRAY_SIZE(mt8196_lvts_mcu_data_ctrl),
+ .temp_factor = LVTS_COEFF_A_MT8196,
+ .temp_offset = LVTS_COEFF_B_MT8196,
+ .gt_calib_bit_offset = 0,
+ .def_calibration = 14437,
+ .num_cal_offsets = 2,
+ .msr_offset = LVTS_MSR_OFFSET_MT8196,
+ .ops = &lvts_platform_ops_mt8196,
+};
+
+static const struct lvts_data mt8196_lvts_ap_data = {
+ .lvts_ctrl = mt8196_lvts_ap_data_ctrl,
+ .num_lvts_ctrl = ARRAY_SIZE(mt8196_lvts_ap_data_ctrl),
+ .temp_factor = LVTS_COEFF_A_MT8196,
+ .temp_offset = LVTS_COEFF_B_MT8196,
+ .gt_calib_bit_offset = 0,
+ .def_calibration = 14437,
+ .num_cal_offsets = 2,
+ .msr_offset = LVTS_MSR_OFFSET_MT8196,
+ .ops = &lvts_platform_ops_mt8196,
+};
+
static const struct of_device_id lvts_of_match[] = {
{ .compatible = "mediatek,mt7988-lvts-ap", .data = &mt7988_lvts_ap_data },
{ .compatible = "mediatek,mt8186-lvts", .data = &mt8186_lvts_data },
@@ -1966,6 +2128,8 @@ static const struct of_device_id lvts_of_match[] = {
{ .compatible = "mediatek,mt8192-lvts-ap", .data = &mt8192_lvts_ap_data },
{ .compatible = "mediatek,mt8195-lvts-mcu", .data = &mt8195_lvts_mcu_data },
{ .compatible = "mediatek,mt8195-lvts-ap", .data = &mt8195_lvts_ap_data },
+ { .compatible = "mediatek,mt8196-lvts-mcu", .data = &mt8196_lvts_mcu_data },
+ { .compatible = "mediatek,mt8196-lvts-ap", .data = &mt8196_lvts_ap_data },
{},
};
MODULE_DEVICE_TABLE(of, lvts_of_match);
--
2.39.5
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v4 9/9] dt-bindings: nvmem: mediatek: efuse: Add support for MT8196
2025-11-21 11:16 [PATCH v4 0/9] Add thermal sensor driver support for Mediatek MT8196 Laura Nao
` (7 preceding siblings ...)
2025-11-21 11:16 ` [PATCH v4 8/9] thermal/drivers/mediatek/lvts_thermal: Add MT8196 support Laura Nao
@ 2025-11-21 11:16 ` Laura Nao
8 siblings, 0 replies; 18+ messages in thread
From: Laura Nao @ 2025-11-21 11:16 UTC (permalink / raw)
To: srini, robh, krzk+dt, conor+dt, rafael, daniel.lezcano, rui.zhang,
lukasz.luba, matthias.bgg, angelogioacchino.delregno
Cc: nfraprado, arnd, colin.i.king, u.kleine-koenig, andrew-ct.chen,
lala.lin, bchihi, frank-w, wenst, fshao, devicetree, linux-kernel,
linux-pm, linux-arm-kernel, linux-mediatek, kernel, Laura Nao
The MT8196 eFuse layout is compatible with MT8186 and shares the same
decoding scheme for the gpu-speedbin cell.
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Tested-by: Frank Wunderlich <frank-w@public-files.de>
Signed-off-by: Laura Nao <laura.nao@collabora.com>
---
Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml b/Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml
index c9bf34ee0efb..f9323b3ecfc8 100644
--- a/Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml
+++ b/Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml
@@ -28,6 +28,7 @@ properties:
- enum:
- mediatek,mt8188-efuse
- mediatek,mt8189-efuse
+ - mediatek,mt8196-efuse
- const: mediatek,mt8186-efuse
- const: mediatek,mt8186-efuse
--
2.39.5
^ permalink raw reply related [flat|nested] 18+ messages in thread