diff options
-rw-r--r-- | board/redrix/board.h | 9 | ||||
-rw-r--r-- | board/redrix/fans.c | 66 | ||||
-rw-r--r-- | board/redrix/gpio.inc | 4 | ||||
-rw-r--r-- | board/redrix/pwm.c | 5 |
4 files changed, 36 insertions, 48 deletions
diff --git a/board/redrix/board.h b/board/redrix/board.h index c43c34a662..04bb90ff5f 100644 --- a/board/redrix/board.h +++ b/board/redrix/board.h @@ -174,10 +174,8 @@ #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 */ +/* Fan features */ +#define CONFIG_FANS FAN_CH_COUNT /* Charger defines */ #define CONFIG_CHARGER_BQ25720 @@ -229,16 +227,19 @@ enum battery_type { enum pwm_channel { PWM_CH_KBLIGHT = 0, /* PWM3 */ PWM_CH_FAN, /* PWM5 */ + PWM_CH_FAN2, /* PWM7 */ PWM_CH_COUNT }; enum fan_channel { FAN_CH_0 = 0, + FAN_CH_1, FAN_CH_COUNT }; enum mft_channel { MFT_CH_0 = 0, + MFT_CH_1, MFT_CH_COUNT }; diff --git a/board/redrix/fans.c b/board/redrix/fans.c index d966056331..7d0af30914 100644 --- a/board/redrix/fans.c +++ b/board/redrix/fans.c @@ -20,6 +20,11 @@ const struct mft_t mft_channels[] = { .clk_src = TCKC_LFCLK, .pwm_id = PWM_CH_FAN, }, + [MFT_CH_1] = { + .module = NPCX_MFT_MODULE_2, + .clk_src = TCKC_LFCLK, + .pwm_id = PWM_CH_FAN2, + }, }; BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT); @@ -30,59 +35,34 @@ static const struct fan_conf fan_conf_0 = { .enable_gpio = GPIO_EN_PP5000_FAN, }; -/* - * TOOD(b/180681346): 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_conf fan_conf_1 = { + .flags = FAN_USE_RPM_MODE, + .ch = MFT_CH_1, /* Use MFT id to control fan */ + .pgood_gpio = -1, + .enable_gpio = GPIO_EN_PP5000_FAN2, +}; + +/* TOOD(b/193487913): need to update for real fan */ static const struct fan_rpm fan_rpm_0 = { .rpm_min = 2200, .rpm_start = 2200, .rpm_max = 7200, }; +static const struct fan_rpm fan_rpm_1 = { + .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, }, + [FAN_CH_1] = { + .conf = &fan_conf_1, + .rpm = &fan_rpm_1, + }, }; -#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/redrix/gpio.inc b/board/redrix/gpio.inc index 537ac7a6bb..d01c7994cf 100644 --- a/board/redrix/gpio.inc +++ b/board/redrix/gpio.inc @@ -36,7 +36,7 @@ GPIO_INT(USB_C1_RT_INT_ODL, PIN(4, 1), GPIO_INT_FALLING, retimer_in /* USED GPIOs: */ GPIO(CCD_MODE_ODL, PIN(E, 5), GPIO_INPUT) -GPIO(CHARGER_VAP_OTG_EN, PIN(7, 3), GPIO_OUT_LOW) +GPIO(CHARGER_VAP_OTG_EN, PIN(9, 6), GPIO_OUT_LOW) GPIO(CPU_C10_GATE_L, PIN(6, 7), GPIO_INPUT) GPIO(EC_BATT_PRES_ODL, PIN(A, 3), GPIO_INPUT) GPIO(EC_ENTERING_RW, PIN(0, 3), GPIO_OUT_LOW) @@ -68,6 +68,7 @@ GPIO(EC_PCH_SYS_PWROK, PIN(3, 7), GPIO_OUT_LOW) GPIO(EC_PCH_WAKE_R_ODL, PIN(C, 0), GPIO_ODR_HIGH) GPIO(EC_PROCHOT_ODL, PIN(6, 3), GPIO_ODR_HIGH) GPIO(EN_PP5000_FAN, PIN(6, 1), GPIO_OUT_HIGH) +GPIO(EN_PP5000_FAN2, PIN(5, 0), GPIO_OUT_HIGH) GPIO(EN_PP5000_USBA_R, PIN(D, 7), GPIO_OUT_LOW) GPIO(EN_S5_RAILS, PIN(B, 6), GPIO_OUT_LOW) GPIO(IMVP9_VRRDY_OD, PIN(4, 3), GPIO_INPUT) @@ -99,6 +100,7 @@ ALTERNATE(PIN_MASK(F, 0x0c), 0, MODULE_I2C, 0) /* GPIOF3/I2C4_SCL1 /* PWM alternate functions */ ALTERNATE(PIN_MASK(4, 0x01), 0, MODULE_PWM, 0) /* GPIO40/TA1 */ +ALTERNATE(PIN_MASK(7, 0x08), 0, MODULE_PWM, 0) /* GPIO73/TA2 */ ALTERNATE(PIN_MASK(6, 0x01), 0, MODULE_PWM, 0) /* GPIO60/PWM7 */ ALTERNATE(PIN_MASK(8, 0x01), 0, MODULE_PWM, 0) /* GPIO80/PWM3 */ ALTERNATE(PIN_MASK(B, 0x80), 0, MODULE_PWM, 0) /* GPIOB7/PWM5 */ diff --git a/board/redrix/pwm.c b/board/redrix/pwm.c index 985305449b..d1e1003faf 100644 --- a/board/redrix/pwm.c +++ b/board/redrix/pwm.c @@ -27,6 +27,11 @@ const struct pwm_t pwm_channels[] = { .flags = PWM_CONFIG_OPEN_DRAIN, .freq = 25000 }, + [PWM_CH_FAN2] = { + .channel = 7, + .flags = PWM_CONFIG_OPEN_DRAIN, + .freq = 25000 + }, }; BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); |