diff options
author | Amjad Ouled-Ameur <aouledameur@baylibre.com> | 2023-01-27 18:44:46 +0300 |
---|---|---|
committer | Daniel Lezcano <daniel.lezcano@linaro.org> | 2023-04-01 21:51:29 +0300 |
commit | 10debf8c2da8011c8009dd4b3f6d0ab85891c81b (patch) | |
tree | f514adf885903dbc8b20daef6c72a02c0bd24674 /drivers/thermal | |
parent | 56edffdc298a056ed6923c89b9af7c927ff0ac8f (diff) | |
download | linux-10debf8c2da8011c8009dd4b3f6d0ab85891c81b.tar.xz |
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>
Diffstat (limited to 'drivers/thermal')
-rw-r--r-- | drivers/thermal/mediatek/auxadc_thermal.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/thermal/mediatek/auxadc_thermal.c b/drivers/thermal/mediatek/auxadc_thermal.c index 3c959a827451..b6bb9eaafb74 100644 --- a/drivers/thermal/mediatek/auxadc_thermal.c +++ b/drivers/thermal/mediatek/auxadc_thermal.c @@ -816,14 +816,6 @@ static int mtk_thermal_bank_temperature(struct mtk_thermal_bank *bank) mt, conf->bank_data[bank->id].sensors[i], raw); - /* - * The first read of a sensor often contains very high bogus - * temperature value. Filter these out so that the system does - * not immediately shut down. - */ - if (temp > 200000) - temp = 0; - if (temp > max) max = temp; } @@ -1281,6 +1273,9 @@ static int mtk_thermal_probe(struct platform_device *pdev) platform_set_drvdata(pdev, mt); + /* Delay for thermal banks to be ready */ + msleep(30); + tzdev = devm_thermal_of_zone_register(&pdev->dev, 0, mt, &mtk_thermal_ops); if (IS_ERR(tzdev)) { |