diff options
author | Nicolas Boichat <drinkcat@chromium.org> | 2017-12-22 15:57:06 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-01-04 21:52:01 -0800 |
commit | 6bbb5adab171d473f38f1ad9f8f0a1dafff30146 (patch) | |
tree | 35d1930249e0a5f147db152220a35d733b3181d8 /include/charge_state_v2.h | |
parent | 41af1bf27c0e983523a055d2567bc15e7814e289 (diff) | |
download | chrome-ec-6bbb5adab171d473f38f1ad9f8f0a1dafff30146.tar.gz |
charge_state_v2: Add charge_set_output_current_limit function
This function sets up and enables "OTG" mode on the charger chip
(i.e. use the charger to provide power from the battery).
It also records the output current in curr.output_current, to
make sure that the charger loop is aware that current is provided
externally.
We also add a CONFIG_CHARGER_OTG to remove these functions on
boards that do not require it.
BRANCH=none
BUG=b:65697962
TEST=On wand, when discharging, battery status is updated every
5 seconds (and not every 60 seconds).
Change-Id: Ibf93933436f3eb24552a8e1eb9d97522fca2ce79
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/842743
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'include/charge_state_v2.h')
-rw-r--r-- | include/charge_state_v2.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/charge_state_v2.h b/include/charge_state_v2.h index 1c85323a60..f9f5d39edf 100644 --- a/include/charge_state_v2.h +++ b/include/charge_state_v2.h @@ -38,9 +38,22 @@ struct charge_state_data { int requested_voltage; int requested_current; int desired_input_current; +#ifdef CONFIG_CHARGER_OTG + int output_current; +#endif }; /** + * Set the output current limit and voltage. This is used to provide power from + * the charger chip ("OTG" mode). + * + * @param ma Maximum current to provide in mA (0 to disable output). + * @param mv Voltage in mV (ignored if ma == 0). + * @return EC_SUCCESS or error + */ +int charge_set_output_current_limit(int ma, int mv); + +/** * Set the charge input current limit. This value is stored and sent every * time AC is applied. * |