Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Anson Huang and committed by
Zhang Rui
d0f9d64a dd354b84

+7 -11
+7 -11
drivers/thermal/imx_thermal.c
··· 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; ··· 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 /* ··· 362 366 data->c2 = n1 * data->c1 + 1000 * t1; 363 367 364 368 /* 365 - * Set the default passive cooling trip point to 20 °C below the 366 - * maximum die temperature. Can be changed from userspace. 369 + * Set the default passive cooling trip point, 370 + * can be changed from userspace. 367 371 */ 368 - data->temp_passive = 1000 * (t2 - 20); 372 + data->temp_passive = IMX_TEMP_PASSIVE; 369 373 370 374 /* 371 - * The maximum die temperature is t2, let's give 5 °C cushion 372 - * for noise and possible temperature rise between measurements. 375 + * The maximum die temperature set to 20 C higher than 376 + * IMX_TEMP_PASSIVE. 373 377 */ 374 - data->temp_critical = 1000 * (t2 - 5); 378 + data->temp_critical = 1000 * 20 + data->temp_passive; 375 379 376 380 return 0; 377 381 }