summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Huang <david.huang@quanta.corp-partner.google.com>2022-01-03 16:00:21 +0800
committerCommit Bot <commit-bot@chromium.org>2022-01-04 03:53:11 +0000
commitfb0455768a04653f2d2b66c270c3cc67a2d299f5 (patch)
treeaa927478e51520831e753b6feadacff3b66bc7a0
parent7cbe6a1accdd09c7823ddd3b7bce5b0dab53ecc5 (diff)
downloadchrome-ec-stabilize-14438.B-main.tar.gz
brask: Add fan controlstabilize-14438.B-main
Add fan control function. BUG=b:197478860 BRANCH=main TEST=make buildall -j success. Signed-off-by: David Huang <david.huang@quanta.corp-partner.google.com> Change-Id: Ib39e346849dcbec51913ed6666e7e1c1f4af8005 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3364064 Reviewed-by: Zhuohao Lee <zhuohao@chromium.org> Commit-Queue: Zhuohao Lee <zhuohao@chromium.org>
-rw-r--r--board/brask/board.h2
-rw-r--r--board/brask/build.mk1
-rw-r--r--board/brask/fans.c50
3 files changed, 52 insertions, 1 deletions
diff --git a/board/brask/board.h b/board/brask/board.h
index aaed745a59..feb5a84ff7 100644
--- a/board/brask/board.h
+++ b/board/brask/board.h
@@ -139,7 +139,7 @@
* TODO(b/197478860): Enable the fan control. We need
* to check the sensor value and adjust the fan speed.
*/
-/* #define CONFIG_FANS FAN_CH_COUNT */
+ #define CONFIG_FANS FAN_CH_COUNT
/* Include math_util for bitmask_uint64 used in pd_timers */
#define CONFIG_MATH_UTIL
diff --git a/board/brask/build.mk b/board/brask/build.mk
index 442a708d78..81ecfa4164 100644
--- a/board/brask/build.mk
+++ b/board/brask/build.mk
@@ -13,6 +13,7 @@ BASEBOARD:=brask
board-y=
board-y+=board.o
+board-y+=fans.o
board-y+=i2c.o
board-y+=led.o
board-y+=pwm.o
diff --git a/board/brask/fans.c b/board/brask/fans.c
new file mode 100644
index 0000000000..f2a70636d0
--- /dev/null
+++ b/board/brask/fans.c
@@ -0,0 +1,50 @@
+/* Copyright 2022 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 "compile_time_macros.h"
+#include "console.h"
+#include "fan_chip.h"
+#include "fan.h"
+#include "hooks.h"
+#include "pwm.h"
+
+/* MFT channels. These are logically separate from pwm_channels. */
+const struct mft_t mft_channels[] = {
+ [MFT_CH_0] = {
+ .module = NPCX_MFT_MODULE_2,
+ .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(b/197478860): need to update for real fan
+ *
+ * Prototype fan spins at about 7200 RPM at 100% PWM.
+ * Set minimum at around 30% PWM.
+ */
+static const struct fan_rpm fan_rpm_0 = {
+ .rpm_min = 2200,
+ .rpm_start = 2200,
+ .rpm_max = 7200,
+};
+
+const struct fan_t fans[FAN_CH_COUNT] = {
+ [FAN_CH_0] = {
+ .conf = &fan_conf_0,
+ .rpm = &fan_rpm_0,
+ },
+};