summaryrefslogtreecommitdiff
path: root/common/thermal.c
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2013-05-15 11:18:21 +0800
committerChromeBot <chrome-bot@google.com>2013-05-15 12:12:23 -0700
commitd9cf88b35ad211d873f48b41fd985e22ff049b83 (patch)
treeb57229f791bf4ac8b3bcdd358d80cd788f3de17c /common/thermal.c
parent3addfe80f9c19045457f4b489c99c3067db4fc96 (diff)
downloadchrome-ec-d9cf88b35ad211d873f48b41fd985e22ff049b83.tar.gz
Add thermal engine test
BUG=chrome-os-partner:19236 TEST=Pass the test. BRANCH=None Change-Id: I1c96437e1fb3492faa5352383f852dc1d2718ace Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/51248 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common/thermal.c')
-rw-r--r--common/thermal.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/common/thermal.c b/common/thermal.c
index 00970c6081..0015f5cca6 100644
--- a/common/thermal.c
+++ b/common/thermal.c
@@ -27,7 +27,8 @@
* temp_sensor_type. Threshold values for overheated action first (warning,
* prochot, power-down), followed by fan speed stepping thresholds.
*/
-static struct thermal_config_t thermal_config[TEMP_SENSOR_TYPE_COUNT] = {
+test_export_static struct thermal_config_t
+ thermal_config[TEMP_SENSOR_TYPE_COUNT] = {
/* TEMP_SENSOR_TYPE_CPU */
{THERMAL_CONFIG_WARNING_ON_FAIL,
{373, 378, 383, 327, 335, 343, 351, 359} } ,
@@ -38,8 +39,8 @@ static struct thermal_config_t thermal_config[TEMP_SENSOR_TYPE_COUNT] = {
};
/* Fan speed settings. Real max RPM is about 9300. */
-static const int fan_speed[THERMAL_FAN_STEPS + 1] = {0, 3000, 4575, 6150,
- 7725, -1};
+test_export_static const int fan_speed[THERMAL_FAN_STEPS + 1] =
+ {0, 3000, 4575, 6150, 7725, -1};
/* Number of consecutive overheated events for each temperature sensor. */
static int8_t ot_count[TEMP_SENSOR_COUNT][THRESHOLD_COUNT + THERMAL_FAN_STEPS];
@@ -159,7 +160,9 @@ static inline void update_and_check_stat(int temp,
const int16_t threshold = config->thresholds[threshold_id];
const int delay = temp_sensors[sensor_id].action_delay_sec;
- if (threshold > 0 && temp >= threshold) {
+ if (threshold <= 0) {
+ ot_count[sensor_id][threshold_id] = 0;
+ } else if (temp >= threshold) {
++ot_count[sensor_id][threshold_id];
if (ot_count[sensor_id][threshold_id] >= delay) {
ot_count[sensor_id][threshold_id] = delay;
@@ -174,8 +177,6 @@ static inline void update_and_check_stat(int temp,
* threshold causing overheated actions to trigger repeatedly.
*/
overheated[threshold_id] = 1;
- } else {
- ot_count[sensor_id][threshold_id] = 0;
}
}