diff options
author | Ryan Zhang <Ryan.Zhang@quanta.corp-partner.google.com> | 2017-10-20 10:08:12 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-11-06 13:48:38 -0800 |
commit | f48cf0e8b27fb484271540e4cc272aea581a3b48 (patch) | |
tree | 08484f3eb500b2f50b0e394101fbb4e5e20225a5 /board/fizz/board.c | |
parent | 1f9b681ac16fd60c245ecd86391f883035cb1037 (diff) | |
download | chrome-ec-f48cf0e8b27fb484271540e4cc272aea581a3b48.tar.gz |
Fizz: Modify thermal table
Modify thermal table for Fizz
reference patches: 627542, 288256, 329359
on off RPM
step0 0
step1 16 2 2800
step2 27 18 3200
step3 35 29 3400
step4 43 37 4200
step5 54 45 4800
step6 64 56 5200
step7 97 83 5600
Prochot degree:
active when t >= 88C
release when t <= 85C
Shutdown degree: when t >= 90C
BUG=b:67487721, b:64439568
BRANCH=master
TEST=fan target speed follows table, make -j buildall pass
Change-Id: I3378668a560b8ddc568fe9cbf2703613fad8e4b6
Signed-off-by: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/729606
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'board/fizz/board.c')
-rw-r--r-- | board/fizz/board.c | 78 |
1 files changed, 71 insertions, 7 deletions
diff --git a/board/fizz/board.c b/board/fizz/board.c index 940caeae37..ce0ff98920 100644 --- a/board/fizz/board.c +++ b/board/fizz/board.c @@ -149,9 +149,9 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); const struct fan_t fans[] = { [FAN_CH_0] = { .flags = FAN_USE_RPM_MODE, - .rpm_min = 1000, - .rpm_start = 1000, - .rpm_max = 5500, + .rpm_min = 2800, + .rpm_start = 2800, + .rpm_max = 5600, .ch = MFT_CH_0, /* Use MFT id to control fan */ .pgood_gpio = -1, .enable_gpio = GPIO_FAN_PWR_EN, @@ -271,10 +271,14 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); * same order as enum temp_sensor_id. To always ignore any temp, use 0. */ struct ec_thermal_config thermal_params[] = { - /* {Twarn, Thigh, Thalt}, fan_off, fan_max */ - {{0, 0, 0}, C_TO_K(35), C_TO_K(68)}, /* TMP432_Internal */ - {{0, 0, 0}, 0, 0}, /* TMP432_Sensor_1 */ - {{0, 0, 0}, 0, 0}, /* TMP432_Sensor_2 */ + /* {Twarn, Thigh, Thalt}, <on> + * {Twarn, Thigh, X }, <off> + * fan_off, fan_max + */ + {{0, C_TO_K(87), C_TO_K(89)}, {0, C_TO_K(86), 0}, + C_TO_K(44), C_TO_K(81)},/* TMP432_Internal */ + {{0, 0, 0}, {0, 0, 0}, 0, 0}, /* TMP432_Sensor_1 */ + {{0, 0, 0}, {0, 0, 0}, 0, 0}, /* TMP432_Sensor_2 */ }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); @@ -522,3 +526,63 @@ const struct pwm_t pwm_channels[] = { [PWM_CH_FAN] = {4, PWM_CONFIG_OPEN_DRAIN, 25000}, }; BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); + +struct fan_step { + int on; + int off; + int rpm; +}; + +/* Do not make the fan on/off point equal to 0 or 100 */ +const struct fan_step fan_table[] = { + {.off = 2, .rpm = 0}, + {.on = 16, .off = 2, .rpm = 2800}, + {.on = 27, .off = 18, .rpm = 3200}, + {.on = 35, .off = 29, .rpm = 3400}, + {.on = 43, .off = 37, .rpm = 4200}, + {.on = 54, .off = 45, .rpm = 4800}, + {.on = 64, .off = 56, .rpm = 5200}, + {.on = 97, .off = 83, .rpm = 5600}, +}; +#define NUM_FAN_LEVELS ARRAY_SIZE(fan_table) + +int fan_percent_to_rpm(int fan, int pct) +{ + 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(fans[fan].ch)) + cprintf(CC_THERMAL, "[%T Setting fan RPM to %d]\n", + fan_table[current_level].rpm); + + return fan_table[current_level].rpm; +} |