]> Pileus Git - ~andy/linux/commitdiff
thermal: dove: Fix thermal sensor formula
authorEzequiel Garcia <ezequiel.garcia@free-electrons.com>
Fri, 22 Mar 2013 12:23:03 +0000 (09:23 -0300)
committerZhang Rui <rui.zhang@intel.com>
Tue, 26 Mar 2013 14:13:10 +0000 (22:13 +0800)
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>
drivers/thermal/dove_thermal.c

index 3078c403b42d84029968b23ff20b39ebd4af295d..4b15a5f270dc71a021bde1b6e96e8656720d45bc 100644 (file)
@@ -107,12 +107,13 @@ static int dove_get_temp(struct thermal_zone_device *thermal,
        }
 
        /*
-        * Calculate temperature. See Section 8.10.1 of 88AP510,
-        * Documentation/arm/Marvell/README
+        * Calculate temperature. According to Marvell internal
+        * documentation the formula for this is:
+        * Celsius = (322-reg)/1.3625
         */
        reg = readl_relaxed(priv->sensor);
        reg = (reg >> DOVE_THERMAL_TEMP_OFFSET) & DOVE_THERMAL_TEMP_MASK;
-       *temp = ((2281638UL - (7298*reg)) / 10);
+       *temp = ((3220000000UL - (10000000UL * reg)) / 13625);
 
        return 0;
 }