summaryrefslogtreecommitdiff
path: root/common/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 /common/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 'common/charge_ramp.c')
-rw-r--r--common/charge_ramp.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/common/charge_ramp.c b/common/charge_ramp.c
index e63b37b9bd..f7bd48662e 100644
--- a/common/charge_ramp.c
+++ b/common/charge_ramp.c
@@ -66,6 +66,7 @@ static int oc_info_idx[CONFIG_USB_PD_PORT_COUNT];
static int active_port = CHARGE_PORT_NONE;
static int active_sup;
static int active_icl;
+static int active_vtg;
static timestamp_t reg_time;
static int stablize_port;
@@ -77,7 +78,7 @@ static int min_icl;
void chg_ramp_charge_supplier_change(int port, int supplier, int current,
- timestamp_t registration_time)
+ timestamp_t registration_time, int voltage)
{
/*
* If the last active port was a valid port and the port
@@ -97,6 +98,7 @@ void chg_ramp_charge_supplier_change(int port, int supplier, int current,
/* Set new active port, set ramp state, and wake ramp task */
active_port = port;
active_sup = supplier;
+ active_vtg = voltage;
/* Set min and max input current limit based on if ramp is allowed */
if (board_is_ramp_allowed(active_sup)) {
@@ -320,7 +322,8 @@ void chg_ramp_task(void)
/* Set the input current limit */
lim = chg_ramp_get_current_limit();
- board_set_charge_limit(active_port, active_sup, lim, lim);
+ board_set_charge_limit(active_port, active_sup, lim,
+ lim, active_vtg);
if (ramp_st == CHG_RAMP_STABILIZE)
/*