aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnson Huang <b20788@freescale.com>2014-06-20 03:03:06 -0400
committerZhang Rui <rui.zhang@intel.com>2014-06-30 21:22:28 -0400
commitd0f9d64a0b8fb3399ca8dd0d54f4d305492c9217 (patch)
treedfc65ef5f7f99cde5f49591481b9a0e056e76a9b
parentdd354b84d47ec8ca53686bdb3cc1aecdeb75bef5 (diff)
Thermal: imx: correct critical trip temperature setting
On latest i.MX6 SOC with thermal calibration data of 0x5A100000, the critical trip temperature will be an invalid value and cause system auto shutdown as below log: thermal thermal_zone0: critical temperature reached(42 C),shutting down So, with universal formula for thermal sensor, only room temperature point is calibrated, which means the calibration data read from fuse only has valid data of bit [31:20], others are all 0, the critical trip point temperature can NOT depend on the hot point calibration data, here we set it to 20 C higher than default passive temperature. Signed-off-by: Anson Huang <b20788@freescale.com> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
-rw-r--r--drivers/thermal/imx_thermal.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
index a99c63152b8d..2c516f2eebed 100644
--- a/drivers/thermal/imx_thermal.c
+++ b/drivers/thermal/imx_thermal.c
@@ -306,7 +306,7 @@ static int imx_get_sensor_data(struct platform_device *pdev)
306{ 306{
307 struct imx_thermal_data *data = platform_get_drvdata(pdev); 307 struct imx_thermal_data *data = platform_get_drvdata(pdev);
308 struct regmap *map; 308 struct regmap *map;
309 int t1, t2, n1, n2; 309 int t1, n1;
310 int ret; 310 int ret;
311 u32 val; 311 u32 val;
312 u64 temp64; 312 u64 temp64;
@@ -333,14 +333,10 @@ static int imx_get_sensor_data(struct platform_device *pdev)
333 /* 333 /*
334 * Sensor data layout: 334 * Sensor data layout:
335 * [31:20] - sensor value @ 25C 335 * [31:20] - sensor value @ 25C
336 * [19:8] - sensor value of hot
337 * [7:0] - hot temperature value
338 * Use universal formula now and only need sensor value @ 25C 336 * Use universal formula now and only need sensor value @ 25C
339 * slope = 0.4297157 - (0.0015976 * 25C fuse) 337 * slope = 0.4297157 - (0.0015976 * 25C fuse)
340 */ 338 */
341 n1 = val >> 20; 339 n1 = val >> 20;
342 n2 = (val & 0xfff00) >> 8;
343 t2 = val & 0xff;
344 t1 = 25; /* t1 always 25C */ 340 t1 = 25; /* t1 always 25C */
345 341
346 /* 342 /*
@@ -366,16 +362,16 @@ static int imx_get_sensor_data(struct platform_device *pdev)
366 data->c2 = n1 * data->c1 + 1000 * t1; 362 data->c2 = n1 * data->c1 + 1000 * t1;
367 363
368 /* 364 /*
369 * Set the default passive cooling trip point to 20 °C below the 365 * Set the default passive cooling trip point,
370 * maximum die temperature. Can be changed from userspace. 366 * can be changed from userspace.
371 */ 367 */
372 data->temp_passive = 1000 * (t2 - 20); 368 data->temp_passive = IMX_TEMP_PASSIVE;
373 369
374 /* 370 /*
375 * The maximum die temperature is t2, let's give 5 °C cushion 371 * The maximum die temperature set to 20 C higher than
376 * for noise and possible temperature rise between measurements. 372 * IMX_TEMP_PASSIVE.
377 */ 373 */
378 data->temp_critical = 1000 * (t2 - 5); 374 data->temp_critical = 1000 * 20 + data->temp_passive;
379 375
380 return 0; 376 return 0;
381} 377}