diff options
author | Wai-Hong Tam <waihong@google.com> | 2021-02-10 13:29:29 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-02-19 01:42:43 +0000 |
commit | 6c6754b482e526bfc3b4be3c009b06e07116edde (patch) | |
tree | 9c28220167d10edfe0d1a918e4fc18ebc1b95311 | |
parent | dfc6e111e897e66d92b11bcb267661b1c2a79651 (diff) | |
download | chrome-ec-6c6754b482e526bfc3b4be3c009b06e07116edde.tar.gz |
Coachz: Fix issue of resetting AP not initialize the states correctly
base_detect_change() and tablet_set_mode() skip doing anything if the
state has no change.
Originally, the S3->S5 hook sets the state to DISCONNECTED. The next
startup S5->S3 may not initialize the state correctly if no change,
e.g. the case: attach keyboard -> power-off -> detach keyboard ->
power-on. It won't set the tablet mode and won't notify AP.
We should set the state to UNKNOWN in the S3->S5 hook. The next startup
will set the states correctly and notify AP.
BRANCH=Trogdor
BUG=b:179930342
TEST=Plug keyboard, power-off AP, unplug keyboard, power-on AP, plug
keyboard, and checked the EC log that proper states are set and events
are sent to AP.
Change-Id: Ie6111f2ebbbde7ec6a9de2045a463d769ee6fb2b
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2685409
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
-rw-r--r-- | board/coachz/base_detect.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/board/coachz/base_detect.c b/board/coachz/base_detect.c index 6295ccb39d..e7e06fe410 100644 --- a/board/coachz/base_detect.c +++ b/board/coachz/base_detect.c @@ -192,9 +192,13 @@ DECLARE_HOOK(HOOK_CHIPSET_STARTUP, base_enable, HOOK_PRIO_DEFAULT); static void base_disable(void) { - /* Disable base detection interrupt and disable power to base. */ + /* + * Disable base detection interrupt and disable power to base. + * Set the state UNKNOWN so the next startup will initialize a + * correct state and notify AP. + */ gpio_disable_interrupt(GPIO_BASE_DET_L); - base_detect_change(BASE_DISCONNECTED); + base_detect_change(BASE_UNKNOWN); } DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, base_disable, HOOK_PRIO_DEFAULT); |