diff --git a/board/samus/board.c b/board/samus/board.c index 9d2feb93a8..08dae68780 100644 --- a/board/samus/board.c +++ b/board/samus/board.c @@ -105,16 +105,16 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); /* Physical fans. These are logically separate from pwm_channels. */ const struct fan_t fans[] = { - {.flags = FAN_USE_RPM_MODE, - .rpm_min = 1000, - .rpm_max = 6500, + {.flags = FAN_USE_RPM_MODE | FAN_USE_FAST_START, + .rpm_min = 2286, + .rpm_max = 6350, .ch = 2, .pgood_gpio = -1, .enable_gpio = -1, }, - {.flags = FAN_USE_RPM_MODE, - .rpm_min = 1000, - .rpm_max = 6500, + {.flags = FAN_USE_RPM_MODE | FAN_USE_FAST_START, + .rpm_min = 2286, + .rpm_max = 6350, .ch = 3, .pgood_gpio = -1, .enable_gpio = -1, diff --git a/chip/lm4/fan.c b/chip/lm4/fan.c index 8ec25bc1f8..1180d51906 100644 --- a/chip/lm4/fan.c +++ b/chip/lm4/fan.c @@ -132,7 +132,9 @@ int fan_is_stalled(int ch) void fan_channel_setup(int ch, unsigned int flags) { - if (flags & FAN_USE_RPM_MODE) { + uint32_t init; + + if (flags & FAN_USE_RPM_MODE) /* * Configure automatic/feedback mode: * 0x8000 = bit 15 = auto-restart @@ -146,8 +148,8 @@ void fan_channel_setup(int ch, unsigned int flags) * (see note at top of file) * 0x0000 = bit 0 = automatic control */ - LM4_FAN_FANCH(ch) = 0x802c; - } else { + init = 0x802c; + else /* * Configure drive-only mode: * 0x0000 = bit 15 = no auto-restart @@ -159,8 +161,17 @@ void fan_channel_setup(int ch, unsigned int flags) * 0x0000 = bits 3:2 = 1 pulses per revolution * 0x0001 = bit 0 = manual control */ - LM4_FAN_FANCH(ch) = 0x0001; - } + init = 0x0001; + + if (flags & FAN_USE_FAST_START) + /* + * Configure fast-start mode + * 0x0000 = bits 10:8 = start period (2<<0) edges + * 0x0040 = bits 7:6 = fast start at 50% duty + */ + init |= 0x0040; + + LM4_FAN_FANCH(ch) = init; } static void fan_init(void) diff --git a/include/fan.h b/include/fan.h index 0813535592..a8352987d8 100644 --- a/include/fan.h +++ b/include/fan.h @@ -21,8 +21,11 @@ struct fan_t { int enable_gpio; }; -/* Values for the flags field */ -#define FAN_USE_RPM_MODE (1 << 0) +/* Values for .flags field */ +/* Enable automatic RPM control using tach input */ +#define FAN_USE_RPM_MODE (1 << 0) +/* Require a higher duty cycle to start up than to keep running */ +#define FAN_USE_FAST_START (1 << 1) /* The list of fans is instantiated in board.c. */ extern const struct fan_t fans[]; @@ -82,9 +85,6 @@ enum fan_status { }; enum fan_status fan_get_status(int ch); -/* Flag to enable automatic RPM control using tach input */ -#define FAN_USE_RPM_MODE (1 << 0) - /* Initialize the HW according to the desired flags */ void fan_channel_setup(int ch, unsigned int flags);