Skip to contentSkip to conversation

thermal/drivers/mediatek: fix temperature on mt7986

RFC In review Frank Wunderlich 2 participants 2 messages Sep 1, 2023 – Sep 7, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 thermal/drivers/mediatek: fix temperature on mt7986

From: Frank Wunderlich <[email protected]>

Reading thermal sensor on mt7986 devices returns invalid temperature:

bpi-r3 ~ # cat /sys/class/thermal/thermal_zone0/temp
-274000

Fix this by adding missing members in mtk_thermal_data struct which were used in mtk_thermal_turn_on_buffer after commit 33140e668b10.

Fixes 33140e668b10 ("thermal/drivers/mediatek: Control buffer enablement tweaks")
---
 drivers/thermal/mediatek/auxadc_thermal.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/thermal/mediatek/auxadc_thermal.c +3 -0
index f59d36de20a0..ed08767eaa60 100644
@@ -691,6 +691,9 @@ static const struct mtk_thermal_data mt7986_thermal_data = {
 	.adcpnp = mt7986_adcpnp,
 	.sensor_mux_values = mt7986_mux_values,
 	.version = MTK_THERMAL_V3,
+	.apmixed_buffer_ctl_reg = APMIXED_SYS_TS_CON1,
+	.apmixed_buffer_ctl_mask = GENMASK(31, 6) | BIT(3),
+	.apmixed_buffer_ctl_set = BIT(0),
 };
 
 static bool mtk_thermal_temp_is_valid(int temp)
Signature · 1 line
2.34.1
#1 lore raw

Il 01/09/23 08:37, Frank Wunderlich ha scritto:

Quoted 7 lines

From: Frank Wunderlich <[email protected]>

Reading thermal sensor on mt7986 devices returns invalid temperature:

bpi-r3 ~ # cat /sys/class/thermal/thermal_zone0/temp
-274000

Quoted 6 lines

Fix this by adding missing members in mtk_thermal_data struct which were used in mtk_thermal_turn_on_buffer after commit 33140e668b10.

Fixes 33140e668b10 ("thermal/drivers/mediatek: Control buffer enablement tweaks")

If you resend this commit without the RFC tag I can give you a R-b.

This is totally correct, as the buffer control is for version >= THERMAL_V2, and the others being V1 don't need it - the only one that was left out is effectively just mt7986 (probably because the commits landed around the same time).

Though, since you have to anyway resend this, I would suggest to change the commit title to something more effective, like

thermal/drivers/mediatek: Fix control buffer enablement on MT7896

Cheers,
Angelo

Quoted 18 lines
---
  drivers/thermal/mediatek/auxadc_thermal.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/thermal/mediatek/auxadc_thermal.c +3 -0
index f59d36de20a0..ed08767eaa60 100644
@@ -691,6 +691,9 @@ static const struct mtk_thermal_data mt7986_thermal_data = {
  	.adcpnp = mt7986_adcpnp,
  	.sensor_mux_values = mt7986_mux_values,
  	.version = MTK_THERMAL_V3,
+	.apmixed_buffer_ctl_reg = APMIXED_SYS_TS_CON1,
+	.apmixed_buffer_ctl_mask = GENMASK(31, 6) | BIT(3),
+	.apmixed_buffer_ctl_set = BIT(0),
  };
 
  static bool mtk_thermal_temp_is_valid(int temp)