diff options
Diffstat (limited to 'board/scout/board.c')
-rw-r--r-- | board/scout/board.c | 68 |
1 files changed, 49 insertions, 19 deletions
diff --git a/board/scout/board.c b/board/scout/board.c index 5a4c84cba5..3d5306fdf0 100644 --- a/board/scout/board.c +++ b/board/scout/board.c @@ -362,6 +362,8 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT); /******************************************************************************/ /* Thermal control; drive fan based on temperature sensors. */ +static const int temp_fan_off = C_TO_K(35); +static const int temp_fan_max = C_TO_K(55); /* * TODO(b/202062363): Remove when clang is fixed. */ @@ -377,28 +379,23 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT); [EC_TEMP_THRESH_HIGH] = C_TO_K(78), \ [EC_TEMP_THRESH_HALT] = 0, \ }, \ - .temp_fan_off = C_TO_K(25), \ - .temp_fan_max = C_TO_K(89), \ + .temp_fan_off = temp_fan_off, \ + .temp_fan_max = temp_fan_max, \ } __maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A; -/* - * TODO(b/202062363): Remove when clang is fixed. - */ -#define THERMAL_B \ - { \ - .temp_host = { \ - [EC_TEMP_THRESH_WARN] = 0, \ - [EC_TEMP_THRESH_HIGH] = C_TO_K(78), \ - [EC_TEMP_THRESH_HALT] = C_TO_K(85), \ - }, \ - .temp_host_release = { \ - [EC_TEMP_THRESH_WARN] = 0, \ - [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \ - [EC_TEMP_THRESH_HALT] = 0, \ - }, \ - } -__maybe_unused static const struct ec_thermal_config thermal_b = THERMAL_B; +static const struct ec_thermal_config thermal_b = { + .temp_host = { + [EC_TEMP_THRESH_WARN] = 0, + [EC_TEMP_THRESH_HIGH] = C_TO_K(78), + [EC_TEMP_THRESH_HALT] = C_TO_K(85), + }, + .temp_host_release = { + [EC_TEMP_THRESH_WARN] = 0, + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), + [EC_TEMP_THRESH_HALT] = 0, + }, + }; struct ec_thermal_config thermal_params[] = { [TEMP_SENSOR_CORE] = THERMAL_A, @@ -406,6 +403,39 @@ struct ec_thermal_config thermal_params[] = { }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); +static const struct fan_step_1_1 fan_table0[] = { + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(35), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(41), + .rpm = 2400 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(40), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(44), + .rpm = 2900 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(42), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(46), + .rpm = 3400 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(44), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(48), + .rpm = 3900 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(46), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(50), + .rpm = 4400 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(48), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(52), + .rpm = 4900 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(50), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(55), + .rpm = 5300 }, +}; +#define NUM_FAN_LEVELS ARRAY_SIZE(fan_table0) + +static const struct fan_step_1_1 *fan_table = fan_table0; + +int fan_percent_to_rpm(int fan, int temp_ratio) +{ + return temp_ratio_to_rpm_hysteresis(fan_table, NUM_FAN_LEVELS, fan, + temp_ratio, NULL); +} + /* Power sensors */ const struct ina3221_t ina3221[] = { { I2C_PORT_INA, 0x40, { "PP3300_G", "PP5000_A", "PP3300_WLAN" } }, |