summaryrefslogtreecommitdiff
path: root/common/thermal.c
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2012-06-07 14:52:40 +0800
committerGerrit <chrome-bot@google.com>2012-06-08 08:57:35 -0700
commit3367d02f1f5091f535a6c8a4b61208bbc8c9fac7 (patch)
tree06b80480b6e0d1d9cad43ac422cd16dd700f6a57 /common/thermal.c
parent210ddfefcfe90944c70105463beb6f795513c5e6 (diff)
downloadchrome-ec-3367d02f1f5091f535a6c8a4b61208bbc8c9fac7.tar.gz
Add option to adjust delay for indiviual temperature sensor
Perviously we have a 10-second delay for all temperature sensor. This is not suitable for CPU temperature. Let's change that to have an option to set the delay length for each temperature sensor. And also shorten the delay of TMP006 sensor to 7 seconds, that of EC internal temperature to 4 seconds, and that of PECI CPU temperature to 0 second. Signed-off-by: Vic Yang <victoryang@chromium.org> BUG=chrome-os-partner:10233 TEST=Check EC issued warning as soon as CPU temperature reached the threshold. (cherry picked from commit cf24df7f3ee24eaa5dbeae3b304d11ddada9a914) Change-Id: Id2cc4a437bde15697afe4020b6153e5d13466759 Reviewed-on: https://gerrit.chromium.org/gerrit/24694 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Vic Yang <victoryang@chromium.org> Commit-Ready: Vic Yang <victoryang@chromium.org>
Diffstat (limited to 'common/thermal.c')
-rw-r--r--common/thermal.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/common/thermal.c b/common/thermal.c
index a4f2ab1e0f..eb6b688c3b 100644
--- a/common/thermal.c
+++ b/common/thermal.c
@@ -137,7 +137,7 @@ static void overheated_action(void)
/* Update counter and check if the counter has reached delay limit.
- * Note that we have 10 seconds delay to prevent one error value triggering
+ * Note that we have various delay period to prevent one error value triggering
* overheated action. */
static inline void update_and_check_stat(int temp,
int sensor_id,
@@ -146,15 +146,16 @@ static inline void update_and_check_stat(int temp,
enum temp_sensor_type type = temp_sensors[sensor_id].type;
const struct thermal_config_t *config = thermal_config + type;
const int16_t threshold = config->thresholds[threshold_id];
+ const int delay = temp_sensors[sensor_id].action_delay_sec;
if (threshold > 0 && temp >= threshold) {
++ot_count[sensor_id][threshold_id];
- if (ot_count[sensor_id][threshold_id] >= 10) {
- ot_count[sensor_id][threshold_id] = 10;
+ if (ot_count[sensor_id][threshold_id] >= delay) {
+ ot_count[sensor_id][threshold_id] = delay;
overheated[threshold_id] = 1;
}
}
- else if (ot_count[sensor_id][threshold_id] >= 10 &&
+ else if (ot_count[sensor_id][threshold_id] >= delay &&
temp >= threshold - 3) {
/* Once the threshold is reached, only if the temperature
* drops to 3 degrees below threshold do we deassert