summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
Diffstat (limited to 'board')
-rw-r--r--board/brya/board.h7
-rw-r--r--board/brya/fans.c45
-rw-r--r--board/brya/pwm.c3
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);