Skip to content

Commit 10debf8

Browse files
aouledameurdlezcano
authored andcommitted
thermal/drivers/mediatek: Add delay after thermal banks initialization
Thermal sensor reads performed immediately after thermal bank initialization returns bogus values. This is currently tackled by returning 0 if the temperature is bogus (exceeding 200000). Instead, add a delay between the bank init and the thermal zone device register to properly fix this. Signed-off-by: Michael Kao <michael.kao@mediatek.com> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org> Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20221018-up-i350-thermal-bringup-v9-5-55a1ae14af74@baylibre.com Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
1 parent 56edffd commit 10debf8

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

drivers/thermal/mediatek/auxadc_thermal.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -816,14 +816,6 @@ static int mtk_thermal_bank_temperature(struct mtk_thermal_bank *bank)
816816
mt, conf->bank_data[bank->id].sensors[i], raw);
817817

818818

819-
/*
820-
* The first read of a sensor often contains very high bogus
821-
* temperature value. Filter these out so that the system does
822-
* not immediately shut down.
823-
*/
824-
if (temp > 200000)
825-
temp = 0;
826-
827819
if (temp > max)
828820
max = temp;
829821
}
@@ -1281,6 +1273,9 @@ static int mtk_thermal_probe(struct platform_device *pdev)
12811273

12821274
platform_set_drvdata(pdev, mt);
12831275

1276+
/* Delay for thermal banks to be ready */
1277+
msleep(30);
1278+
12841279
tzdev = devm_thermal_of_zone_register(&pdev->dev, 0, mt,
12851280
&mtk_thermal_ops);
12861281
if (IS_ERR(tzdev)) {

0 commit comments

Comments
 (0)