Aw: regression with 33140e668b10 thermal/drivers/mediatek: Control buffer enablement tweaks

From: Frank Wunderlich
Date: Thu Aug 31 2023 - 09:34:45 EST


Hi,

looked a bit deeper into it and it looks like i only need to add the fields in the mtk_thermal_data struct

--- a/drivers/thermal/mediatek/auxadc_thermal.c
+++ b/drivers/thermal/mediatek/auxadc_thermal.c
@@ -690,6 +690,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),
};

in my quick test the temprature can be read again and i'm near room temperature...i though it was a bit higher before, but as far as i understand the code, the values were fixed before and only made it configurable.

if someone can confirm that i'm right, i can send official patch.

regards Frank


> Gesendet: Donnerstag, 31. August 2023 um 11:25 Uhr
> Von: "Frank Wunderlich" <frank-w@xxxxxxxxxxxxxxx>
> Hi,
>
> The commit 33140e668b10 "thermal/drivers/mediatek: Control buffer enablement tweaks" is merged between 6.3 and 6.4 and causes a regression where temperature cannot be read correctly at least for mt7986/Bpi-R3.
>
> bpi-r3 ~ # cat /sys/class/thermal/thermal_zone0/temp
> -274000
>
> after reverting the commit and fixing some build-errors in 6.5-rc7 because new members used in mt8365_thermal_data too, we can read temperature on mt7986 again.
>
> i guess reverting the commit is not the right way, so i ask here for a better solution
>
> regards Frank