From d9b7d25b86f0529ee6ae9d3da02b60ff6903bc6d Mon Sep 17 00:00:00 2001 From: Shawn Nematbakhsh Date: Tue, 4 Oct 2016 16:48:17 -0700 Subject: [PATCH] power: rk3399: Debounce PGOOD_SYS signal PGOOD_SYS may glitch for a period not to exceed 1ms. When PGOOD_SYS or PGOOD_AP are deasserted, wait for up to 100ms for both signals return before transitioning out of S0. BUG=chrome-os-partner:56822 BRANCH=gru TEST=Manual on kevin, boot device and verify it remains in S0 without spurious transitions to S3. Signed-off-by: Shawn Nematbakhsh Change-Id: I95ccae54fc5939c835f00dc9b7cf88b9d0553c11 Reviewed-on: https://chromium-review.googlesource.com/393148 Reviewed-by: David Schneider Reviewed-by: Aseda Aboagye (cherry picked from commit b867d3fc9dea04ac65f5288fb99d3ed65c127644) Reviewed-on: https://chromium-review.googlesource.com/396139 Commit-Ready: Shawn N Tested-by: Shawn N Reviewed-by: Shawn N --- power/rk3399.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/power/rk3399.c b/power/rk3399.c index 3c35b6e3fb..29d5b51051 100644 --- a/power/rk3399.c +++ b/power/rk3399.c @@ -144,9 +144,11 @@ enum power_state power_handle_state(enum power_state state) /* * Wait up to PGOOD_AP_DEBOUNCE_TIMEOUT for IN_PGOOD_AP to - * come back before transitioning back to S3. + * come back before transitioning back to S3. PGOOD_SYS can + * also glitch, with a glitch duration < 1ms, so debounce + * it here as well. */ - if (power_wait_signals_timeout(IN_PGOOD_AP, + if (power_wait_signals_timeout(IN_PGOOD_AP | IN_PGOOD_SYS, PGOOD_AP_DEBOUNCE_TIMEOUT) == EC_ERROR_TIMEOUT) return POWER_S0S3;