summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@chromium.org>2018-01-16 15:26:35 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2018-02-01 00:48:22 +0000
commit33e163058be2895ed3e8bf402d156385b1820f35 (patch)
treea7f38e62ea7244a2ea587625e68878d608e59763
parent2f46dab434c8c69a308582830237ba0528d9f69b (diff)
downloadchrome-ec-33e163058be2895ed3e8bf402d156385b1820f35.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> (cherry picked from commit 7b5b83055cbf8b4e67e6e63e72dd8f8038f80635) Reviewed-on: https://chromium-review.googlesource.com/896786 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@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);