diff options
author | Richard Yeh <rcy@google.com> | 2022-11-28 04:04:42 +0000 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-01-30 18:52:50 +0000 |
commit | c18023bb1de40c44f3aba68e2f0ae5822bb06b26 (patch) | |
tree | 10c1fcf54fa4a725b82dc78aaa987e9b5a5c2f6c | |
parent | 387d72d0618a6cc4a6558e83525cee555848de26 (diff) | |
download | chrome-ec-firmware-fizz-10139.B.tar.gz |
fizz: Increase fan to reduce throttling.firmware-fizz-10139.B
Chromebox for Meetings (CfM) devices are videoconferencing appliances.
Discovering that a significant fraction of our fleet was throttling the
CPU due to temperature, resulting in bad video quality, we have decided
that these devices should never throttle. The present change reduces the
temperature thresholds at which we increase fan speeds. For most of the
time, when the CfM is idle, we expect no or little change in fan speeds.
During calls, the CfM CPU can exceed 60 C, and the sensors controlling
the fan are typically 10-20 degrees C cooler than the CPU, so we set
the maximum-fan temperature to 50-55 C in an attempt to arrest any
temperature increase before the CPU reaches throttling temperatures.
We add fan tables to enable hysteresis in the fan speed setting. Fan
RPMs are chosen to span the min-to-max range, while avoiding 50 Hz and
60 Hz line frequencies.
fizz and kalista boards are shared with non-CfM versions, while the
other boards are CfM-only. Since those boards are several years old, we
plan to build these firmware changes only into CfM-branch releases, not
all fizz and kalista devices.
Additional details at go/cfm-overheating . Temperature traces with load
testing on both top-of-tree and firmware with this change are shown at
go/cfm-overheating#heading=h.ykpzxotgnu2j
BRANCH=update-fan-tables
BUG=b:252966838,b:191187610,chromium:1383859
TEST=Confirmed validity of settings with `ectool thermalset`. Built
firmware, flashed to endeavour and excelsior (fizz), verified that fan
turns on earlier. This does not completely prevent throttling from
47.25 W to 15.00 W on Kaby Lake boards (endeavour, fizz, kalista), but
it does prevent dropping below 15.00 W. Comet Lake boards (ambassador,
genesis, moonbuggy, scout) start at 15.00 W and rarely throttle anyway.
Change-Id: I4eb532977677fbfd939fc46f851948cd4adf9788
Signed-off-by: Richard Yeh <rcy@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4004441
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
(cherry picked from commit decce1a6dd4204c8c13bc591f6d2f3ce6b49ffb3)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4201308
Reviewed-by: Kyle Williams <kdgwill@chromium.org>
-rw-r--r-- | board/fizz/board.c | 186 |
1 files changed, 100 insertions, 86 deletions
diff --git a/board/fizz/board.c b/board/fizz/board.c index 4fa7e3444c..be2d423353 100644 --- a/board/fizz/board.c +++ b/board/fizz/board.c @@ -294,14 +294,18 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); * Thermal limits for each temp sensor. All temps are in degrees K. Must be in * same order as enum temp_sensor_id. To always ignore any temp, use 0. */ +#define temp_fan_off (C_TO_K(25)) +#define temp_fan_max (C_TO_K(50)) struct ec_thermal_config thermal_params[] = { /* {Twarn, Thigh, Thalt}, <on> * {Twarn, Thigh, X }, <off> * fan_off, fan_max */ - {{0, C_TO_K(80), C_TO_K(81)}, {0, C_TO_K(78), 0}, - C_TO_K(4), C_TO_K(76)}, /* TMP431_Internal */ - {{0, 0, 0}, {0, 0, 0}, 0, 0}, /* TMP431_Sensor_1 */ + { { 0, C_TO_K(80), C_TO_K(81) }, + { 0, C_TO_K(78), 0 }, + temp_fan_off, + temp_fan_max }, /* TMP431_Internal */ + { { 0, 0, 0 }, { 0, 0, 0 }, 0, 0 }, /* TMP431_Sensor_1 */ }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); @@ -606,54 +610,99 @@ const struct pwm_t pwm_channels[] = { }; BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); -struct fan_step { - int on; - int off; - int rpm; +static const struct fan_step_1_1 *fan_table; + +static const struct fan_step_1_1 fan_table0[] = { + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(25), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(34), + .rpm = 2800 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(39), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(40), + .rpm = 3200 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(40), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(42), + .rpm = 3400 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(42), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(44), + .rpm = 4200 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(44), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(46), + .rpm = 4800 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(45), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(47), + .rpm = 5200 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(47), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(50), + .rpm = 5600 }, }; - -static const struct fan_step *fan_table; - -/* Note: Do not make the fan on/off point equal to 0 or 100 */ -static const struct fan_step fan_table0[] = { - {.on = 0, .off = 1, .rpm = 0}, - {.on = 36, .off = 1, .rpm = 2800}, - {.on = 58, .off = 58, .rpm = 3200}, - {.on = 66, .off = 61, .rpm = 3400}, - {.on = 75, .off = 69, .rpm = 4200}, - {.on = 81, .off = 76, .rpm = 4800}, - {.on = 88, .off = 83, .rpm = 5200}, - {.on = 98, .off = 91, .rpm = 5600}, -}; -static const struct fan_step fan_table1[] = { - {.on = 0, .off = 1, .rpm = 0}, - {.on = 36, .off = 1, .rpm = 2800}, - {.on = 62, .off = 58, .rpm = 3200}, - {.on = 68, .off = 63, .rpm = 3400}, - {.on = 75, .off = 69, .rpm = 4200}, - {.on = 81, .off = 76, .rpm = 4800}, - {.on = 88, .off = 83, .rpm = 5200}, - {.on = 98, .off = 91, .rpm = 5600}, +static const struct fan_step_1_1 fan_table1[] = { + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(25), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(34), + .rpm = 2800 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(39), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(40), + .rpm = 3200 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(40), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(42), + .rpm = 3400 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(42), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(44), + .rpm = 4200 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(44), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(46), + .rpm = 4800 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(45), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(47), + .rpm = 5200 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(47), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(50), + .rpm = 5600 }, }; -static const struct fan_step fan_table2[] = { - {.on = 0, .off = 1, .rpm = 0}, - {.on = 36, .off = 1, .rpm = 2200}, - {.on = 63, .off = 56, .rpm = 2900}, - {.on = 69, .off = 65, .rpm = 3000}, - {.on = 75, .off = 70, .rpm = 3300}, - {.on = 80, .off = 76, .rpm = 3600}, - {.on = 87, .off = 81, .rpm = 3900}, - {.on = 98, .off = 91, .rpm = 5000}, +static const struct fan_step_1_1 fan_table2[] = { + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(25), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(34), + .rpm = 2200 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(39), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(41), + .rpm = 2900 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(41), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(43), + .rpm = 3000 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(42), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(44), + .rpm = 3300 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(44), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(46), + .rpm = 3600 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(45), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(47), + .rpm = 3900 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(47), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(50), + .rpm = 5000 }, }; -static const struct fan_step fan_table3[] = { - {.on = 0, .off = 1, .rpm = 0}, - {.on = 36, .off = 22, .rpm = 2500}, - {.on = 54, .off = 49, .rpm = 3200}, - {.on = 61, .off = 56, .rpm = 3500}, - {.on = 68, .off = 63, .rpm = 3900}, - {.on = 75, .off = 69, .rpm = 4500}, - {.on = 82, .off = 76, .rpm = 5100}, - {.on = 92, .off = 85, .rpm = 5400}, +static const struct fan_step_1_1 fan_table3[] = { + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(30), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(34), + .rpm = 2500 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(37), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(39), + .rpm = 3200 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(39), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(40), + .rpm = 3500 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(40), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(42), + .rpm = 3900 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(42), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(44), + .rpm = 4500 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(44), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(46), + .rpm = 5100 }, + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(46), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(48), + .rpm = 5400 }, }; /* All fan tables must have the same number of levels */ #define NUM_FAN_LEVELS ARRAY_SIZE(fan_table0) @@ -820,45 +869,10 @@ static void board_init(void) } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); -int fan_percent_to_rpm(int fan, int pct) +int fan_percent_to_rpm(int fan_index, int temp_ratio) { - static int current_level; - static int previous_pct; - int i; - - /* - * Compare the pct and previous pct, we have the three paths : - * 1. decreasing path. (check the off point) - * 2. increasing path. (check the on point) - * 3. invariant path. (return the current RPM) - */ - if (pct < previous_pct) { - for (i = current_level; i >= 0; i--) { - if (pct <= fan_table[i].off) - current_level = i - 1; - else - break; - } - } else if (pct > previous_pct) { - for (i = current_level + 1; i < NUM_FAN_LEVELS; i++) { - if (pct >= fan_table[i].on) - current_level = i; - else - break; - } - } - - if (current_level < 0) - current_level = 0; - - previous_pct = pct; - - if (fan_table[current_level].rpm != - fan_get_rpm_target(FAN_CH(fan))) - cprintf(CC_THERMAL, "[%T Setting fan RPM to %d]\n", - fan_table[current_level].rpm); - - return fan_table[current_level].rpm; + return temp_ratio_to_rpm_hysteresis(fan_table, NUM_FAN_LEVELS, + fan_index, temp_ratio, NULL); } void board_rtc_reset(void) |