summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2012-06-07 14:52:40 +0800
committerVic Yang <victoryang@chromium.org>2012-06-07 00:03:33 -0700
commit4be8a7cad99a2cbfea8d9db2693cf951416e45fd (patch)
treea616c3f8d31652060d873ee59337b6a5d0353db2
parent54d51d0238254a28354ddafdaf3573544cf9fefd (diff)
downloadchrome-ec-4be8a7cad99a2cbfea8d9db2693cf951416e45fd.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. Change-Id: I63ec2bb1fa17a2d33b52091ff14fa81b7f112232 Reviewed-on: https://gerrit.chromium.org/gerrit/24692 Reviewed-by: Rong Chang <rongchang@chromium.org> Tested-by: Vic Yang <victoryang@chromium.org>
-rw-r--r--board/link/board_temp_sensor.c20
-rw-r--r--common/thermal.c9
-rw-r--r--include/temp_sensor.h3
3 files changed, 18 insertions, 14 deletions
diff --git a/board/link/board_temp_sensor.c b/board/link/board_temp_sensor.c
index 91b3d1ba4c..cd445c760d 100644
--- a/board/link/board_temp_sensor.c
+++ b/board/link/board_temp_sensor.c
@@ -29,29 +29,29 @@
const struct temp_sensor_t temp_sensors[TEMP_SENSOR_COUNT] = {
#ifdef CONFIG_TMP006
{"I2C_CPU-Die", TEMP_SENSOR_POWER_VS, TEMP_SENSOR_TYPE_CPU,
- tmp006_get_val, 0},
+ tmp006_get_val, 0, 7},
{"I2C_CPU-Object", TEMP_SENSOR_POWER_VS, TEMP_SENSOR_TYPE_CASE,
- tmp006_get_val, 1},
+ tmp006_get_val, 1, 7},
{"I2C_PCH-Die", TEMP_SENSOR_POWER_VS, TEMP_SENSOR_TYPE_BOARD,
- tmp006_get_val, 2},
+ tmp006_get_val, 2, 7},
{"I2C_PCH-Object", TEMP_SENSOR_POWER_VS, TEMP_SENSOR_TYPE_CASE,
- tmp006_get_val, 3},
+ tmp006_get_val, 3, 7},
{"I2C_DDR-Die", TEMP_SENSOR_POWER_VS, TEMP_SENSOR_TYPE_BOARD,
- tmp006_get_val, 4},
+ tmp006_get_val, 4, 7},
{"I2C_DDR-Object", TEMP_SENSOR_POWER_VS, TEMP_SENSOR_TYPE_CASE,
- tmp006_get_val, 5},
+ tmp006_get_val, 5, 7},
{"I2C_Charger-Die", TEMP_SENSOR_POWER_VS, TEMP_SENSOR_TYPE_BOARD,
- tmp006_get_val, 6},
+ tmp006_get_val, 6, 7},
{"I2C_Charger-Object", TEMP_SENSOR_POWER_VS, TEMP_SENSOR_TYPE_CASE,
- tmp006_get_val, 7},
+ tmp006_get_val, 7, 7},
#endif
#ifdef CONFIG_TASK_TEMPSENSOR
{"ECInternal", TEMP_SENSOR_POWER_NONE, TEMP_SENSOR_TYPE_BOARD,
- chip_temp_sensor_get_val, 0},
+ chip_temp_sensor_get_val, 0, 4},
#endif
#ifdef CONFIG_PECI
{"PECI", TEMP_SENSOR_POWER_CPU, TEMP_SENSOR_TYPE_CPU,
- peci_temp_sensor_get_val, 0},
+ peci_temp_sensor_get_val, 0, 0},
#endif
};
diff --git a/common/thermal.c b/common/thermal.c
index 72709cd8ec..b061f65749 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].delay;
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
diff --git a/include/temp_sensor.h b/include/temp_sensor.h
index 158868b66c..ffba0efa67 100644
--- a/include/temp_sensor.h
+++ b/include/temp_sensor.h
@@ -40,6 +40,9 @@ struct temp_sensor_t {
int (*read)(int idx);
/* Index among the same kind of sensors. */
int idx;
+ /* Delay between reading tempearture and taking action about it,
+ * in seconds. */
+ int delay;
};
/* Return the most recently measured temperature for the sensor in K,