summaryrefslogtreecommitdiff
path: root/chip/lm4
diff options
context:
space:
mode:
authorGerrit <chrome-bot@google.com>2012-04-26 10:16:24 -0700
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>2012-04-26 10:16:24 -0700
commit9a59d98b3d1d72604b7c5ac916b494716bd83082 (patch)
tree0dd24943a9777b7ebb1f7c2b1291a008f3a3922c /chip/lm4
parentb4f69c406d0698c9e03d6a76b380bd49ba286455 (diff)
parent7710ed563ab755073609912d5cc227d2e9eb589f (diff)
downloadchrome-ec-9a59d98b3d1d72604b7c5ac916b494716bd83082.tar.gz
Merge "Issue warning on fan stall."
Diffstat (limited to 'chip/lm4')
-rw-r--r--chip/lm4/pwm.c16
1 files changed, 16 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);
}