diff options
author | Michał Barnaś <mb@semihalf.com> | 2021-10-06 16:13:13 +0200 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-10-15 17:11:46 +0000 |
commit | 0398923c16ee19fd31e1a43ace6d2c29a026c854 (patch) | |
tree | c210da96d538ce27e98810b4731cc537f6685766 /common | |
parent | aebcdcde3839c41ba0a68d34e32bf7dd49fe08e9 (diff) | |
download | chrome-ec-0398923c16ee19fd31e1a43ace6d2c29a026c854.tar.gz |
zephyr: add support for virtual battery
Add Kconfigs to enable virtual battery and set virtual battery address.
Change named-i2c from I2C_PORT_VIRTUAL to I2C_PORT_VIRTUAL_BATTERY.
BRANCH=main
BUG=b:185480578
TEST=When virtual battery is enabled, compilation fails if no
virtual battery port is defined in device tree.
TEST=Enable virtual battery and verify that its handlers
are called properly.
Change-Id: Ic88da28dc443beb89a32868d201072f39abb3a86
Signed-off-by: Michał Barnaś <mb@semihalf.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3207991
Reviewed-by: Keith Short <keithshort@chromium.org>
Commit-Queue: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/i2c_controller.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/common/i2c_controller.c b/common/i2c_controller.c index 62beb38e5a..90d8a8da80 100644 --- a/common/i2c_controller.c +++ b/common/i2c_controller.c @@ -1250,7 +1250,7 @@ static int check_i2c_params(const struct host_cmd_handler_args *args) return EC_RES_SUCCESS; } -#ifdef I2C_PORT_VIRTUAL_BATTERY +#ifdef CONFIG_I2C_VIRTUAL_BATTERY static inline int is_i2c_port_virtual_battery(int port) { #ifdef CONFIG_ZEPHYR @@ -1263,7 +1263,7 @@ static inline int is_i2c_port_virtual_battery(int port) return (port == I2C_PORT_VIRTUAL_BATTERY); #endif } -#endif /* I2C_PORT_VIRTUAL_BATTERY */ +#endif /* CONFIG_I2C_VIRTUAL_BATTERY */ static enum ec_status i2c_command_passthru(struct host_cmd_handler_args *args) { @@ -1338,7 +1338,7 @@ static enum ec_status i2c_command_passthru(struct host_cmd_handler_args *args) if (resp->num_msgs == params->num_msgs - 1) xferflags |= I2C_XFER_STOP; -#if defined(VIRTUAL_BATTERY_ADDR_FLAGS) && defined(I2C_PORT_VIRTUAL_BATTERY) +#ifdef CONFIG_I2C_VIRTUAL_BATTERY if (is_i2c_port_virtual_battery(params->port) && addr_flags == VIRTUAL_BATTERY_ADDR_FLAGS) { if (virtual_battery_handler(resp, in_len, &rv, |