Skip to content

Commit c612cbc

Browse files
nfrapradodlezcano
authored andcommitted
thermal/drivers/mediatek/lvts: Disable Stage 3 thermal threshold
The Stage 3 thermal threshold is currently configured during the controller initialization to 105 Celsius. From the kernel perspective, this configuration is harmful because: * The stage 3 interrupt that gets triggered when the threshold is crossed is not handled in any way by the IRQ handler, it just gets cleared. Besides, the temperature used for stage 3 comes from the sensors, and the critical thermal trip points described in the Devicetree will already cause a shutdown when crossed (at a lower temperature, of 100 Celsius, for all SoCs currently using this driver). * The only effect of crossing the stage 3 threshold that has been observed is that it causes the machine to no longer be able to enter suspend. Even if that was a result of a momentary glitch in the temperature reading of a sensor (as has been observed on the MT8192-based Chromebooks). For those reasons, disable the Stage 3 thermal threshold configuration. Cc: [email protected] Reported-by: Hsin-Te Yuan <[email protected]> Closes: https://lore.kernel.org/all/[email protected]/ Fixes: f5f633b ("thermal/drivers/mediatek: Add the Low Voltage Thermal Sensor driver") Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Signed-off-by: Nícolas F. R. A. Prado <[email protected]> Link: https://lore.kernel.org/r/20250113-mt8192-lvts-filtered-suspend-fix-v2-2-07a25200c7c6@collabora.com Signed-off-by: Daniel Lezcano <[email protected]>
1 parent 65594b3 commit c612cbc

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

drivers/thermal/mediatek/lvts_thermal.c

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
#define LVTS_HW_FILTER 0x0
6666
#define LVTS_TSSEL_CONF 0x13121110
6767
#define LVTS_CALSCALE_CONF 0x300
68-
#define LVTS_MONINT_CONF 0x8300318C
68+
#define LVTS_MONINT_CONF 0x0300318C
6969

7070
#define LVTS_MONINT_OFFSET_SENSOR0 0xC
7171
#define LVTS_MONINT_OFFSET_SENSOR1 0x180
@@ -91,8 +91,6 @@
9191
#define LVTS_MSR_READ_TIMEOUT_US 400
9292
#define LVTS_MSR_READ_WAIT_US (LVTS_MSR_READ_TIMEOUT_US / 2)
9393

94-
#define LVTS_HW_TSHUT_TEMP 105000
95-
9694
#define LVTS_MINIMUM_THRESHOLD 20000
9795

9896
static int golden_temp = LVTS_GOLDEN_TEMP_DEFAULT;
@@ -145,7 +143,6 @@ struct lvts_ctrl {
145143
struct lvts_sensor sensors[LVTS_SENSOR_MAX];
146144
const struct lvts_data *lvts_data;
147145
u32 calibration[LVTS_SENSOR_MAX];
148-
u32 hw_tshut_raw_temp;
149146
u8 valid_sensor_mask;
150147
int mode;
151148
void __iomem *base;
@@ -837,14 +834,6 @@ static int lvts_ctrl_init(struct device *dev, struct lvts_domain *lvts_td,
837834
*/
838835
lvts_ctrl[i].mode = lvts_data->lvts_ctrl[i].mode;
839836

840-
/*
841-
* The temperature to raw temperature must be done
842-
* after initializing the calibration.
843-
*/
844-
lvts_ctrl[i].hw_tshut_raw_temp =
845-
lvts_temp_to_raw(LVTS_HW_TSHUT_TEMP,
846-
lvts_data->temp_factor);
847-
848837
lvts_ctrl[i].low_thresh = INT_MIN;
849838
lvts_ctrl[i].high_thresh = INT_MIN;
850839
}
@@ -919,7 +908,6 @@ static int lvts_irq_init(struct lvts_ctrl *lvts_ctrl)
919908
* 10 : Selected sensor with bits 19-18
920909
* 11 : Reserved
921910
*/
922-
writel(BIT(16), LVTS_PROTCTL(lvts_ctrl->base));
923911

924912
/*
925913
* LVTS_PROTTA : Stage 1 temperature threshold
@@ -932,8 +920,8 @@ static int lvts_irq_init(struct lvts_ctrl *lvts_ctrl)
932920
*
933921
* writel(0x0, LVTS_PROTTA(lvts_ctrl->base));
934922
* writel(0x0, LVTS_PROTTB(lvts_ctrl->base));
923+
* writel(0x0, LVTS_PROTTC(lvts_ctrl->base));
935924
*/
936-
writel(lvts_ctrl->hw_tshut_raw_temp, LVTS_PROTTC(lvts_ctrl->base));
937925

938926
/*
939927
* LVTS_MONINT : Interrupt configuration register

0 commit comments

Comments
 (0)