diff options
author | Rob Barnes <robbarnes@google.com> | 2021-03-15 17:30:45 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-03-16 14:52:19 +0000 |
commit | 861b153c805467e351d864284c47324ad56c1342 (patch) | |
tree | ae44b0e2cc4fc3f8257b36bd851aab9bb3d296d4 | |
parent | 6583961e9c8e51207fcf0acfa0f4022c8147b170 (diff) | |
download | chrome-ec-861b153c805467e351d864284c47324ad56c1342.tar.gz |
guybrush: Add fan support
Add basic fan support. More tuning will be needed.
BUG=b:178217015
TEST=Build
BRANCH=None
Change-Id: I8133bfeb63346a254d0300d99d2b0ade35f74cc6
Signed-off-by: Rob Barnes <robbarnes@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2762804
Reviewed-by: Bhanu Prakash Maiya <bhanumaiya@google.com>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Commit-Queue: Diana Z <dzigterman@chromium.org>
-rw-r--r-- | baseboard/guybrush/baseboard.c | 30 | ||||
-rw-r--r-- | baseboard/guybrush/baseboard.h | 17 |
2 files changed, 46 insertions, 1 deletions
diff --git a/baseboard/guybrush/baseboard.c b/baseboard/guybrush/baseboard.c index ee41591959..f901a29d58 100644 --- a/baseboard/guybrush/baseboard.c +++ b/baseboard/guybrush/baseboard.c @@ -22,6 +22,8 @@ #include "driver/tcpm/nct38xx.h" #include "driver/temp_sensor/sb_tsi.h" #include "driver/usb_mux/amd_fp6.h" +#include "fan.h" +#include "fan_chip.h" #include "gpio.h" #include "hooks.h" #include "i2c.h" @@ -508,6 +510,34 @@ const struct pwm_t pwm_channels[] = { }; BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); +const struct mft_t mft_channels[] = { + [MFT_CH_0] = { + .module = NPCX_MFT_MODULE_1, + .clk_src = TCKC_LFCLK, + .pwm_id = PWM_CH_FAN, + }, +}; +BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT); + +const struct fan_conf fan_conf_0 = { + .flags = FAN_USE_RPM_MODE, + .ch = MFT_CH_0, /* Use MFT id to control fan */ + .pgood_gpio = -1, + .enable_gpio = -1, +}; +const struct fan_rpm fan_rpm_0 = { + .rpm_min = 1800, + .rpm_start = 3000, + .rpm_max = 5200, +}; +const struct fan_t fans[] = { + [FAN_CH_0] = { + .conf = &fan_conf_0, + .rpm = &fan_rpm_0, + }, +}; +BUILD_ASSERT(ARRAY_SIZE(fans) == FAN_CH_COUNT); + /* * USB C0 port SBU mux use standalone FSUSB42UMX * chip and it needs a board specific driver. diff --git a/baseboard/guybrush/baseboard.h b/baseboard/guybrush/baseboard.h index 619a48b351..2529688217 100644 --- a/baseboard/guybrush/baseboard.h +++ b/baseboard/guybrush/baseboard.h @@ -235,7 +235,9 @@ #define GPIO_VOLUME_UP_L GPIO_VOLUP_BTN_ODL #define GPIO_VOLUME_DOWN_L GPIO_VOLDN_BTN_ODL -/* Fan features */ +/* Fan Config */ +#define CONFIG_FANS FAN_CH_COUNT +/* TODO: Set CONFIG_FAN_INIT_SPEED, defaults to 100 */ /* LED Config */ #define CONFIG_PWM @@ -307,6 +309,19 @@ enum pwm_channel { PWM_CH_COUNT }; +/* Fan Channels */ +enum fan_channel { + FAN_CH_0 = 0, + /* Number of FAN channels */ + FAN_CH_COUNT, +}; +enum mft_channel { + MFT_CH_0 = 0, + /* Number of MFT channels */ + MFT_CH_COUNT, +}; + + /* Common definition for the USB PD interrupt handlers. */ void tcpc_alert_event(enum gpio_signal signal); void bc12_interrupt(enum gpio_signal signal); |