summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDawid Niedzwiecki <dn@semihalf.com>2021-05-26 14:34:30 +0200
committerCommit Bot <commit-bot@chromium.org>2021-05-27 20:21:02 +0000
commita697ded954696d4aadfd9e0d6f072f5e36232c94 (patch)
tree0688f0a92ba597cd132a60d0d9e359b06399b261
parent30fa95c02c2b278cfe952d76d58024535949945f (diff)
downloadchrome-ec-a697ded954696d4aadfd9e0d6f072f5e36232c94.tar.gz
zephyr: add I2C_VIRTUAL_BATTERY config
Add I2C_VIRTUAL_BATTERY config to use virtual battery driver. BUG=b:188885798 BRANCH=none TEST=zmake testall Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I6d1a4bfd8c950aa569ee836d9d22e438eeaef67b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2919906 Reviewed-by: Yuval Peress <peress@chromium.org> Commit-Queue: Yuval Peress <peress@chromium.org>
-rw-r--r--zephyr/CMakeLists.txt3
-rw-r--r--zephyr/Kconfig.battery9
-rw-r--r--zephyr/shim/include/config_chip.h5
3 files changed, 16 insertions, 1 deletions
diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt
index 7e9ae1b342..9e9af412d8 100644
--- a/zephyr/CMakeLists.txt
+++ b/zephyr/CMakeLists.txt
@@ -208,9 +208,10 @@ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_HOSTCMD_CONSOLE
"${PLATFORM_EC}/common/uart_hostcmd.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_HOSTCMD_GET_UPTIME_INFO
"${PLATFORM_EC}/common/uptime.c")
-
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_I2C
"${PLATFORM_EC}/common/i2c_controller.c")
+zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_I2C_VIRTUAL_BATTERY
+ "${PLATFORM_EC}/common/virtual_battery.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_KEYBOARD
"${PLATFORM_EC}/common/keyboard_scan.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_KEYBOARD_PROTOCOL_8042
diff --git a/zephyr/Kconfig.battery b/zephyr/Kconfig.battery
index 52553a0079..1b3f6a3dfd 100644
--- a/zephyr/Kconfig.battery
+++ b/zephyr/Kconfig.battery
@@ -97,6 +97,15 @@ config PLATFORM_EC_BATTERY_REVIVE_DISCONNECT
so, take it out of that state by force-applying a charge current.
This option requires battery_get_disconnect_state() to be defined.
+config PLATFORM_EC_I2C_VIRTUAL_BATTERY
+ bool "I2C virtual battery"
+ help
+ Enables driver for a virtual battery. It is used to minimalize I2C
+ traffic which is generated by the I2C_PASSTHRU host command.
+ The battery parameters, which are already cached in EC are used to
+ return desired data to host instead of issuing I2C transaction every
+ time.
+
choice "Charger select"
prompt "Select the charger to use"
help
diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h
index c07cc7b8c0..f051863c6f 100644
--- a/zephyr/shim/include/config_chip.h
+++ b/zephyr/shim/include/config_chip.h
@@ -154,6 +154,11 @@
#define CONFIG_BATTERY_SMART
#endif
+#undef CONFIG_I2C_VIRTUAL_BATTERY
+#ifdef CONFIG_PLATFORM_EC_I2C_VIRTUAL_BATTERY
+#define CONFIG_I2C_VIRTUAL_BATTERY
+#endif
+
#undef CONFIG_BATTERY_PRESENT_CUSTOM
#ifdef CONFIG_PLATFORM_EC_BATTERY_PRESENT_CUSTOM
#define CONFIG_BATTERY_PRESENT_CUSTOM