summaryrefslogtreecommitdiff
path: root/drivers/mxc/thermal
diff options
context:
space:
mode:
authorAnson Huang <b20788@freescale.com>2013-04-17 16:10:59 +0800
committerAnson Huang <b20788@freescale.com>2013-04-17 16:21:57 +0800
commitdc24cdfec0a82e446126a0a310fcfc85cb053909 (patch)
tree4e502503cd28fea812fc4c5b4624fc81581e160e /drivers/mxc/thermal
parent18059b6f37c7b19cf82bab2d99df62f0779bb300 (diff)
ENGR00259189 thermal:mx6: Make sure thermal alarm working safely
The thermal sensor's value will be updated even it is power down, as thermal sensor's clock source is from PLL3, so there is chance that PLL3 is disabled before thermal driver is probed during kernel boot up, so the value in thermal sensor can be incorrect in this PLL3 disabled window. Previous flow of thermal driver probe routine will enable PLL3 clock, then set the thermal alarm value and enable the alarm irq, there is no delay or check about the thermal sensor's value, only when the thermal sensor's value is correct, its alarm function can be enabled. As adding delay in the probe routine is not a good option, so we move the enabling of thermal alarm function into the get temperature routine, as after the thermal value is read, the alarm function is safe enough, as the thermal sensor will be always working right after a read if its clock is enabled. Signed-off-by: Anson Huang <b20788@freescale.com>
Diffstat (limited to 'drivers/mxc/thermal')
-rw-r--r--drivers/mxc/thermal/thermal.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/mxc/thermal/thermal.c b/drivers/mxc/thermal/thermal.c
index 2a29109d2861..39383e297216 100644
--- a/drivers/mxc/thermal/thermal.c
+++ b/drivers/mxc/thermal/thermal.c
@@ -338,6 +338,11 @@ static int anatop_thermal_get_temp(struct thermal_zone_device *thermal,
*temp = (cooling_device_disable && tz->temperature >= KELVIN_TO_CEL(TEMP_CRITICAL, KELVIN_OFFSET)) ?
KELVIN_TO_CEL(TEMP_CRITICAL - 1, KELVIN_OFFSET) : tz->temperature;
+ /* Set alarm threshold if necessary */
+ if ((__raw_readl(anatop_base + HW_ANADIG_TEMPSENSE0) &
+ BM_ANADIG_TEMPSENSE0_ALARM_VALUE) == 0)
+ anatop_update_alarm(raw_critical);
+
return 0;
}
@@ -900,7 +905,6 @@ static int anatop_thermal_counting_ratio(unsigned int fuse_data)
/* Init default critical temp to set alarm */
raw_critical = raw_25c - ratio * (KELVIN_TO_CEL(TEMP_CRITICAL, KELVIN_OFFSET) - 25) / 100;
clk_enable(pll3_clk);
- anatop_update_alarm(raw_critical);
return ret;
}