diff options
author | Caveh Jalali <caveh@chromium.org> | 2021-02-08 19:50:24 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-02-09 19:35:12 +0000 |
commit | 4180c1e745c35d1376820f41b4991c3366670d1c (patch) | |
tree | c4b3c6e47ce5103fd83a9d1898aa079108935831 /board | |
parent | 329e1e6bec2ecf96f3c24093f60361634951cb0d (diff) | |
download | chrome-ec-4180c1e745c35d1376820f41b4991c3366670d1c.tar.gz |
byra: Configure fan support
This sets up the configuration for the system fan.
BRANCH=none
BUG=b:173575131
TEST=buildall passes
Change-Id: I5e1d93fe55b2c5b0da1880df5500861cd6cc1494
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2683921
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Commit-Queue: Furquan Shaikh <furquan@chromium.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/brya/board.h | 12 | ||||
-rw-r--r-- | board/brya/build.mk | 1 | ||||
-rw-r--r-- | board/brya/fans.c | 50 |
3 files changed, 63 insertions, 0 deletions
diff --git a/board/brya/board.h b/board/brya/board.h index f483c028a3..07790e0ce3 100644 --- a/board/brya/board.h +++ b/board/brya/board.h @@ -26,6 +26,8 @@ #define GPIO_LID_OPEN GPIO_LID_OPEN_OD #define GPIO_WP_L GPIO_EC_WP_ODL +#define CONFIG_FANS FAN_CH_COUNT + /* System has back-lit keyboard */ #define CONFIG_PWM_KBLIGHT @@ -81,6 +83,16 @@ enum pwm_channel { PWM_CH_COUNT }; +enum fan_channel { + FAN_CH_0 = 0, + FAN_CH_COUNT +}; + +enum mft_channel { + MFT_CH_0 = 0, + MFT_CH_COUNT +}; + /* * remove when we enable CONFIG_POWER_BUTTON */ diff --git a/board/brya/build.mk b/board/brya/build.mk index 9fd9c6baae..ce658b6e2f 100644 --- a/board/brya/build.mk +++ b/board/brya/build.mk @@ -14,6 +14,7 @@ BASEBOARD:=brya board-y= board-y+=battery.o board-y+=board.o +board-y+=fans.o board-y+=i2c.o board-y+=pwm.o board-y+=usbc_config.o diff --git a/board/brya/fans.c b/board/brya/fans.c new file mode 100644 index 0000000000..f8506c2b1e --- /dev/null +++ b/board/brya/fans.c @@ -0,0 +1,50 @@ +/* Copyright 2021 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* Physical fans. These are logically separate from pwm_channels. */ + +#include "common.h" + +#include "fan.h" +#include "fan_chip.h" + +/* MFT channels. These are logically separate from pwm_channels. */ +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); + +static 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 = GPIO_EN_PP5000_FAN, +}; + +/* + * TOOD(caveh): this is from volteer, need to update for brya + * + * Fan specs from datasheet: + * Max speed 5900 rpm (+/- 7%), minimum duty cycle 30%. + * Minimum speed not specified by RPM. Set minimum RPM to max speed (with + * margin) x 30%. + * 5900 x 1.07 x 0.30 = 1894, round up to 1900 + */ +static const struct fan_rpm fan_rpm_0 = { + .rpm_min = 1900, + .rpm_start = 1900, + .rpm_max = 5900, +}; + +const struct fan_t fans[FAN_CH_COUNT] = { + [FAN_CH_0] = { + .conf = &fan_conf_0, + .rpm = &fan_rpm_0, + }, +}; |