Skip to contentSkip to conversation

thermal: rcar_gen3_thermal: update constants for calculation of temperature

PATCH In review Niklas Söderlund 2 participants 5 messages Apr 17, 2018 – Apr 24, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover thermal: rcar_gen3_thermal: update constants for calculation of temperature

From: Niklas Söderlund <[email protected]>

Hi,

This series updates the constants used to convert the register values to degrease. It is based on feedback from the hardware team communicated through BSP patches and updated datasheets. :-)

Hien Dang (1):
thermal: rcar_gen3_thermal: Update calculation formula due to HW
evaluation

Niklas Söderlund (1):
thermal: rcar_gen3_thermal: update max temperature clamp

 drivers/thermal/rcar_gen3_thermal.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
Signature · 1 line
2.17.0
#1 lore raw

PATCH 1/2 thermal: rcar_gen3_thermal: Update calculation formula due to HW evaluation

From: Hien Dang <[email protected]>

Due to hardware evaluation result,
Max temperature is changed from 96 to 116 degree Celsius. Also, calculation formula and pseudo FUSE values are changed accordingly.

---
 drivers/thermal/rcar_gen3_thermal.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/thermal/rcar_gen3_thermal.c +6 -6
index 561a0a332208504a..79c2cdb4105fc0b8 100644
@@ -132,7 +132,7 @@ static inline void rcar_gen3_thermal_write(struct rcar_gen3_thermal_tsc *tsc,
 #define RCAR3_THERMAL_GRAN 500 /* mili Celsius */
 
 /* no idea where these constants come from */
-#define TJ_1 96
+#define TJ_1 116
 #define TJ_3 -41
 
 static void rcar_gen3_thermal_calc_coefs(struct equation_coefs *coef,
@@ -146,7 +146,7 @@ static void rcar_gen3_thermal_calc_coefs(struct equation_coefs *coef,
 	 * Division is not scaled in BSP and if scaled it might overflow
 	 * the dividend (4095 * 4095 << 14 > INT_MAX) so keep it unscaled
 	 */
-	tj_2 = (FIXPT_INT((ptat[1] - ptat[2]) * 137)
+	tj_2 = (FIXPT_INT((ptat[1] - ptat[2]) * 157)
 		/ (ptat[0] - ptat[2])) - FIXPT_INT(41);
 
 	coef->a1 = FIXPT_DIV(FIXPT_INT(thcode[1] - thcode[2]),
@@ -354,11 +354,11 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
 
 	/* default values if FUSEs are missing */
 	/* TODO: Read values from hardware on supported platforms */
-	int ptat[3] = { 2351, 1509, 435 };
+	int ptat[3] = { 2631, 1509, 435 };
 	int thcode[TSC_MAX_NUM][3] = {
-		{ 3248, 2800, 2221 },
-		{ 3245, 2795, 2216 },
-		{ 3250, 2805, 2237 },
+		{ 3397, 2800, 2221 },
+		{ 3393, 2795, 2216 },
+		{ 3389, 2805, 2237 },
 	};
 
 	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
Signature · 1 line
2.17.0
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] thermal: rcar_gen3_thermal: Update calculation formula due to HW evaluation

Quoted 9 lines · Niklas Söderlund

From: Hien Dang <[email protected]>

Due to hardware evaluation result,
Max temperature is changed from 96 to 116 degree Celsius. Also, calculation formula and pseudo FUSE values are changed accordingly.

#3 lore raw

PATCH 2/2 thermal: rcar_gen3_thermal: update max temperature clamp

In reply to Niklas Söderlund

From: Niklas Söderlund <[email protected]>

Change the upper limit to clamp the high temperature value to 120C when setting trip points.

---
 drivers/thermal/rcar_gen3_thermal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/thermal/rcar_gen3_thermal.c +2 -2
index 79c2cdb4105fc0b8..3905ec8b2689827c 100644
@@ -207,8 +207,8 @@ static int rcar_gen3_thermal_set_trips(void *devdata, int low, int high)
 {
 	struct rcar_gen3_thermal_tsc *tsc = devdata;
 
-	low = clamp_val(low, -40000, 125000);
-	high = clamp_val(high, -40000, 125000);
+	low = clamp_val(low, -40000, 120000);
+	high = clamp_val(high, -40000, 120000);
 
 	rcar_gen3_thermal_write(tsc, REG_GEN3_IRQTEMP1,
 				rcar_gen3_thermal_mcelsius_to_temp(tsc, low));
Signature · 1 line
2.17.0