diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2017-10-06 15:46:02 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-10-19 12:56:42 -0700 |
commit | 165f7d6f3bad4d49f977e1c5efad326f11007bf0 (patch) | |
tree | 0d7d8aaf3d2ccbd5df041d7f55a2573355a31d62 /common/charge_ramp.c | |
parent | 251212fb9dea6d95a8caa43ec9eeb210abfa2df8 (diff) | |
download | chrome-ec-165f7d6f3bad4d49f977e1c5efad326f11007bf0.tar.gz |
charge_ramp: Ramp USB-C DTS sources
suzy-qable advertises 1.5A, but its actual capability depends on the
host USB port it is attached to. Since suzy-qable is ubiquitous and
other DTS sources may behave in the same way, ramp the input current
limit in order to find a reasonable maximum.
BUG=chromium:770296
BRANCH=None
TEST=Attach suzy-qable to kevin and reef, verify that neither OCs and EC
console via cr50 is available on reef. Also verify donette chargers
kevin at 3A and does not ramp.
Change-Id: Idd0683ede3a44111a01da6b4faab52f388ee82fd
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/693295
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common/charge_ramp.c')
-rw-r--r-- | common/charge_ramp.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/common/charge_ramp.c b/common/charge_ramp.c index d9c42d831e..86a0b454cc 100644 --- a/common/charge_ramp.c +++ b/common/charge_ramp.c @@ -5,9 +5,13 @@ /* Charge input current limit ramp module for Chrome EC */ +#include "charge_manager.h" #include "common.h" #include "system.h" #include "usb_charge.h" +#include "util.h" + +#define TYPEC_DTS_RAMP_MAX 2400 test_mockable int chg_ramp_allowed(int supplier) { @@ -15,12 +19,23 @@ test_mockable int chg_ramp_allowed(int supplier) if (!system_is_in_rw() && system_is_locked()) return 0; + /* Ramp DTS suppliers. */ + if (supplier == CHARGE_SUPPLIER_TYPEC_DTS) + return 1; + /* Othewise ask the BC1.2 detect module */ return usb_charger_ramp_allowed(supplier); } test_mockable int chg_ramp_max(int supplier, int sup_curr) { - /* Ask the BC1.2 detect module */ + /* + * Ramp DTS suppliers to advertised current or predetermined + * limit, whichever is greater. + */ + if (supplier == CHARGE_SUPPLIER_TYPEC_DTS) + return MAX(TYPEC_DTS_RAMP_MAX, sup_curr); + + /* Otherwise ask the BC1.2 detect module */ return usb_charger_ramp_max(supplier, sup_curr); } |