diff options
author | Caveh Jalali <caveh@chromium.org> | 2021-02-25 18:30:33 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-03-04 21:31:32 +0000 |
commit | 503826bfe1ae70ca020b35ca32848da85f25b1ef (patch) | |
tree | dcb18d8497cab8a1aa34145ae13a31f205581975 /board | |
parent | 92a4dfc5fcb5600a3299e390269939d733afdd6c (diff) | |
download | chrome-ec-503826bfe1ae70ca020b35ca32848da85f25b1ef.tar.gz |
brya: Use fixed fan speeds
This sets the fan speed based on SoC power state. If the AP is off, run
the fan at 33%. If the AP is on, run the fan at 100%. Our sensors are
not yet calibrated and we don't have confirmed thermal thresholds for
the SoC, so just keep the fan running at full speed when the AP is
running.
BRANCH=none
BUG=b:179975706,b:180681346,b:181271666
TEST=fan is slow before AP boots, then speeds up as soon as AP starts
Change-Id: Id10e1510496d94bd3cc8ea70e4661c52d15fe9ed
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2722552
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Sooraj Govindan <sooraj.govindan@intel.com>
Diffstat (limited to 'board')
-rw-r--r-- | board/brya/board.h | 7 | ||||
-rw-r--r-- | board/brya/fans.c | 45 | ||||
-rw-r--r-- | board/brya/pwm.c | 3 |
3 files changed, 48 insertions, 7 deletions
diff --git a/board/brya/board.h b/board/brya/board.h index 059d81d8ce..8c89a3e917 100644 --- a/board/brya/board.h +++ b/board/brya/board.h @@ -49,8 +49,6 @@ #define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL #define GPIO_WP_L GPIO_EC_WP_ODL -#define CONFIG_FANS FAN_CH_COUNT - /* System has back-lit keyboard */ #define CONFIG_PWM_KBLIGHT @@ -87,6 +85,11 @@ #define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_SEQ_EC_DSW_PWROK #define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B +/* + * TODO(b/181271666): no fan control loop until sensors are tuned + */ +/* #define CONFIG_FANS FAN_CH_COUNT */ + #ifndef __ASSEMBLER__ #include "gpio_signal.h" /* needed by registers.h */ diff --git a/board/brya/fans.c b/board/brya/fans.c index 9a7b7f8199..1427499e79 100644 --- a/board/brya/fans.c +++ b/board/brya/fans.c @@ -6,9 +6,12 @@ /* Physical fans. These are logically separate from pwm_channels. */ #include "common.h" - -#include "fan.h" +#include "console.h" #include "fan_chip.h" +#include "fan.h" +#include "hooks.h" +#include "pwm_chip.h" +#include "pwm.h" /* MFT channels. These are logically separate from pwm_channels. */ const struct mft_t mft_channels[] = { @@ -45,3 +48,41 @@ const struct fan_t fans[FAN_CH_COUNT] = { .rpm = &fan_rpm_0, }, }; + +#ifndef CONFIG_FANS + +/* + * TODO(b/181271666): use static fan speeds until fan and sensors are + * tuned. for now, use: + * + * AP off: 33% + * AP on: 100% + */ + +static void fan_slow(void) +{ + const int duty_pct = 33; + + ccprints("%s: speed %d%%", __func__, duty_pct); + + pwm_enable(PWM_CH_FAN, 1); + pwm_set_duty(PWM_CH_FAN, duty_pct); +} + +static void fan_max(void) +{ + const int duty_pct = 100; + + ccprints("%s: speed %d%%", __func__, duty_pct); + + pwm_enable(PWM_CH_FAN, 1); + pwm_set_duty(PWM_CH_FAN, duty_pct); +} + +DECLARE_HOOK(HOOK_INIT, fan_slow, HOOK_PRIO_DEFAULT); +DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, fan_slow, HOOK_PRIO_DEFAULT); +DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, fan_slow, HOOK_PRIO_DEFAULT); +DECLARE_HOOK(HOOK_CHIPSET_RESET, fan_max, HOOK_PRIO_FIRST); +DECLARE_HOOK(HOOK_CHIPSET_RESUME, fan_max, HOOK_PRIO_DEFAULT); + +#endif /* CONFIG_FANS */ diff --git a/board/brya/pwm.c b/board/brya/pwm.c index 3e8df2a85f..a6b65b038c 100644 --- a/board/brya/pwm.c +++ b/board/brya/pwm.c @@ -66,8 +66,5 @@ static void board_pwm_init(void) pwm_enable(PWM_CH_KBLIGHT, 1); pwm_set_duty(PWM_CH_KBLIGHT, 50); - - pwm_enable(PWM_CH_FAN, 1); - pwm_set_duty(PWM_CH_FAN, 100); } DECLARE_HOOK(HOOK_INIT, board_pwm_init, HOOK_PRIO_DEFAULT); |