Skip to contentSkip to conversation

thermal: Marvell SoC thermal formula fixes

PATCH New Ezequiel Garcia 3 participants 7 messages Mar 22, 2013 – Mar 26, 2013 Thermal

lore
Share & tools
lore
#0 lore raw

cover thermal: Marvell SoC thermal formula fixes

This is a small patchset that fixes thermal sensor formulas for Kirkwood and Dove thermal driver. The old formulas had been taken from 88AP510 public datasheets which appears to be slightly wrong.

The current formula comes from Marvell internal documentation and has been confirmed by Lior Amsalem.

This has been tested on a Kirkwood board (Openblocks A6) only. If at all possible, I would like to have the Dove fix tested before this is merged.

Please note that this fix was previously part of a bigger thermal patchset [1]. I've taken this out so it can be applied on v3.9 first.

[1] http://www.spinics.net/lists/arm-kernel/msg231697.html

Ezequiel Garcia (2):
thermal: kirkwood: Fix thermal sensor formula
thermal: dove: Fix thermal sensor formula

 drivers/thermal/dove_thermal.c     |    7 ++++---
 drivers/thermal/kirkwood_thermal.c |    8 ++++----
 2 files changed, 8 insertions(+), 7 deletions(-)
Signature · 1 line
1.7.8.6
#1 lore raw

PATCH 1/2 thermal: kirkwood: 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

---
 drivers/thermal/kirkwood_thermal.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/thermal/kirkwood_thermal.c +4 -4
index 65cb4f0..84b331f 100644
@@ -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;
 }
Signature · 1 line
1.7.8.6
reviewer Applied
#2 lore raw

PATCH 1/2 thermal: kirkwood: Fix thermal sensor formula

Quoted 8 lines · Ezequiel Garcia

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

applied to thermal -next.

thanks,
rui

Quoted 26 lines
---
 drivers/thermal/kirkwood_thermal.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/thermal/kirkwood_thermal.c +4 -4
index 65cb4f0..84b331f 100644
@@ -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;
 }
#3 lore raw

PATCH 2/2 thermal: dove: Fix thermal sensor formula

In reply to Ezequiel Garcia

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

---
Tested by compilation only.

 drivers/thermal/dove_thermal.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
drivers/thermal/dove_thermal.c +4 -3
index 7b0bfa0..ddd73a5 100644
@@ -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;
 }
Signature · 1 line
1.7.8.6
reviewer Applied
#4 lore raw

PATCH 2/2 thermal: dove: Fix thermal sensor formula

Quoted 8 lines · Ezequiel Garcia

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

applied to thermal -next.

thanks,
rui

Quoted 27 lines

---
Tested by compilation only.

 drivers/thermal/dove_thermal.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
drivers/thermal/dove_thermal.c +4 -3
index 7b0bfa0..ddd73a5 100644
@@ -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;
 }
reviewer
#5 lore raw

cover thermal: Marvell SoC thermal formula fixes

In reply to Ezequiel Garcia

Hi,

Ezequiel, thanks for your patch.

Quoted 11 lines · Ezequiel Garcia

This is a small patchset that fixes thermal sensor formulas for Kirkwood and Dove thermal driver. The old formulas had been taken from 88AP510 public datasheets which appears to be slightly wrong.

The current formula comes from Marvell internal documentation and has been confirmed by Lior Amsalem.

This has been tested on a Kirkwood board (Openblocks A6) only. If at all possible, I would like to have the Dove fix tested before this is merged.

Quoted 9 lines

Please note that this fix was previously part of a bigger thermal patchset [1]. I've taken this out so it can be applied on v3.9 first.

[1] http://www.spinics.net/lists/arm-kernel/msg231697.html

Ezequiel Garcia (2):
thermal: kirkwood: Fix thermal sensor formula
thermal: dove: Fix thermal sensor formula

Nobuhiro and Andrew,

what do you think of these patches?
As I have no idea of the hardware details, I need your comments before applying them.

thanks,
rui

Quoted 4 lines
 drivers/thermal/dove_thermal.c     |    7 ++++---
 drivers/thermal/kirkwood_thermal.c |    8 ++++----
 2 files changed, 8 insertions(+), 7 deletions(-)
#6 lore raw

cover thermal: Marvell SoC thermal formula fixes

Quoted 26 lines · Zhang Rui

Hi,

Ezequiel, thanks for your patch.

Quoted 11 lines · Ezequiel Garcia

This is a small patchset that fixes thermal sensor formulas for Kirkwood and Dove thermal driver. The old formulas had been taken from 88AP510 public datasheets which appears to be slightly wrong.

The current formula comes from Marvell internal documentation and has been confirmed by Lior Amsalem.

This has been tested on a Kirkwood board (Openblocks A6) only. If at all possible, I would like to have the Dove fix tested before this is merged.

Quoted 9 lines

Please note that this fix was previously part of a bigger thermal patchset [1]. I've taken this out so it can be applied on v3.9 first.

[1] http://www.spinics.net/lists/arm-kernel/msg231697.html

Ezequiel Garcia (2):
thermal: kirkwood: Fix thermal sensor formula
thermal: dove: Fix thermal sensor formula

Quoted 5 lines

Nobuhiro and Andrew,

what do you think of these patches?
As I have no idea of the hardware details, I need your comments before applying them.

I have no access to the internal documentation, so i cannot say if this formula is correct or not. However, Lior Amsalem should be in the know.

Andrew