diff options
author | Alexandru M Stan <amstan@chromium.org> | 2015-01-29 16:11:26 -0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-02-10 23:07:14 +0000 |
commit | 6136b1fb09d44410dc8a591abf51d16e5eca3966 (patch) | |
tree | fc40cc1af54f6f61fb196742531b7a4aa456aeb8 /include/power_button.h | |
parent | 41ee615c0b08e43dc382bc15600f814ac02abf06 (diff) | |
download | chrome-ec-6136b1fb09d44410dc8a591abf51d16e5eca3966.tar.gz |
Power Button: Wait for power button to be stable when waiting for release
The debounce timer might be too slow to actually update the state of
debounced_power_pressed by the time we do power_button_is_pressed in the S3->S5
state transition. Solution is to move the power_button_wait_for_release function
here and make sure there are no deferreds active.
BUG=chrome-os-partner:35948
TEST=During dev mode screen, press power button, note the device stays off
TEST=Print debounced_power_pressed in power_button_is_pressed(void), note it's
not 0 when power button is actually pressed
BRANCH=veyron
Change-Id: I8258e9e5524bd65d6ea9c77ea5649304d2195bf0
Signed-off-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/244590
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'include/power_button.h')
-rw-r--r-- | include/power_button.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/power_button.h b/include/power_button.h index ce9f63e216..a7ec4612ad 100644 --- a/include/power_button.h +++ b/include/power_button.h @@ -18,6 +18,15 @@ int power_button_is_pressed(void); /** + * Wait for the power button to be released + * + * @param timeout_us Timeout in microseconds, or -1 to wait forever + * @return EC_SUCCESS if ok, or + * EC_ERROR_TIMEOUT if power button failed to release + */ +int power_button_wait_for_release(unsigned int timeout_us); + +/** * Return non-zero if power button signal asserted at hardware input. * */ |