summaryrefslogtreecommitdiff
path: root/test/charge_ramp.c
diff options
context:
space:
mode:
authorVijay Hiremath <vijay.p.hiremath@intel.com>2016-11-14 17:38:05 -0800
committerchrome-bot <chrome-bot@chromium.org>2016-12-05 16:43:00 -0800
commitf66113247a7fb0f8fcc015a50b85137d1ab044a1 (patch)
tree43baa437d00b7bf326301f2689b4222a2e36b273 /test/charge_ramp.c
parent64414f92b30d3d75d0ba29fd8b32f772a16acdff (diff)
downloadchrome-ec-f66113247a7fb0f8fcc015a50b85137d1ab044a1.tar.gz
charge_state_v2: Limit i/p current to meet allowed MAX i/p system power
If battery is not present, input current is set to PD_MAX_CURRENT_MA. If the input power set is greater than the maximum allowed system power, system might get damaged. Hence, limit the input current to meet maximum allowed input system power. BUG=chrome-os-partner:58498 BRANCH=none TEST=Manually tested on Reef. Removed the battery & using 'charger' console command observed the following. With Zinger charger at 20V - Input current is set to 2.25A With Type-C & other chargers - Input current is set to 3A Change-Id: Ife8686f322e095aa74b740a7c469bfe87107fb9a Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/397865 Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com> Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'test/charge_ramp.c')
-rw-r--r--test/charge_ramp.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/test/charge_ramp.c b/test/charge_ramp.c
index 4fc1c5ac63..33db036a59 100644
--- a/test/charge_ramp.c
+++ b/test/charge_ramp.c
@@ -53,7 +53,8 @@ int board_is_vbus_too_low(enum chg_ramp_vbus_state ramp_state)
vbus_low_current_ma;
}
-void board_set_charge_limit(int port, int supplier, int limit_ma, int max_ma)
+void board_set_charge_limit(int port, int supplier, int limit_ma,
+ int max_ma, int max_mv)
{
charge_limit_ma = limit_ma;
if (charge_limit_ma > overcurrent_current_ma)
@@ -79,7 +80,7 @@ static void plug_charger_with_ts(int supplier_type, int port, int min_current,
vbus_low_current_ma = vbus_low_current;
overcurrent_current_ma = overcurrent_current;
chg_ramp_charge_supplier_change(port, supplier_type, min_current,
- reg_time);
+ reg_time, 0);
}
static void plug_charger(int supplier_type, int port, int min_current,
@@ -93,7 +94,7 @@ static void plug_charger(int supplier_type, int port, int min_current,
static void unplug_charger(void)
{
chg_ramp_charge_supplier_change(CHARGE_PORT_NONE, CHARGE_SUPPLIER_NONE,
- 0, get_time());
+ 0, get_time(), 0);
}
static int unplug_charger_and_check(void)