summaryrefslogtreecommitdiff
path: root/zephyr
diff options
context:
space:
mode:
authorDenis Brockus <dbrockus@google.com>2021-06-29 14:54:30 -0600
committerCommit Bot <commit-bot@chromium.org>2021-06-30 16:20:10 +0000
commit4ad61b84dad947788f350b575de0fa5c52ed1428 (patch)
tree69191fdfb1ed5d6783acfb1668760ae035f69445 /zephyr
parent9ff5d3c2286c7d9c1c1219f5cc51546998847861 (diff)
downloadchrome-ec-4ad61b84dad947788f350b575de0fa5c52ed1428.tar.gz
zephyr: asurada: add board_allow_i2c_passthru
BUG=b:189855648 BRANCH=none TEST=zmake configure -b $PROJ_HAYATO Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I9146fe2d7aee9d7320ea012c744efe4a275eb81b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2994750 Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Yuval Peress <peress@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org>
Diffstat (limited to 'zephyr')
-rw-r--r--zephyr/projects/asurada/hayato/CMakeLists.txt3
-rw-r--r--zephyr/projects/asurada/hayato/src/i2c.c17
2 files changed, 20 insertions, 0 deletions
diff --git a/zephyr/projects/asurada/hayato/CMakeLists.txt b/zephyr/projects/asurada/hayato/CMakeLists.txt
index f1d0f33f8c..54dd0bfafb 100644
--- a/zephyr/projects/asurada/hayato/CMakeLists.txt
+++ b/zephyr/projects/asurada/hayato/CMakeLists.txt
@@ -26,6 +26,9 @@ zephyr_library_sources(
zephyr_library_sources(
"${PLATFORM_EC_BOARD}/battery.c")
+zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_I2C
+ "src/i2c.c")
+
# Board specific sensor implementation
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_MOTIONSENSE
"src/sensors.c")
diff --git a/zephyr/projects/asurada/hayato/src/i2c.c b/zephyr/projects/asurada/hayato/src/i2c.c
new file mode 100644
index 0000000000..2c7a9c7130
--- /dev/null
+++ b/zephyr/projects/asurada/hayato/src/i2c.c
@@ -0,0 +1,17 @@
+/* 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 "i2c/i2c.h"
+#include "i2c.h"
+
+/* Hayato board specific i2c implementation */
+
+#ifdef CONFIG_PLATFORM_EC_I2C_PASSTHRU_RESTRICTED
+int board_allow_i2c_passthru(int port)
+{
+ return (i2c_get_device_for_port(port) ==
+ i2c_get_device_for_port(I2C_PORT_VIRTUAL_BATTERY));
+}
+#endif