On 18.04.2019 10:15, Simon Horman wrote:
From: Yoshihiro Kaneko <ykaneko0929@xxxxxxxxx>
HW manual changes temperature calculation formula for E3:
- When CTEMP is less than 24
T = CTEMP[5:0] * 5.5 - 72
- When CTEMP is equal to/greater than 24
T = CTEMP[5:0] * 5 - 60
This was inspired by a patch in the BSP by Van Do <van.do.xw@xxxxxxxxxxx>
Signed-off-by: Yoshihiro Kaneko <ykaneko0929@xxxxxxxxx>
Tested-by: Simon Horman <horms+renesas@xxxxxxxxxxxx>
Acked-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Simon Horman <horms+renesas@xxxxxxxxxxxx>
---
drivers/thermal/rcar_thermal.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index 97462e9b40d8..11df0cc63bed 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
[...]
@@ -263,7 +267,12 @@ static int rcar_thermal_get_current_temp(struct rcar_thermal_priv *priv,
return ret;
mutex_lock(&priv->lock);
- tmp = MCELSIUS((priv->ctemp * 5) - 65);
+ if (priv->chip->ctemp_bands == 1)
+ tmp = MCELSIUS((priv->ctemp * 5) - 65);
^ stray space?
+ else if (priv->ctemp < 24)
+ tmp = MCELSIUS(((priv->ctemp * 55) - 720) / 10);
+ else
+ tmp = MCELSIUS((priv->ctemp * 5) - 60);
mutex_unlock(&priv->lock);
if ((tmp < MCELSIUS(-45)) || (tmp > MCELSIUS(125))) {
MBR, Sergei