summaryrefslogtreecommitdiff
path: root/common/ec_ec_comm_slave.c
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2018-01-26 12:24:13 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-02-07 11:55:57 -0800
commitad286a050ea566ebd89cb53f5118c91b04a0980c (patch)
treee971a973353b0b2477429009d7f3804bd8d9ecec /common/ec_ec_comm_slave.c
parentc8e2deb24dbbf4165acac4d3b72376d98ec210a1 (diff)
downloadchrome-ec-ad286a050ea566ebd89cb53f5118c91b04a0980c.tar.gz
charge_state_v2: Store battery information in new structures
On dual battery systems, this allows to keep both batteries information in similar structures. This also means that battery information can only be fetched via host commands EC_CMD_BATTERY_GET_STATIC/DYNAMIC (next CL will make it possible to fetch the information via shared memory/ACPI). BRANCH=none BUG=b:65697620 TEST=Boot lux/wand, dual-battery algorithm works, AP can fetch both battery information via host commands. Change-Id: I3c087e8f378c5cef0006f6bfe58335228a880e5b Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/888381 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Diffstat (limited to 'common/ec_ec_comm_slave.c')
-rw-r--r--common/ec_ec_comm_slave.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/common/ec_ec_comm_slave.c b/common/ec_ec_comm_slave.c
index c9696a52d4..91687bb79a 100644
--- a/common/ec_ec_comm_slave.c
+++ b/common/ec_ec_comm_slave.c
@@ -26,13 +26,6 @@
/* Print extra debugging information */
#undef EXTRA_DEBUG
-/*
- * TODO(b:65697620): Move these to some other C file, depending on a config
- * option.
- */
-struct ec_response_battery_static_info base_battery_static;
-struct ec_response_battery_dynamic_info base_battery_dynamic;
-
/* Set if the master allows the slave to charge the battery. */
static int charging_allowed;
@@ -274,14 +267,14 @@ void ec_ec_comm_slave_task(void *u)
case EC_CMD_BATTERY_GET_STATIC:
/* Note that we ignore the battery index parameter. */
write_response(EC_RES_SUCCESS, seq,
- &base_battery_static,
- sizeof(base_battery_static));
+ &battery_static[BATT_IDX_MAIN],
+ sizeof(battery_static[BATT_IDX_MAIN]));
break;
case EC_CMD_BATTERY_GET_DYNAMIC:
/* Note that we ignore the battery index parameter. */
write_response(EC_RES_SUCCESS, seq,
- &base_battery_dynamic,
- sizeof(base_battery_dynamic));
+ &battery_dynamic[BATT_IDX_MAIN],
+ sizeof(battery_dynamic[BATT_IDX_MAIN]));
break;
case EC_CMD_CHARGER_CONTROL: {
handle_cmd_charger_control((void *)params,