diff options
Diffstat (limited to 'drivers/thermal/kirkwood_thermal.c')
-rw-r--r-- | drivers/thermal/kirkwood_thermal.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/thermal/kirkwood_thermal.c b/drivers/thermal/kirkwood_thermal.c index e5500edb5285..dfeceaffbc03 100644 --- a/drivers/thermal/kirkwood_thermal.c +++ b/drivers/thermal/kirkwood_thermal.c | |||
@@ -41,21 +41,21 @@ static int kirkwood_get_temp(struct thermal_zone_device *thermal, | |||
41 | reg = readl_relaxed(priv->sensor); | 41 | reg = readl_relaxed(priv->sensor); |
42 | 42 | ||
43 | /* Valid check */ | 43 | /* Valid check */ |
44 | if (!(reg >> KIRKWOOD_THERMAL_VALID_OFFSET) & | 44 | if (!((reg >> KIRKWOOD_THERMAL_VALID_OFFSET) & |
45 | KIRKWOOD_THERMAL_VALID_MASK) { | 45 | KIRKWOOD_THERMAL_VALID_MASK)) { |
46 | dev_err(&thermal->device, | 46 | dev_err(&thermal->device, |
47 | "Temperature sensor reading not valid\n"); | 47 | "Temperature sensor reading not valid\n"); |
48 | return -EIO; | 48 | return -EIO; |
49 | } | 49 | } |
50 | 50 | ||
51 | /* | 51 | /* |
52 | * Calculate temperature. See Section 8.10.1 of the 88AP510, | 52 | * Calculate temperature. According to Marvell internal |
53 | * datasheet, which has the same sensor. | 53 | * documentation the formula for this is: |
54 | * Documentation/arm/Marvell/README | 54 | * Celsius = (322-reg)/1.3625 |
55 | */ | 55 | */ |
56 | reg = (reg >> KIRKWOOD_THERMAL_TEMP_OFFSET) & | 56 | reg = (reg >> KIRKWOOD_THERMAL_TEMP_OFFSET) & |
57 | KIRKWOOD_THERMAL_TEMP_MASK; | 57 | KIRKWOOD_THERMAL_TEMP_MASK; |
58 | *temp = ((2281638UL - (7298*reg)) / 10); | 58 | *temp = ((3220000000UL - (10000000UL * reg)) / 13625); |
59 | 59 | ||
60 | return 0; | 60 | return 0; |
61 | } | 61 | } |