diff options
author | Nicolas Boichat <drinkcat@chromium.org> | 2017-12-13 14:44:48 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-01-05 00:51:29 -0800 |
commit | cfc69f6fb868b802a6033580ffe0cf73c092aca8 (patch) | |
tree | af9021ea8a120bd767d42e338cfda3b5cbb4f9e9 /include/ec_ec_comm_master.h | |
parent | 3fecdbdcf902770036b14b93ca19a5af181c9582 (diff) | |
download | chrome-ec-cfc69f6fb868b802a6033580ffe0cf73c092aca8.tar.gz |
ec_ec_comm_master: Functions for EC-EC communication master
This adds functions required for the master in EC-EC communication,
requesting base battery static and dynamic information, and charger
control.
BRANCH=none
BUG=b:65526215
TEST=Flash lux and wand, EC-EC communication works.
Change-Id: I7a46ee3f5848d22c2c9bea7870cbd7e74141cf3d
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/839201
Diffstat (limited to 'include/ec_ec_comm_master.h')
-rw-r--r-- | include/ec_ec_comm_master.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/include/ec_ec_comm_master.h b/include/ec_ec_comm_master.h new file mode 100644 index 0000000000..8c04795103 --- /dev/null +++ b/include/ec_ec_comm_master.h @@ -0,0 +1,60 @@ +/* Copyright 2017 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. + * + * EC-EC communication, functions for master. + */ + +#ifndef EC_EC_COMM_MASTER_H_ +#define EC_EC_COMM_MASTER_H_ + +#include <stdint.h> +#include "config.h" + +#if defined(CONFIG_EC_EC_COMM_MASTER) && defined(CONFIG_EC_EC_COMM_BATTERY) +#define CONFIG_EC_EC_COMM_BATTERY_MASTER +#endif + +/* + * TODO(b:65697620): Move these to some other C file, depending on a config + * option. + */ +extern struct ec_response_battery_static_info base_battery_static; +extern struct ec_response_battery_dynamic_info base_battery_dynamic; + +/** + * Sends EC_CMD_BATTERY_GET_DYNAMIC command to slave, and writes the + * battery dynamic information into base_battery_dynamic. + * + * Leaves base_battery_dynamic intact on error: it is the callers responsability + * to clear the data or ignore it. + + * @return EC_RES_SUCCESS on success, EC_RES_ERROR on communication error, + * else forwards the error code from the slave. + */ +int ec_ec_master_base_get_dynamic_info(void); + +/** + * Sends EC_CMD_BATTERY_GET_STATIC command to slave, and writes the + * battery static information into base_static_dynamic. + * + * Leaves base_battery_static intact on error: it is the callers responsability + * to clear the data or ignore it. + * + * @return EC_RES_SUCCESS on success, EC_RES_ERROR on communication error, + * else forwards the error code from the slave. + */ +int ec_ec_master_base_get_static_info(void); + +/** + * Sends EC_CMD_CHARGER_CONTROL command to slave, with the given parameters + * (see ec_commands.h/ec_params_charger_control for description). + * + * @return EC_RES_SUCCESS on success, EC_RES_ERROR on communication error, + * else forwards the error code from the slave. + */ +int ec_ec_master_base_charge_control(int max_current, + int otg_voltage, + int allow_charging); + +#endif /* EC_EC_COMM_MASTER_H_ */ |