From: Niklas Söderlund <[email protected]>

The .thermal_init needs to be delayed a short amount of time after
setting REG_GEN3_CTSR to allow for the TEMP register to contain
something useful. If it's not delayed theses warnings are common during
boot:

thermal thermal_zone0: failed to read out thermal zone (-5)
thermal thermal_zone1: failed to read out thermal zone (-5)
thermal thermal_zone2: failed to read out thermal zone (-5)

The warnings are triggered by the first call to .get_temp while the TEMP
register contains 0 and rcar_gen3_thermal_get_temp() returns -EIO since
a TEMP value of 0 will result in a temperature reading which is out of
specifications.

Signed-off-by: Niklas Söderlund <[email protected]>
---
 drivers/thermal/rcar_gen3_thermal.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/thermal/rcar_gen3_thermal.c 
b/drivers/thermal/rcar_gen3_thermal.c
index 7d78498..085daec 100644
--- a/drivers/thermal/rcar_gen3_thermal.c
+++ b/drivers/thermal/rcar_gen3_thermal.c
@@ -199,6 +199,8 @@ static void r8a7795_thermal_init(struct 
rcar_gen3_thermal_tsc *tsc)
        rcar_gen3_thermal_write(tsc, REG_GEN3_CTSR,
                                CTSR_PONM | CTSR_AOUT | CTSR_THBGR | CTSR_VMEN |
                                CTSR_VMST | CTSR_THSST);
+
+       usleep_range(1000, 2000);
 }
 
 static void r8a7796_thermal_init(struct rcar_gen3_thermal_tsc *tsc)
-- 
2.10.2

Reply via email to