summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@chromium.org>2018-01-16 15:26:35 -0800
committerchrome-bot <chrome-bot@chromium.org>2018-01-17 06:20:39 -0800
commit7b5b83055cbf8b4e67e6e63e72dd8f8038f80635 (patch)
tree846e4b77e52c0eecdd8d63a847face0dd5739821
parente71899a5734b151b79db896b88f00cac14b8e50a (diff)
downloadchrome-ec-7b5b83055cbf8b4e67e6e63e72dd8f8038f80635.tar.gz
cr50:ap_state: reenable detect ap on interrupt
ap_state doesn't disable/enable the detect ap interrupt correctly. This means cr50 is mostly just polling the AP state. Cr50 may not realize the AP is up until almost a second after it first turned on. This change reenables the detect ap on interrupt while debouncing the AP state or if Cr50 thinks the AP is off, so cr50 can more quickly detect the transition from off to on. This issue doesn't affect devices that detect the AP with TPM_RST_L, because we never disable the TPM_RST_L interrupt and that handler calls ap_on_deferred directly. BUG=b:71866206 BRANCH=cr50 TEST=run power_state:rec on Dru and make sure there are no tpm irq timeouts. Change-Id: I67388f9dce94fb22efe5755a0de563e5af42f8f5 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/869410 Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--board/cr50/ap_state.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/board/cr50/ap_state.c b/board/cr50/ap_state.c
index e9ddea5640..5bf764ec7c 100644
--- a/board/cr50/ap_state.c
+++ b/board/cr50/ap_state.c
@@ -181,6 +181,14 @@ static void ap_detect(void)
}
return;
+ } else if (!board_detect_ap_with_tpm_rst()) {
+ /*
+ * If the signal is low, cr50 will enter the debouncing state or
+ * off. Either way, cr50 is waiting for the signal to go high.
+ * Reenable the interrupt, so cr50 can immediately detect it
+ * instead of relying on the 1s polling.
+ */
+ gpio_enable_interrupt(GPIO_DETECT_AP);
}
/* AP wasn't detected. If we're already off, done. */
@@ -204,9 +212,5 @@ static void ap_detect(void)
set_state(DEVICE_STATE_INIT_DEBOUNCING);
else
set_state(DEVICE_STATE_DEBOUNCING);
-
- /* If we're using AP UART RX for detect, enable its interrupt */
- if (!board_detect_ap_with_tpm_rst())
- gpio_enable_interrupt(GPIO_DETECT_AP);
}
DECLARE_HOOK(HOOK_SECOND, ap_detect, HOOK_PRIO_DEFAULT);