Files
OpenCellular/include/ec_ec_comm_master.h
Nicolas Boichat ad286a050e 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>
2018-02-07 11:55:57 -08:00

50 lines
1.6 KiB
C

/* 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"
/**
* Sends EC_CMD_BATTERY_GET_DYNAMIC command to slave, and writes the
* battery dynamic information into battery_dynamic[BATT_IDX_BASE].
*
* Leaves battery_dynamic[BATT_IDX_BASE] intact on error: it is the callers
* responsibility 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 battery_static[BATT_IDX_BASE].
*
* Leaves battery_static[BATT_IDX_BASE] intact on error: it is the callers
* responsibility 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_ */