Files
OpenCellular/include/charger.h
Justin Chuang fc91a7f7fd Support discharge on BQ24715 for Rambi and Squawks
BUG=chrome-os-partner:25031
BRANCH=rambi
TEST=Manually
  make BOARD=peppy
  make BOARD=falco
  make BOARD=rambi
  make BOARD=squawks
  On rambi and squawks, connect charger
     ectool chargecontrol discharge
     ectool i2cread 16 0 0x16 0x0a
     It should return 16-bit negative integer.

Change-Id: I8a8dfa90d2ad82595ac7a420c3c8ffc13b12cde6
Signed-off-by: Justin Chuang <jchuang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/182586
Reviewed-by: Dave Parker <dparker@chromium.org>
2014-01-16 06:43:05 +00:00

92 lines
2.4 KiB
C

/* Copyright (c) 2012 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.
*/
/* Charger/battery debug command module for Chrome EC */
#ifndef __CROS_EC_CHARGER_H
#define __CROS_EC_CHARGER_H
#include "common.h"
/* Charger infomation
* voltage unit: mV
* current unit: mA
*/
struct charger_info {
const char *name;
uint16_t voltage_max;
uint16_t voltage_min;
uint16_t voltage_step;
uint16_t current_max;
uint16_t current_min;
uint16_t current_step;
uint16_t input_current_max;
uint16_t input_current_min;
uint16_t input_current_step;
};
/* Power state machine post init */
int charger_post_init(void);
/* Get charger information. */
const struct charger_info *charger_get_info(void);
/* Get smart battery charger status. Supported flags:
* CHARGER_CHARGE_INHIBITED
* CHARGER_LEVEL_2
*/
int charger_get_status(int *status);
/* Set smart battery charger mode. Supported mode(s):
* CHARGER_FLAG_INHIBIT_CHARGE
*/
int charger_set_mode(int mode);
/**
* For chargers that are able to supply 5V output power for OTG dongle, this
* function enables or disables 5V power output.
*/
int charger_enable_otg_power(int enabled);
/**
* Return the closest match the charger can supply to the requested current.
*
* @param current Requested current in mA.
*
* @return Current the charger will actually supply if <current> is requested.
*/
int charger_closest_current(int current);
/**
* Return the closest match the charger can supply to the requested voltage.
*
* @param voltage Requested voltage in mV.
*
* @return Voltage the charger will actually supply if <voltage> is requested.
*/
int charger_closest_voltage(int voltage);
/* Get/set charge current limit in mA */
int charger_get_current(int *current);
int charger_set_current(int current);
/* Get/set charge voltage limit in mV */
int charger_get_voltage(int *voltage);
int charger_set_voltage(int voltage);
/* Discharge battery when on AC power. */
int charger_discharge_on_ac(int enable);
/* Other parameters that may be charger-specific, but are common so far. */
int charger_set_input_current(int input_current);
int charger_get_input_current(int *input_current);
int charger_manufacturer_id(int *id);
int charger_device_id(int *id);
int charger_get_option(int *option);
int charger_set_option(int option);
#endif /* __CROS_EC_CHARGER_H */