mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-03 21:49:32 +00:00
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>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user