summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormartin yan <martin.yan@microchip.corp-partner.google.com>2022-03-23 17:30:53 -0400
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-03-29 14:07:44 +0000
commitd95c77fa79bfc688b076b336516fcb0e96e33ac8 (patch)
tree6fb41e94167563d370237862ee1238afd7154b45
parent5fd9a0feb416699b61169ebabb339b1b34d8895c (diff)
downloadchrome-ec-d95c77fa79bfc688b076b336516fcb0e96e33ac8.tar.gz
zephyr: mchp: Add shim kscan
Add shim layer kscan code BUG=none BRANCH=main TEST=zmake testall Signed-off-by: martin yan <martin.yan@microchip.corp-partner.google.com> Change-Id: I2b319e0ed90b9f65961c31a6ab2ccc7525dd6040 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3546984 Reviewed-by: Wai-Hong Tam <waihong@google.com>
-rw-r--r--zephyr/shim/chip/mchp/keyboard_raw.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/zephyr/shim/chip/mchp/keyboard_raw.c b/zephyr/shim/chip/mchp/keyboard_raw.c
new file mode 100644
index 0000000000..462a18e5f3
--- /dev/null
+++ b/zephyr/shim/chip/mchp/keyboard_raw.c
@@ -0,0 +1,24 @@
+/* Copyright 2022 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.
+ */
+
+/* Functions needed by keyboard scanner module for Chrome EC */
+
+#include <device.h>
+#include <logging/log.h>
+#include <soc.h>
+#include <zephyr.h>
+
+#include "drivers/cros_kb_raw.h"
+#include "keyboard_raw.h"
+
+/**
+ * Return true if the current value of the given input GPIO port is zero
+ */
+int keyboard_raw_is_input_low(int port, int id)
+{
+ const struct device *io_dev = mchp_xec_get_gpio_dev(port);
+
+ return gpio_pin_get_raw(io_dev, id) == 0;
+}