830-v6.4-17-thermal-drivers-mediatek-Add-delay-after-thermal-ban.patch 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. From 4eead70db74922bc61e9d0b4591524369a335751 Mon Sep 17 00:00:00 2001
  2. From: Amjad Ouled-Ameur <[email protected]>
  3. Date: Fri, 27 Jan 2023 16:44:46 +0100
  4. Subject: [PATCH 13/42] thermal/drivers/mediatek: Add delay after thermal banks
  5. initialization
  6. Thermal sensor reads performed immediately after thermal bank
  7. initialization returns bogus values. This is currently tackled by returning
  8. 0 if the temperature is bogus (exceeding 200000).
  9. Instead, add a delay between the bank init and the thermal zone device
  10. register to properly fix this.
  11. Signed-off-by: Michael Kao <[email protected]>
  12. Signed-off-by: Hsin-Yi Wang <[email protected]>
  13. Signed-off-by: Amjad Ouled-Ameur <[email protected]>
  14. Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
  15. Link: https://lore.kernel.org/r/[email protected]
  16. Signed-off-by: Daniel Lezcano <[email protected]>
  17. ---
  18. drivers/thermal/mediatek/auxadc_thermal.c | 11 +++--------
  19. 1 file changed, 3 insertions(+), 8 deletions(-)
  20. --- a/drivers/thermal/mediatek/auxadc_thermal.c
  21. +++ b/drivers/thermal/mediatek/auxadc_thermal.c
  22. @@ -816,14 +816,6 @@ static int mtk_thermal_bank_temperature(
  23. mt, conf->bank_data[bank->id].sensors[i], raw);
  24. - /*
  25. - * The first read of a sensor often contains very high bogus
  26. - * temperature value. Filter these out so that the system does
  27. - * not immediately shut down.
  28. - */
  29. - if (temp > 200000)
  30. - temp = 0;
  31. -
  32. if (temp > max)
  33. max = temp;
  34. }
  35. @@ -1281,6 +1273,9 @@ static int mtk_thermal_probe(struct plat
  36. platform_set_drvdata(pdev, mt);
  37. + /* Delay for thermal banks to be ready */
  38. + msleep(30);
  39. +
  40. tzdev = devm_thermal_of_zone_register(&pdev->dev, 0, mt,
  41. &mtk_thermal_ops);
  42. if (IS_ERR(tzdev)) {