diff options
Diffstat (limited to 'chip/npcx/fan.c')
-rw-r--r-- | chip/npcx/fan.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/chip/npcx/fan.c b/chip/npcx/fan.c index 07e4312d9a..9836ff60bd 100644 --- a/chip/npcx/fan.c +++ b/chip/npcx/fan.c @@ -19,6 +19,7 @@ #include "timer.h" #include "task.h" #include "hooks.h" +#include "system.h" #include "math_util.h" #if !(DEBUG_FAN) @@ -324,11 +325,19 @@ void fan_set_duty(int ch, int percent) { int pwm_id = mft_channels[ch].pwm_id; - if (!percent) + /* duty is zero */ + if (!percent) { fan_status[ch].auto_status = FAN_STATUS_STOPPED; + enable_sleep(SLEEP_MASK_FAN); + } else + disable_sleep(SLEEP_MASK_FAN); + /* Set the duty cycle of PWM */ pwm_set_duty(pwm_id, percent); } +/* ensure that only one fan used since ec enables sleep bit if duty is zero */ +BUILD_ASSERT(CONFIG_FANS <= 1); + /** * Get fan duty cycle. |