diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2020-04-01 16:55:01 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-04-08 23:48:40 +0000 |
commit | dc33c3e091aadd13928109936242cf7f81db61f2 (patch) | |
tree | 5e98d96911c42ab3d94c8a2f05dac13f977e7dac | |
parent | 8cc8235b9d6cdbed05f4f94b18fd959c7756754f (diff) | |
download | chrome-ec-dc33c3e091aadd13928109936242cf7f81db61f2.tar.gz |
speed up AP State polling when CCD is active.
It turns out that the Cr50 not shutting off the AP UART quickly enough
causes violation of the JSL power sequence requirements due to the
leakage caused by the active UART lines.
Let's speed up AP state polling when CCD is active. When CCD is not
active the UART is shut of to start with.
BUG=b:152446186
TEST=running the new image verified that that timing constraints are
not violated any more. Also verified reliable UART=>USB bridging
operation.
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Change-Id: Iffb7f8bc33c4516bb7cf5cbf58c5ced277cd1aec
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2139732
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
-rw-r--r-- | board/cr50/ap_uart_state.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/board/cr50/ap_uart_state.c b/board/cr50/ap_uart_state.c index 191ecee95b..54fe92f2f1 100644 --- a/board/cr50/ap_uart_state.c +++ b/board/cr50/ap_uart_state.c @@ -4,11 +4,13 @@ * * AP UART state machine */ +#include "case_closed_debug.h" #include "ccd_config.h" #include "common.h" #include "console.h" #include "gpio.h" #include "hooks.h" +#include "timer.h" #include "uart_bitbang.h" #include "uartn.h" @@ -93,7 +95,7 @@ void ap_detect_asserted(enum gpio_signal signal) /** * Detect state machine */ -static void ap_uart_detect(void) +static void ap_uart_poll(void) { /* Disable interrupts if we had them on for debouncing */ gpio_disable_interrupt(GPIO_DETECT_AP_UART); @@ -130,4 +132,27 @@ static void ap_uart_detect(void) else set_state(DEVICE_STATE_DEBOUNCING); } -DECLARE_HOOK(HOOK_SECOND, ap_uart_detect, HOOK_PRIO_DEFAULT); + +static void ap_uart_detect(void); +DECLARE_DEFERRED(ap_uart_detect); + +static void ap_uart_detect(void) +{ + ap_uart_poll(); + + /* + * Some platforms require that the H1 reacts to the AP shutting down + * within 100 ms. + * + * It takes up to three polls to detect AP shutdown, hence let's limit + * poll interval to 33 ms when CCD is active. + * + * UART is shut off unconditionally when CCD is inactive, no need to + * poll too often in that case, as increased poll frequency causes + * increased power consumption. + */ + hook_call_deferred(&ap_uart_detect_data, ccd_ext_is_enabled() ? + 33 * MSEC : SECOND); +} + +DECLARE_HOOK(HOOK_INIT, ap_uart_detect, HOOK_PRIO_DEFAULT); |