summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuval Peress <peress@chromium.org>2021-04-21 01:20:04 -0600
committerCommit Bot <commit-bot@chromium.org>2021-04-22 16:55:40 +0000
commit0e27d63424b5a2c6d5d16c932cb421b25b38dbe9 (patch)
treeb378e732f2dc242525e014a468132bbec1406cfc
parentfa949557a52aa54d0389e3307a2fb2eedfb38c50 (diff)
downloadchrome-ec-0e27d63424b5a2c6d5d16c932cb421b25b38dbe9.tar.gz
zephyr: lazor: add board specific lid angle implementation
Add implementation for the board specific lid_angle_peripheral_enable function (taken from board/lazor/board.c). BRANCH=none BUG=b:185966444 TEST=zmake testall Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I9067eeb8fb7b156e6fa690b007d777cd5e760d8d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2842711 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
-rw-r--r--zephyr/projects/trogdor/lazor/CMakeLists.txt4
-rw-r--r--zephyr/projects/trogdor/lazor/src/sensors.c29
2 files changed, 33 insertions, 0 deletions
diff --git a/zephyr/projects/trogdor/lazor/CMakeLists.txt b/zephyr/projects/trogdor/lazor/CMakeLists.txt
index 33ab73b074..3c8409e2ed 100644
--- a/zephyr/projects/trogdor/lazor/CMakeLists.txt
+++ b/zephyr/projects/trogdor/lazor/CMakeLists.txt
@@ -28,3 +28,7 @@ zephyr_library_sources(
"${PLATFORM_EC_BOARD}/sku.c"
"${PLATFORM_EC_BOARD}/switchcap.c"
"${PLATFORM_EC_BOARD}/usbc_config.c")
+
+# Board specific sensor implementation
+zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_MOTIONSENSE
+ "src/sensors.c")
diff --git a/zephyr/projects/trogdor/lazor/src/sensors.c b/zephyr/projects/trogdor/lazor/src/sensors.c
new file mode 100644
index 0000000000..becf1f8829
--- /dev/null
+++ b/zephyr/projects/trogdor/lazor/src/sensors.c
@@ -0,0 +1,29 @@
+/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "chipset.h"
+#include "common.h"
+#include "keyboard_scan.h"
+
+/* Lazor board specific sensor implementation */
+
+#ifdef CONFIG_LID_ANGLE_UPDATE
+void lid_angle_peripheral_enable(int enable)
+{
+ int chipset_in_s0 = chipset_in_state(CHIPSET_STATE_ON);
+
+ if (enable) {
+ keyboard_scan_enable(1, KB_SCAN_DISABLE_LID_ANGLE);
+ } else {
+ /*
+ * Ensure that the chipset is off before disabling the keyboard.
+ * When the chipset is on, the EC keeps the keyboard enabled and
+ * the AP decides whether to ignore input devices or not.
+ */
+ if (!chipset_in_s0)
+ keyboard_scan_enable(0, KB_SCAN_DISABLE_LID_ANGLE);
+ }
+}
+#endif