1 From 4eead70db74922bc61e9d0b4591524369a335751 Mon Sep 17 00:00:00 2001
2 From: Amjad Ouled-Ameur <aouledameur@baylibre.com>
3 Date: Fri, 27 Jan 2023 16:44:46 +0100
4 Subject: [PATCH 13/42] thermal/drivers/mediatek: Add delay after thermal banks
7 Thermal sensor reads performed immediately after thermal bank
8 initialization returns bogus values. This is currently tackled by returning
9 0 if the temperature is bogus (exceeding 200000).
11 Instead, add a delay between the bank init and the thermal zone device
12 register to properly fix this.
14 Signed-off-by: Michael Kao <michael.kao@mediatek.com>
15 Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
16 Signed-off-by: Amjad Ouled-Ameur <aouledameur@baylibre.com>
17 Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
18 Link: https://lore.kernel.org/r/20221018-up-i350-thermal-bringup-v9-5-55a1ae14af74@baylibre.com
19 Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
21 drivers/thermal/mediatek/auxadc_thermal.c | 11 +++--------
22 1 file changed, 3 insertions(+), 8 deletions(-)
24 --- a/drivers/thermal/mediatek/auxadc_thermal.c
25 +++ b/drivers/thermal/mediatek/auxadc_thermal.c
26 @@ -816,14 +816,6 @@ static int mtk_thermal_bank_temperature(
27 mt, conf->bank_data[bank->id].sensors[i], raw);
31 - * The first read of a sensor often contains very high bogus
32 - * temperature value. Filter these out so that the system does
33 - * not immediately shut down.
41 @@ -1281,6 +1273,9 @@ static int mtk_thermal_probe(struct plat
43 platform_set_drvdata(pdev, mt);
45 + /* Delay for thermal banks to be ready */
48 tzdev = devm_thermal_of_zone_register(&pdev->dev, 0, mt,