diff options
author | Sue <sue.chen@quanta.corp-partner.google.com> | 2020-04-14 10:31:40 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-04-16 09:16:08 +0000 |
commit | 4cf22dc7c90da6431b8727699eb801dc492604f8 (patch) | |
tree | eaebb770ce638c6a2bd210e6fedbe7382907667d /board | |
parent | d9936b2edcb715950421f9ced02c92bb408b87c4 (diff) | |
download | chrome-ec-4cf22dc7c90da6431b8727699eb801dc492604f8.tar.gz |
Ezkinil: Update thermal table
Modify thermal_params and fan_rpm_0
Add fan_table:
on off RPM
step0 2 0
step1 15 2 2800
step2 23 13 3200
step3 30 21 3400
step4 38 28 3700
step5 45 36 4200
step6 55 43 4500
step7 66 53 5300
BUG=b:153937447
BRANCH=none
TEST=make buildall
Change-Id: I25aedc034dcdc473b2dca36d7eac0aa2ba93f7bf
Signed-off-by: Sue Chen <sue.chen@quanta.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2147768
Reviewed-by: Edward Hill <ecgh@chromium.org>
Reviewed-by: Vincent Wang <vwang@chromium.org>
Tested-by: Edward Hill <ecgh@chromium.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/ezkinil/board.c | 92 | ||||
-rw-r--r-- | board/ezkinil/board.h | 2 |
2 files changed, 85 insertions, 9 deletions
diff --git a/board/ezkinil/board.c b/board/ezkinil/board.c index cf84888f8b..6191c3403c 100644 --- a/board/ezkinil/board.c +++ b/board/ezkinil/board.c @@ -279,9 +279,9 @@ const struct fan_conf fan_conf_0 = { .enable_gpio = -1, }; const struct fan_rpm fan_rpm_0 = { - .rpm_min = 3100, - .rpm_start = 3100, - .rpm_max = 6900, + .rpm_min = 2800, + .rpm_start = 2800, + .rpm_max = 6000, }; const struct fan_t fans[] = { [FAN_CH_0] = { @@ -293,14 +293,26 @@ BUILD_ASSERT(ARRAY_SIZE(fans) == FAN_CH_COUNT); const static struct ec_thermal_config thermal_thermistor = { .temp_host = { + [EC_TEMP_THRESH_HIGH] = C_TO_K(85), + [EC_TEMP_THRESH_HALT] = C_TO_K(95), + }, + .temp_host_release = { + [EC_TEMP_THRESH_HIGH] = C_TO_K(70), + }, + .temp_fan_off = 0, + .temp_fan_max = 0, +}; + +const static struct ec_thermal_config thermal_soc = { + .temp_host = { [EC_TEMP_THRESH_HIGH] = C_TO_K(75), [EC_TEMP_THRESH_HALT] = C_TO_K(80), }, .temp_host_release = { [EC_TEMP_THRESH_HIGH] = C_TO_K(65), }, - .temp_fan_off = C_TO_K(25), - .temp_fan_max = C_TO_K(50), + .temp_fan_off = 0, + .temp_fan_max = 0, }; const static struct ec_thermal_config thermal_cpu = { @@ -309,18 +321,80 @@ const static struct ec_thermal_config thermal_cpu = { [EC_TEMP_THRESH_HALT] = C_TO_K(95), }, .temp_host_release = { - [EC_TEMP_THRESH_HIGH] = C_TO_K(65), + [EC_TEMP_THRESH_HIGH] = C_TO_K(80), }, - .temp_fan_off = C_TO_K(25), - .temp_fan_max = C_TO_K(50), + .temp_fan_off = C_TO_K(37), + .temp_fan_max = C_TO_K(90), }; struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT]; +struct fan_step { + int on; + int off; + int rpm; +}; + +/* 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 = 15, .off = 2, .rpm = 2800}, + {.on = 23, .off = 13, .rpm = 3200}, + {.on = 30, .off = 21, .rpm = 3400}, + {.on = 38, .off = 28, .rpm = 3700}, + {.on = 45, .off = 36, .rpm = 4200}, + {.on = 55, .off = 43, .rpm = 4500}, + {.on = 66, .off = 53, .rpm = 5300}, +}; +/* 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 void setup_fans(void) { thermal_params[TEMP_SENSOR_CHARGER] = thermal_thermistor; - thermal_params[TEMP_SENSOR_SOC] = thermal_thermistor; + thermal_params[TEMP_SENSOR_SOC] = thermal_soc; thermal_params[TEMP_SENSOR_CPU] = thermal_cpu; } DECLARE_HOOK(HOOK_INIT, setup_fans, HOOK_PRIO_DEFAULT); + +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(FAN_CH(fan))) + cprints(CC_THERMAL, "Setting fan RPM to %d", + fan_table[current_level].rpm); + + return fan_table[current_level].rpm; +} diff --git a/board/ezkinil/board.h b/board/ezkinil/board.h index ba546ffb91..faf3011949 100644 --- a/board/ezkinil/board.h +++ b/board/ezkinil/board.h @@ -22,6 +22,8 @@ #define CONFIG_MKBP_USE_GPIO +#define CONFIG_FAN_RPM_CUSTOM + /* Motion sensing drivers */ #define CONFIG_ACCELGYRO_BMI160 #define CONFIG_ACCELGYRO_BMI160_INT_EVENT \ |