summaryrefslogtreecommitdiff
path: root/common/thermal.c
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2013-05-17 12:25:05 +0800
committerChromeBot <chrome-bot@google.com>2013-05-17 09:52:26 -0700
commit26f0e5d1d20da1cd4ffb83c603273b2ac32a670f (patch)
tree7f65bc6ff94894bcf19bf21b1e2ef29cce6aa88c /common/thermal.c
parentce9d7ca9e9408e22f2bbbe2c72e7df3d5cc1cd43 (diff)
downloadchrome-ec-26f0e5d1d20da1cd4ffb83c603273b2ac32a670f.tar.gz
Revert "Revert "Add thermal engine test""
This reverts commit 89e688a3325e91d3c59ac639f04f2c91019c9b10. Time-scaling is added back. We can run this test now. BUG=chrome-os-partner:19236 TEST=Pass the test. BRANCH=None Change-Id: Id3dcec6fc12489f5f0602de91c6560a8dfbef9af Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/51551 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;
}
}