summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWai-Hong Tam <waihong@google.com>2021-05-10 11:05:31 -0700
committerCommit Bot <commit-bot@chromium.org>2021-05-10 20:12:26 +0000
commit1dc0c0446eca2caf95765081c3add878ac7be532 (patch)
tree1950043d5a29abcb54a39e3c59a5e555f71d2f55
parent5dcd28da187fd3a2a92d97443e27cb393cacfcd2 (diff)
downloadchrome-ec-1dc0c0446eca2caf95765081c3add878ac7be532.tar.gz
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 <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2884609 Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
-rw-r--r--board/coachz/base_detect.c3
-rw-r--r--board/coachz/board.h1
2 files changed, 3 insertions, 1 deletions
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;
}
diff --git a/board/coachz/board.h b/board/coachz/board.h
index f645636214..f60ce352d9 100644
--- a/board/coachz/board.h
+++ b/board/coachz/board.h
@@ -52,6 +52,7 @@
#define CONFIG_FRONT_PROXIMITY_SWITCH
#define CONFIG_DETACHABLE_BASE
+#define CONFIG_BASE_ATTACHED_SWITCH
/* GPIO alias */
#define GPIO_AC_PRESENT GPIO_CHG_ACOK_OD