Commit d0f9d64a0b8fb3399ca8dd0d54f4d305492c9217

Authored by Anson Huang
Committed by Zhang Rui
1 parent dd354b84d4

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>

Showing 1 changed file with 7 additions and 11 deletions Side-by-side Diff

drivers/thermal/imx_thermal.c
... ... @@ -306,7 +306,7 @@
306 306 {
307 307 struct imx_thermal_data *data = platform_get_drvdata(pdev);
308 308 struct regmap *map;
309   - int t1, t2, n1, n2;
  309 + int t1, n1;
310 310 int ret;
311 311 u32 val;
312 312 u64 temp64;
313 313  
... ... @@ -333,14 +333,10 @@
333 333 /*
334 334 * Sensor data layout:
335 335 * [31:20] - sensor value @ 25C
336   - * [19:8] - sensor value of hot
337   - * [7:0] - hot temperature value
338 336 * Use universal formula now and only need sensor value @ 25C
339 337 * slope = 0.4297157 - (0.0015976 * 25C fuse)
340 338 */
341 339 n1 = val >> 20;
342   - n2 = (val & 0xfff00) >> 8;
343   - t2 = val & 0xff;
344 340 t1 = 25; /* t1 always 25C */
345 341  
346 342 /*
347 343  
348 344  
349 345  
... ... @@ -366,16 +362,16 @@
366 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
370   - * maximum die temperature. Can be changed from userspace.
  365 + * Set the default passive cooling trip point,
  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
376   - * for noise and possible temperature rise between measurements.
  371 + * The maximum die temperature set to 20 C higher than
  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 376 return 0;
381 377 }