diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2018-12-14 10:33:05 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-12-17 20:47:04 -0800 |
commit | db32f244a7dbae24ae83633cad1d5b4deb92c5e0 (patch) | |
tree | 67d9b388824c365a12be28f360193333376cbdbf | |
parent | 1817c17273dac363a93e5a6b6169d88b79479bd4 (diff) | |
download | chrome-ec-db32f244a7dbae24ae83633cad1d5b4deb92c5e0.tar.gz |
charge_ramp: Allow USB-C power to be ramped by hardware
Currently, hardware ramping (= voltage regulation) is automatically
disabled for USB-C power supplier (HARGE_SUPPLIER_PD & _TYPEC).
This patch allows USB-C suppliers to get voltage regulation. It prevents
the input voltage of weak suppliers from drooping.
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
BUG=b/80163913,b/120238339
BRANCH=none
TEST=Verify Vayne get charged by PD and Type-C adapters.
TEST=Verify on Vayne input current limit is set to adapters' limit.
Change-Id: Ideecac911822ffca33be1755846febfcb822f734
Reviewed-on: https://chromium-review.googlesource.com/1377564
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r-- | common/charge_ramp.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/common/charge_ramp.c b/common/charge_ramp.c index 86a0b454cc..415e36a816 100644 --- a/common/charge_ramp.c +++ b/common/charge_ramp.c @@ -19,9 +19,16 @@ 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) + switch (supplier) { + case CHARGE_SUPPLIER_TYPEC_DTS: +#ifdef CONFIG_CHARGE_RAMP_HW + /* Need ramping for USB-C chargers as well to avoid voltage droops. */ + case CHARGE_SUPPLIER_PD: + case CHARGE_SUPPLIER_TYPEC: +#endif return 1; + /* default: fall through */ + } /* Othewise ask the BC1.2 detect module */ return usb_charger_ramp_allowed(supplier); @@ -29,12 +36,20 @@ test_mockable int chg_ramp_allowed(int supplier) test_mockable int chg_ramp_max(int supplier, int sup_curr) { - /* - * Ramp DTS suppliers to advertised current or predetermined - * limit, whichever is greater. - */ - if (supplier == CHARGE_SUPPLIER_TYPEC_DTS) + switch (supplier) { + case CHARGE_SUPPLIER_TYPEC_DTS: + /* + * Ramp DTS suppliers to advertised current or predetermined + * limit, whichever is greater. + */ return MAX(TYPEC_DTS_RAMP_MAX, sup_curr); +#ifdef CONFIG_CHARGE_RAMP_HW + case CHARGE_SUPPLIER_PD: + case CHARGE_SUPPLIER_TYPEC: +#endif + return sup_curr; + /* default: fall through */ + } /* Otherwise ask the BC1.2 detect module */ return usb_charger_ramp_max(supplier, sup_curr); |