summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTing Shen <phoenixshen@google.com>2023-03-10 16:27:07 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-03-14 09:29:13 +0000
commitccddaa03e8e2e9654de30eee8a87db5c98c9f61e (patch)
tree1cd7f1bc70a00f925580677326e7f8de29f9cfe6
parent161345edccfa114304de55ca9411cfd35dac2201 (diff)
downloadchrome-ec-ccddaa03e8e2e9654de30eee8a87db5c98c9f61e.tar.gz
geralt: add an empty base state implementation
Set base detached by default. This is a quick fix to turn on virtual keyboard to unblock developers. BUG=b:272439221 TEST=`ectool mkbpget switches` BRANCH=none Change-Id: I0ff0350982d5633d6a680bc170f3dc2948a56488 Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4327719 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
-rw-r--r--zephyr/program/geralt/CMakeLists.txt3
-rw-r--r--zephyr/program/geralt/program.conf4
-rw-r--r--zephyr/program/geralt/src/base_detect.c31
3 files changed, 38 insertions, 0 deletions
diff --git a/zephyr/program/geralt/CMakeLists.txt b/zephyr/program/geralt/CMakeLists.txt
index 8742168a99..fff33c7108 100644
--- a/zephyr/program/geralt/CMakeLists.txt
+++ b/zephyr/program/geralt/CMakeLists.txt
@@ -23,6 +23,9 @@ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC
"src/usbc_config.c"
"src/usb_pd_policy.c"
)
+zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_DETACHABLE_BASE
+ "src/base_detect.c"
+)
if(DEFINED CONFIG_BOARD_GERALT)
project(geralt)
diff --git a/zephyr/program/geralt/program.conf b/zephyr/program/geralt/program.conf
index da73097d79..cb1c1f2435 100644
--- a/zephyr/program/geralt/program.conf
+++ b/zephyr/program/geralt/program.conf
@@ -161,3 +161,7 @@ CONFIG_PLATFORM_EC_CONFIG_USB_PD_3A_PORTS=0
# ADC
CONFIG_ADC_IT8XXX2_VOL_FULL_SCALE=y
+
+# Detachable
+CONFIG_PLATFORM_EC_DETACHABLE_BASE=y
+CONFIG_PLATFORM_EC_BASE_ATTACHED_SWITCH=y
diff --git a/zephyr/program/geralt/src/base_detect.c b/zephyr/program/geralt/src/base_detect.c
new file mode 100644
index 0000000000..b3f078486d
--- /dev/null
+++ b/zephyr/program/geralt/src/base_detect.c
@@ -0,0 +1,31 @@
+/* Copyright 2023 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "base_state.h"
+#include "tablet_mode.h"
+
+#include <zephyr/init.h>
+
+static void base_update(bool attached)
+{
+ base_set_state(attached);
+ tablet_set_mode(!attached, TABLET_TRIGGER_BASE);
+}
+
+static int base_init(const struct device *unused)
+{
+ /* TODO: this is a temporary fix to force tablet mode for developers. */
+ base_update(false);
+
+ return 0;
+}
+
+SYS_INIT(base_init, APPLICATION, 1);
+
+void base_force_state(enum ec_set_base_state_cmd state)
+{
+ /* TODO: not implemented yet */
+ base_update(state == EC_SET_BASE_STATE_ATTACH);
+}