summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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