aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/thermal/dove_thermal.c
diff options
context:
space:
mode:
authorEzequiel Garcia <ezequiel.garcia@free-electrons.com>2013-03-22 08:23:03 -0400
committerZhang Rui <rui.zhang@intel.com>2013-03-26 10:13:10 -0400
commit2fd1db8819fbf73b5f74b4b4a205ab7be0957944 (patch)
tree19fee672d8511004571c6eda8f71bf5a7c764aea /drivers/thermal/dove_thermal.c
parent696b6075afa97b42b3f59f96809ed586eb691c96 (diff)
thermal: dove: Fix thermal sensor formula
The currently formula has been taken from the 88AP510 SoC datasheet, which is not exactly correct. The correct value for the temperature in Celcius of the sensor present in this SoC is: Celsius = (322-reg)/1.3625 Signed-off-by: Lior Amsalem <alior@marvell.com> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> Acked-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Diffstat (limited to 'drivers/thermal/dove_thermal.c')
-rw-r--r--drivers/thermal/dove_thermal.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/thermal/dove_thermal.c b/drivers/thermal/dove_thermal.c
index 3078c403b42d..4b15a5f270dc 100644
--- a/drivers/thermal/dove_thermal.c
+++ b/drivers/thermal/dove_thermal.c
@@ -107,12 +107,13 @@ static int dove_get_temp(struct thermal_zone_device *thermal,
107 } 107 }
108 108
109 /* 109 /*
110 * Calculate temperature. See Section 8.10.1 of 88AP510, 110 * Calculate temperature. According to Marvell internal
111 * Documentation/arm/Marvell/README 111 * documentation the formula for this is:
112 * Celsius = (322-reg)/1.3625
112 */ 113 */
113 reg = readl_relaxed(priv->sensor); 114 reg = readl_relaxed(priv->sensor);
114 reg = (reg >> DOVE_THERMAL_TEMP_OFFSET) & DOVE_THERMAL_TEMP_MASK; 115 reg = (reg >> DOVE_THERMAL_TEMP_OFFSET) & DOVE_THERMAL_TEMP_MASK;
115 *temp = ((2281638UL - (7298*reg)) / 10); 116 *temp = ((3220000000UL - (10000000UL * reg)) / 13625);
116 117
117 return 0; 118 return 0;
118} 119}