diff options
author | Alec Berg <alecaberg@chromium.org> | 2014-08-04 17:52:53 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-08-09 00:20:06 +0000 |
commit | 0815df9cbf1104a2c7fabdd4197358d54cdc8922 (patch) | |
tree | c0f1d79fd3e24eb6b4d10741e34565879baff3f1 /board/plankton/usb_pd_policy.c | |
parent | 566de98ca6b0d6a579a2dae84ecaac40c703abf7 (diff) | |
download | chrome-ec-0815df9cbf1104a2c7fabdd4197358d54cdc8922.tar.gz |
samus: ryu: set input current limit based on PD negotiation
Set input current limit based on the max current from the
PD negotiation. For samus, this information is passed to
the EC as a host command. For ryu, the max current is set
directly following a negotiation.
CONFIG_CHARGER_INPUT_CURRENT is now just the default limit,
but after a successful PD negotiation, the limit can be
raised.
Note, for now the input current limit for samus is set to
2/3 of the value negotiated for. This is due to hardware
problems measuring input current on p2b boards.
BUG=chrome-os-partner:28532, chrome-os-partner:24461
BRANCH=none
TEST=tested on a samus. Verified input current limit using
"charger" console command from EC. Input current limit
after a reboot is 512. When zinger is plugged in, it jumps
to the appropriate value (currently 1280mA), and when
the negotiation is changed using the "pd 0 dev 5" command
on the PD console, the input current limit is adjusted to
match (2000mA).
Change-Id: Iab9186a0f9814655e3240217a9baf4a38f15f84d
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/211023
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'board/plankton/usb_pd_policy.c')
-rw-r--r-- | board/plankton/usb_pd_policy.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/board/plankton/usb_pd_policy.c b/board/plankton/usb_pd_policy.c index c0d58e236b..c2ac2fd155 100644 --- a/board/plankton/usb_pd_policy.c +++ b/board/plankton/usb_pd_policy.c @@ -77,8 +77,14 @@ int pd_choose_voltage(int cnt, uint32_t *src_caps, uint32_t *rdo) /* request all the power ... */ ma = 10 * (src_caps[i] & 0x3FF); *rdo = RDO_FIXED(i + 1, ma, ma, 0); - ccprintf("Request [%d] %d V %d mA\n", i, set_mv/1000, ma); - return EC_SUCCESS; + ccprintf("Request [%d] %dV %dmA\n", i, set_mv/1000, ma); + return ma; +} + +void pd_set_input_current_limit(uint32_t max_ma) +{ + /* No battery, nothing to do */ + return; } void pd_set_max_voltage(unsigned mv) |