summaryrefslogtreecommitdiff
authorTao Zeng <tao.zeng@amlogic.com>2015-09-02 07:58:55 (GMT)
committer Tao Zeng <tao.zeng@amlogic.com>2015-09-02 10:11:31 (GMT)
commit23df120e6a04f694b5e9bc99346781fb3b86583b (patch)
treeed0b366ac43ff6183d393efe97f803afd50c7819
parent1509d287e020a7629f4839034400f7e4354585dd (diff)
downloadthermal-23df120e6a04f694b5e9bc99346781fb3b86583b.zip
thermal-23df120e6a04f694b5e9bc99346781fb3b86583b.tar.gz
thermal-23df120e6a04f694b5e9bc99346781fb3b86583b.tar.bz2
PD#112175: thermal: check sensor value
If sensor returns a invaild temperature value, keep mode should not work Change-Id: Ifcd0a5334b37f50cd60ec644c010b4ed2b24826c
Diffstat
-rw-r--r--amlogic_thermal.h1
-rw-r--r--amlogic_thermal.o_shipped277
-rw-r--r--amlogic_thermal_module.c11
3 files changed, 148 insertions, 141 deletions
diff --git a/amlogic_thermal.h b/amlogic_thermal.h
index 63e5571..6f6d256 100644
--- a/amlogic_thermal.h
+++ b/amlogic_thermal.h
@@ -51,6 +51,7 @@ struct amlogic_thermal_platform_data {
const char *name;
struct temp_trip *tmp_trip;
unsigned int temp_trip_count;
+ unsigned int temp_valid;
unsigned int current_temp;
unsigned int idle_interval;
unsigned int trim_flag;
diff --git a/amlogic_thermal.o_shipped b/amlogic_thermal.o_shipped
index f0d4bb7..6c0a6ab 100644
--- a/amlogic_thermal.o_shipped
+++ b/amlogic_thermal.o_shipped
@@ -1,16 +1,16 @@
-ELF
+ELF
€¹àªA
€¹C
-€¹C
-@¹ˆ@¹!
-
+€¹C
+@¹ˆ@¹!
+
‡*
-!
-
-‡*
- 
- 
+!
+
+‡*
+ 
+ 
@@ -27,158 +27,155 @@
-
+

"

Œ
- 8
-Ç<
-
-
+ 8
+_=
+
+




-
-
-
+
+
+


-
-
-
-
-
+
+
+
+
+

-
-
-
+
+
+

-
-
+
+

-
-
-
-
-÷
-‰"
-@
-2'N%
-
-
-—
-/
-Ò
-
-I
-I
-L
-L
-L
-Z
-
-k
-j
- : ; 
-
-
-
-
-
-
-
-
-
-
-
-
-
- s  !z #"!!/11"0v  .>=5",0!L=LÕ
+
+
+
+
+
+•"
+2'Z%
+
+
+Ý
+
+—
+Ò
+>
+
+M
+M
+X
+X
+^
+
+j
+ : ; 
+
+
+
+
+
+
+
+
+
+
+
+
+
+ s  !z #"!!/11"0v  .>=5",0!L=LÕ
ÓAÞÝ 
-ÔÓAÖÕAÞÝ 
+ÔÓAÖÕAÞÝ 
ž A C“”•–—˜W
ÔÓAÖÕAØ×AÞÝ 
- AÔÓAÖÕAÞÝ
+ AÔÓAÖÕAÞÝ
˜ ™šI
- AÔÓAÖÕAØ×AÚÙAÞÝ
-
+ AÔÓAÖÕAØ×AÚÙAÞÝ
+
-
-
-
-
-
-
-
-
-
-L
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-.
-
-
-
-&
-+
-
-5
-7
-
-
-
-
-
-
-
-
-"
-
-
-?
-V
-
-=
-m
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+F
+
+N
+
+$
+
+&
+
+
+-
+0
+
+
+
+
+
+
+?
+
+
+
+f
+
+A
+h
+
+
+
+
+
+
+
+
+
-s
-
-
-
-
-
-w
-
+u
+
diff --git a/amlogic_thermal_module.c b/amlogic_thermal_module.c
index b3426ad..8ee83b6 100644
--- a/amlogic_thermal_module.c
+++ b/amlogic_thermal_module.c
@@ -53,6 +53,7 @@
#include "amlogic_thermal.h"
#define DBG_VIRTUAL 0
+#define MIN_TEMP (-273)
int thermal_debug_enable = 0;
int high_temp_protect = 0;
atomic_t freq_update_flag;
@@ -385,7 +386,8 @@ static void thermal_work(struct work_struct *work)
if (policy) {
cpu_freq = policy->cur;
}
- keep_mode_work(pdata, cpu_freq);
+ if (pdata->temp_valid)
+ keep_mode_work(pdata, cpu_freq);
if (pdata->mode == THERMAL_DEVICE_ENABLED) { // no need to do this work again if thermal disabled
schedule_delayed_work(&pdata->thermal_work, msecs_to_jiffies(100));
}
@@ -620,8 +622,15 @@ static int amlogic_get_temp(struct thermal_zone_device *thermal,
unsigned long *temp)
{
struct amlogic_thermal_platform_data *pdata = thermal->devdata;
+ int tmp;
if (pdata->trim_flag) {
+ tmp = get_cpu_temp();
+ if (tmp < MIN_TEMP) {
+ pdata->temp_valid = 0;
+ return -EINVAL;
+ }
+ pdata->temp_valid = 1;
*temp = (unsigned long)get_cpu_temp();
pdata->current_temp = *temp;
} else if (pdata->virtual_thermal_en) {