diff options
-rw-r--r-- | chip/lm4/pwm.c | 16 | ||||
-rw-r--r-- | common/console.c | 1 | ||||
-rw-r--r-- | include/console.h | 1 |
3 files changed, 18 insertions, 0 deletions
diff --git a/chip/lm4/pwm.c b/chip/lm4/pwm.c index e947e0a55f..d5082b54e9 100644 --- a/chip/lm4/pwm.c +++ b/chip/lm4/pwm.c @@ -130,9 +130,25 @@ static void update_lpc_mapped_memory(void) } +static void check_fan_failure(void) +{ + if ((LM4_FAN_FANCTL & (1 << FAN_CH_CPU)) && + ((LM4_FAN_FANSTS >> (2 * FAN_CH_CPU)) & 0x03) == 0) { + /* Fan enabled but stalled. Issues warning. + * As we have thermal shutdown protection, issuing warning + * here should be enough. + */ + lpc_set_host_events( + EC_LPC_HOST_EVENT_MASK(EC_LPC_HOST_EVENT_THERMAL)); + cputs(CC_PWM, "[Fan stalled!]\n"); + } +} + + void pwm_task(void) { while (1) { + check_fan_failure(); update_lpc_mapped_memory(); usleep(1000000); } diff --git a/common/console.c b/common/console.c index 4a94588535..92e99d02b8 100644 --- a/common/console.c +++ b/common/console.c @@ -37,6 +37,7 @@ static const char *channel_names[CC_CHANNEL_COUNT] = { "lpc", "port80", "powerbtn", + "pwm", "system", "task", "usbcharge", diff --git a/include/console.h b/include/console.h index 9b7e3b380a..6c197d55c8 100644 --- a/include/console.h +++ b/include/console.h @@ -36,6 +36,7 @@ enum console_channel { CC_LPC, CC_PORT80, CC_POWERBTN, + CC_PWM, CC_SYSTEM, CC_TASK, CC_USBCHARGE, |