From 1dc0c0446eca2caf95765081c3add878ac7be532 Mon Sep 17 00:00:00 2001 From: Wai-Hong Tam Date: Mon, 10 May 2021 11:05:31 -0700 Subject: Coachz: When the base state changes, update the virtual switch When the base state changes, update the virtual switch. It sends a mode change event to notify AP and then AP will query the latest virtual switch of the base state. BRANCH=None BUG=b:174295396 TEST=Checked detaching and attaching the base. Detach the base: > [269.820490 BASE_DET = 2813 (pulse 0)] [269.821044 tablet mode enabled] [269.821486 event set 0x0000000010000000] [269.821974 base state: detached] Attach the base: > [273.714608 BASE_DET = 156 (pulse 0)] [273.715151 tablet mode disabled] [273.715598 event set 0x0000000010000000] [273.716907 base state: attached] [273.717754 event set 0x0000000010000000] Change-Id: I2f0cac61ee359083df300f4fe3f3d16a14dfb926 Signed-off-by: Wai-Hong Tam Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2884609 Reviewed-by: Matthias Kaehlcke --- board/coachz/base_detect.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'board/coachz/base_detect.c') diff --git a/board/coachz/base_detect.c b/board/coachz/base_detect.c index e7e06fe410..505714a016 100644 --- a/board/coachz/base_detect.c +++ b/board/coachz/base_detect.c @@ -8,6 +8,7 @@ #include "adc.h" #include "adc_chip.h" #include "board.h" +#include "base_state.h" #include "chipset.h" #include "common.h" #include "console.h" @@ -81,9 +82,9 @@ static void base_detect_change(enum base_status status) if (current_base_status == status) return; - CPRINTS("Base %sconnected", connected ? "" : "not "); gpio_set_level(GPIO_EN_BASE, connected); tablet_set_mode(!connected); + base_set_state(connected); current_base_status = status; } -- cgit v1.2.1