summaryrefslogtreecommitdiff
path: root/board/poppy
diff options
context:
space:
mode:
authorWai-Hong Tam <waihong@google.com>2021-07-21 15:11:59 -0700
committerCommit Bot <commit-bot@chromium.org>2021-07-23 22:14:04 +0000
commite8f6467d65f086a16ec33cb3cfd724086595d2f1 (patch)
treee633d245112862427696f51e11d35a90a17e0442 /board/poppy
parent6521a7aa8d69c494e98667d1ff05ec2c2d784287 (diff)
downloadchrome-ec-e8f6467d65f086a16ec33cb3cfd724086595d2f1.tar.gz
tablet_mode: Fix the race condition of setting the tablet mode
There are 2 tablet mode triggers: * Lid: when the lid angle close to 360 degree, either detected by a GMR sensor or by the angle computed by 2 motion sensors. * Base: when the detachable base is detached. These 2 triggers set the tablet mode status, which as a boolean, resulting a race condition. This CL fixes the race condition. Each trigger updates its own bit. The final tablet mode status is the OR of all bits. BRANCH=Trogdor BUG=b:193873098 TEST=Attached the base, checked tablet_mode enabled; detached the base, checked tablet_mode disabled; flip base to 360 degree, checked tablet_mode disabled; move the base out of the lid, checked tablet_mode disabled. Change-Id: Ia9d9d2d66c194796c1039cc8b746c8d1f28a4496 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3044414 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'board/poppy')
-rw-r--r--board/poppy/base_detect_lux.c2
-rw-r--r--board/poppy/base_detect_poppy.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/board/poppy/base_detect_lux.c b/board/poppy/base_detect_lux.c
index 14a937a7fd..37ed3304fe 100644
--- a/board/poppy/base_detect_lux.c
+++ b/board/poppy/base_detect_lux.c
@@ -128,7 +128,7 @@ static void base_detect_change(enum base_status status)
*/
task_wake(TASK_ID_CHARGER);
- tablet_set_mode(!connected);
+ tablet_set_mode(!connected, TABLET_TRIGGER_BASE);
}
static void print_base_detect_value(const char *str, int v)
diff --git a/board/poppy/base_detect_poppy.c b/board/poppy/base_detect_poppy.c
index 8a202a21d9..9638894cb8 100644
--- a/board/poppy/base_detect_poppy.c
+++ b/board/poppy/base_detect_poppy.c
@@ -95,7 +95,7 @@ static void base_detect_change(enum base_status status)
CPRINTS("Base %sconnected", connected ? "" : "not ");
gpio_set_level(GPIO_PP3300_DX_BASE, connected);
- tablet_set_mode(!connected);
+ tablet_set_mode(!connected, TABLET_TRIGGER_BASE);
current_base_status = status;
if (connected)