diff --git a/board/link/board_temp_sensor.c b/board/link/board_temp_sensor.c index 4534f0ba05..4c10e59d78 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 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 diff --git a/include/temp_sensor.h b/include/temp_sensor.h index 158868b66c..85cfcf53ce 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 temperature and taking action about it, + * in seconds. */ + int action_delay_sec; }; /* Return the most recently measured temperature for the sensor in K,