diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2015-09-28 18:58:08 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2015-09-29 21:11:38 -0700 |
commit | 75e8dae37c698b00591c358025223d03a82d2a22 (patch) | |
tree | efbe2f18517d1b5cf4b7ddd70ddf2988d0441566 | |
parent | f236658ff7f5c98e60db05dca49a90d8795867c7 (diff) | |
download | chrome-ec-75e8dae37c698b00591c358025223d03a82d2a22.tar.gz |
pd: Always update charge manager on PD_CTRL_PS_RDY
When a PD charger is found, we typically update charge manager
voltage / current limits to what we want to request, set a 500mA ceiling,
and then wait for negoiation to complete. If it completes as expected,
we simply remove the 500mA ceiling.
When we're already negotiated with a port and we receive a new power
request, we may switch to a different voltage / current limit. If we do
so, charge manager won't get updated with the existing design because we
don't get new source cap information. Therefore, update charge manager
whenever we receive PD_CTRL_PS_RDY as a sink. Typically, the update will
have no effect because we'll be writing identical values. In the new
power request case though it will serve to inform charge manager of the
new mode.
BUG=chrome-os-partner:45932
TEST=Manual on ryu. Insert zinger, run `pd 0 dev 5` followed by `bq` to
verify 3A limit is set as expected.
BRANCH=ryu
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I8cc3ac0a3eb603cdeb45ea437906303abcaedac0
Reviewed-on: https://chromium-review.googlesource.com/302844
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
-rw-r--r-- | common/usb_pd_protocol.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 23aae650c0..28389b274f 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -904,14 +904,13 @@ static void handle_ctrl_request(int port, uint16_t head, /* Do nothing, assume this is a redundant PD_RDY */ } else if (pd[port].power_role == PD_ROLE_SINK) { set_state(port, PD_STATE_SNK_READY); + pd_set_input_current_limit(port, pd[port].curr_limit, + pd[port].supply_voltage); #ifdef CONFIG_CHARGE_MANAGER /* Set ceiling based on what's negotiated */ charge_manager_set_ceil(port, CEIL_REQUESTOR_PD, pd[port].curr_limit); -#else - pd_set_input_current_limit(port, pd[port].curr_limit, - pd[port].supply_voltage); #endif } break; |