summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYongBeum.Ha <ybha@samsung.corp-partner.google.com>2020-03-10 14:29:11 +0900
committerCommit Bot <commit-bot@chromium.org>2020-04-01 02:10:00 +0000
commit35474c0873bed490042d58d28d68b8e37125500e (patch)
tree822c084aa1ede66c3cb9485751414318fb3523d3
parent1168b935921047e16761cad9596780c530044013 (diff)
downloadchrome-ec-35474c0873bed490042d58d28d68b8e37125500e.tar.gz
nightfury: Enable fan
nigthfury has a fan BUG=b:149226871 BRANCH=firmware-hatch-12672.B TEST=make -j BOARD=nightfury Signed-off-by: YongBeum.Ha <ybha@samsung.corp-partner.google.com> Change-Id: Ic71a0e50aee9750c1c4e535de4176a8bfcc18ab1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2094860 Reviewed-by: Bob Moragues <moragues@chromium.org> Reviewed-by: Scott Collyer <scollyer@chromium.org> Tested-by: Bob Moragues <moragues@chromium.org> Commit-Queue: Bob Moragues <moragues@chromium.org>
-rw-r--r--board/nightfury/board.c41
-rw-r--r--board/nightfury/board.h18
-rw-r--r--board/nightfury/gpio.inc2
3 files changed, 59 insertions, 2 deletions
diff --git a/board/nightfury/board.c b/board/nightfury/board.c
index 2f67f28974..c896d16c8b 100644
--- a/board/nightfury/board.c
+++ b/board/nightfury/board.c
@@ -21,6 +21,8 @@
#include "driver/tcpm/tcpci.h"
#include "ec_commands.h"
#include "extpower.h"
+#include "fan.h"
+#include "fan_chip.h"
#include "gpio.h"
#include "hooks.h"
#include "host_command.h"
@@ -106,7 +108,16 @@ const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/******************************************************************************/
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
- [PWM_CH_KBLIGHT] = { .channel = 3, .flags = 0, .freq = 10000 },
+ [PWM_CH_KBLIGHT] = {
+ .channel = 3,
+ .flags = 0,
+ .freq = 10000
+ },
+ [PWM_CH_FAN] = {
+ .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000
+ },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
@@ -293,6 +304,34 @@ const struct motion_sensor_t *motion_als_sensors[] = {
};
BUILD_ASSERT(ARRAY_SIZE(motion_als_sensors) == ALS_COUNT);
+/******************************************************************************/
+/* Physical fans. These are logically separate from pwm_channels. */
+
+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,
+};
+
+/* Default */
+const struct fan_rpm fan_rpm_0 = {
+ .rpm_min = 3100,
+ .rpm_start = 3100,
+ .rpm_max = 6900,
+};
+
+const struct fan_t fans[FAN_CH_COUNT] = {
+ [FAN_CH_0] = { .conf = &fan_conf_0, .rpm = &fan_rpm_0, },
+};
+
+/******************************************************************************/
+/* MFT channels. These are logically separate from pwm_channels. */
+const struct mft_t mft_channels[] = {
+ [MFT_CH_0] = {NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN},
+};
+BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
+
/**********************************************************************/
/* ADC channels */
const struct adc_t adc_channels[] = {
diff --git a/board/nightfury/board.h b/board/nightfury/board.h
index e0e0cd8d56..5f27fa632a 100644
--- a/board/nightfury/board.h
+++ b/board/nightfury/board.h
@@ -124,6 +124,11 @@
#define CONFIG_THROTTLE_AP
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
+/* Fan features */
+#define CONFIG_FANS 1
+#undef CONFIG_FAN_INIT_SPEED
+#define CONFIG_FAN_INIT_SPEED 50
+
/*
* Macros for GPIO signals used in common code that don't match the
* schematic names. Signal names in gpio.inc match the schematic and are
@@ -166,9 +171,22 @@ enum sensor_id {
enum pwm_channel {
PWM_CH_KBLIGHT,
+ PWM_CH_FAN,
PWM_CH_COUNT
};
+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,
+};
+
enum temp_sensor_id {
TEMP_SENSOR_1,
TEMP_SENSOR_2,
diff --git a/board/nightfury/gpio.inc b/board/nightfury/gpio.inc
index 4c4b4e9c76..29dbd6f72a 100644
--- a/board/nightfury/gpio.inc
+++ b/board/nightfury/gpio.inc
@@ -85,6 +85,7 @@ GPIO(LED_2_L, PIN(C, 3), GPIO_OUT_HIGH) /* White (hatch)
GPIO(LED_3_L, PIN(C, 2), GPIO_OUT_HIGH)
GPIO(EC_KB_BL_EN, PIN(8, 6), GPIO_OUT_LOW) /* Keyboard backlight */
GPIO(EDP_BKLTEN_OD, PIN(D, 3), GPIO_ODR_HIGH) /* Display backlight */
+GPIO(EN_PP5000_FAN, PIN(6, 1), GPIO_OUT_LOW)
GPIO(LID_ACCEL_INT_L, PIN(5, 0), GPIO_INPUT | /* Lid accelerometer */
GPIO_SEL_1P8V)
@@ -122,7 +123,6 @@ GPIO(TP58, PIN(0, 4), GPIO_INPUT | GPIO_PULL_UP)
GPIO(TP73, PIN(8, 2), GPIO_INPUT | GPIO_PULL_UP)
GPIO(TP18, PIN(C, 0), GPIO_INPUT | GPIO_PULL_UP)
GPIO(TP54, PIN(4, 0), GPIO_INPUT | GPIO_PULL_UP)
-GPIO(TP56, PIN(6, 1), GPIO_INPUT | GPIO_PULL_UP)
GPIO(TP57, PIN(8, 1), GPIO_INPUT | GPIO_PULL_UP)
GPIO(TP55, PIN(7, 3), GPIO_INPUT | GPIO_PULL_UP)
GPIO(TP59, PIN(B, 0), GPIO_INPUT | GPIO_PULL_UP)