diff options
author | Richard Yeh <rcy@google.com> | 2022-11-28 04:06:21 +0000 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-01-30 17:38:05 +0000 |
commit | a84e95ad22d844cfca73db20b46fa50995bbf2d7 (patch) | |
tree | 3abf6b76553b0363bdb68ae91a2e8a26713a6741 /board/endeavour/board.c | |
parent | 780ff4ad915a465d2ac54e2f5f6467ab90b232d3 (diff) | |
download | chrome-ec-a84e95ad22d844cfca73db20b46fa50995bbf2d7.tar.gz |
endeavour: Increase fan to reduce throttling.firmware-endeavour-13259.B-master
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.
Signed-off-by: Richard Yeh <rcy@google.com>
Change-Id: I3719b6828411bda4e0c1efde58065ef2cf35ceea
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4060609
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
(cherry picked from commit b1f1b67b40cbd16d9bf6e76c3bf1eceb125c6071)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4200716
Reviewed-by: Kyle Williams <kdgwill@chromium.org>
Diffstat (limited to 'board/endeavour/board.c')
-rw-r--r-- | board/endeavour/board.c | 92 |
1 files changed, 33 insertions, 59 deletions
diff --git a/board/endeavour/board.c b/board/endeavour/board.c index e59985729d..9035f53f3c 100644 --- a/board/endeavour/board.c +++ b/board/endeavour/board.c @@ -119,14 +119,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. */ +static const int temp_fan_off = C_TO_K(35); +static const int temp_fan_max = C_TO_K(55); struct ec_thermal_config thermal_params[] = { /* {Twarn, Thigh, Thalt}, <on> * {Twarn, Thigh, X }, <off> * fan_off, fan_max */ - {{0, C_TO_K(81), C_TO_K(82)}, {0, C_TO_K(77), 0}, - C_TO_K(19), C_TO_K(74)}, /* TMP431_Internal */ - {{0, 0, 0}, {0, 0, 0}, 0, 0}, /* TMP431_Sensor_1 */ + { { 0, C_TO_K(81), C_TO_K(82) }, + { 0, C_TO_K(77), 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); @@ -301,27 +305,32 @@ 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_table0[] = { + { .decreasing_temp_ratio_threshold = TEMP_TO_RATIO(35), + .increasing_temp_ratio_threshold = TEMP_TO_RATIO(41), + .rpm = 2500 }, + { .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 = 5400 }, }; - -/* Note: Do not make the fan on/off point equal to 0 or 100 */ -static const struct fan_step fan_table0[] = { - {.on = 0, .off = 2, .rpm = 0}, - {.on = 11, .off = 2, .rpm = 2500}, - {.on = 38, .off = 29, .rpm = 3200}, - {.on = 65, .off = 36, .rpm = 3500}, - {.on = 76, .off = 64, .rpm = 3900}, - {.on = 84, .off = 75, .rpm = 4500}, - {.on = 91, .off = 82, .rpm = 5100}, - {.on = 98, .off = 89, .rpm = 5400}, -}; -/* All fan tables must have the same number of levels */ #define NUM_FAN_LEVELS ARRAY_SIZE(fan_table0) -static const struct fan_step *fan_table = fan_table0; +static const struct fan_step_1_1 *fan_table = fan_table0; static void cbi_init(void) @@ -347,43 +356,8 @@ 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))) - cprints(CC_THERMAL, "Setting fan RPM to %d", - 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); } |