summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnson Huang <b20788@freescale.com>2012-09-06 15:38:07 +0800
committerJason Liu <r64343@freescale.com>2012-09-06 22:17:57 +0800
commitb387e1ccdaaf6f15a0c40e9738ef6eef0df83253 (patch)
treed4621c00a1facec66c455fb71af78eb1f50153ae
parentdb014b1b394f4b89c6e69a5becd098eb8c53a204 (diff)
ENGR00223236-2 [MX6]Change the temperature range to -40C ~ 125C
Previous temperature range is -25C ~ 125C, according to latest datasheet, change it to -40C to 125C. Signed-off-by: Anson Huang <b20788@freescale.com>
-rw-r--r--drivers/mxc/thermal/thermal.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/mxc/thermal/thermal.c b/drivers/mxc/thermal/thermal.c
index 6f3c7a912170..f0e961f6109d 100644
--- a/drivers/mxc/thermal/thermal.c
+++ b/drivers/mxc/thermal/thermal.c
@@ -132,15 +132,15 @@
#define KELVIN_TO_CEL(t, off) (((t) - (off)))
#define CEL_TO_KELVIN(t, off) (((t) + (off)))
#define DEFAULT_RATIO 145
-#define DEFAULT_N25C 1541
-#define REG_VALUE_TO_CEL(ratio, raw) ((raw_n25c - raw) * 100 / ratio - 25)
+#define DEFAULT_N40C 1563
+#define REG_VALUE_TO_CEL(ratio, raw) ((raw_n40c - raw) * 100 / ratio - 40)
#define ANATOP_DEBUG false
#define THERMAL_FUSE_NAME "/sys/fsl_otp/HW_OCOTP_ANA1"
/* variables */
unsigned long anatop_base;
unsigned int ratio;
-unsigned int raw_25c, raw_hot, hot_temp, raw_n25c, raw_125c, raw_critical;
+unsigned int raw_25c, raw_hot, hot_temp, raw_n40c, raw_125c, raw_critical;
static struct clk *pll3_clk;
static bool full_run = true;
static bool suspend_flag;
@@ -320,10 +320,9 @@ static int anatop_thermal_get_temp(struct thermal_zone_device *thermal,
if (ANATOP_DEBUG)
anatop_dump_temperature_register();
-
- /* only the temp between -25C and 125C is valid, this
+ /* only the temp between -40C and 125C is valid, this
is for save */
- if (tmp <= raw_n25c && tmp >= raw_125c)
+ if (tmp <= raw_n40c && tmp >= raw_125c)
tz->temperature = REG_VALUE_TO_CEL(ratio, tmp);
else {
printk(KERN_WARNING "Invalid temperature, force it to 25C\n");
@@ -848,7 +847,7 @@ static int anatop_thermal_counting_ratio(unsigned int fuse_data)
hot_temp = fuse_data & 0xff;
ratio = ((raw_25c - raw_hot) * 100) / (hot_temp - 25);
- raw_n25c = raw_25c + ratio / 2;
+ raw_n40c = raw_25c + (13 * ratio) / 20;
raw_125c = raw_25c - ratio;
/* Init default critical temp to set alarm */
raw_critical = raw_25c - ratio * (KELVIN_TO_CEL(TEMP_CRITICAL, KELVIN_OFFSET) - 25) / 100;
@@ -913,7 +912,7 @@ static int anatop_thermal_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "failed to remap anatop calibration data address!\n");
goto anatop_failed;
}
- raw_n25c = DEFAULT_N25C;
+ raw_n40c = DEFAULT_N40C;
/* use calibration data to get ratio */
anatop_thermal_counting_ratio(__raw_readl(calibration_addr));