Skip to content

Commit

Permalink
thermal: kirkwood: Fix thermal sensor formula
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ezequiel Garcia authored and Zhang Rui committed Mar 26, 2013
1 parent 02519d3 commit 696b607
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/thermal/kirkwood_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ static int kirkwood_get_temp(struct thermal_zone_device *thermal,
}

/*
* Calculate temperature. See Section 8.10.1 of the 88AP510,
* datasheet, which has the same sensor.
* Documentation/arm/Marvell/README
* Calculate temperature. According to Marvell internal
* documentation the formula for this is:
* Celsius = (322-reg)/1.3625
*/
reg = (reg >> KIRKWOOD_THERMAL_TEMP_OFFSET) &
KIRKWOOD_THERMAL_TEMP_MASK;
*temp = ((2281638UL - (7298*reg)) / 10);
*temp = ((3220000000UL - (10000000UL * reg)) / 13625);

return 0;
}
Expand Down

0 comments on commit 696b607

Please sign in to comment.