summaryrefslogtreecommitdiff
path: root/common/ec_ec_comm_slave.c
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2017-12-22 15:57:06 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-01-04 21:52:01 -0800
commit6bbb5adab171d473f38f1ad9f8f0a1dafff30146 (patch)
tree35d1930249e0a5f147db152220a35d733b3181d8 /common/ec_ec_comm_slave.c
parent41af1bf27c0e983523a055d2567bc15e7814e289 (diff)
downloadchrome-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 'common/ec_ec_comm_slave.c')
-rw-r--r--common/ec_ec_comm_slave.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/common/ec_ec_comm_slave.c b/common/ec_ec_comm_slave.c
index ae753274a5..c9696a52d4 100644
--- a/common/ec_ec_comm_slave.c
+++ b/common/ec_ec_comm_slave.c
@@ -143,7 +143,7 @@ static void handle_cmd_charger_control(
}
if (params->max_current >= 0) {
- charger_enable_otg_power(0);
+ charge_set_output_current_limit(0, 0);
charge_set_input_current_limit(
MIN(MAX_CURRENT_MA, params->max_current), 0);
charging_allowed = params->allow_charging;
@@ -157,9 +157,8 @@ static void handle_cmd_charger_control(
/* Reset input current to minimum. */
charge_set_input_current_limit(CONFIG_CHARGER_INPUT_CURRENT, 0);
/* Setup and enable "OTG". */
- charger_set_otg_current_voltage(-params->max_current,
+ charge_set_output_current_limit(-params->max_current,
params->otg_voltage);
- charger_enable_otg_power(1);
charging_allowed = 0;
}