mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-08 16:41:55 +00:00
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>
This commit is contained in:
committed by
chrome-bot
parent
f236658ff7
commit
75e8dae37c
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user