mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-11 18:35:28 +00:00
pd: change power request based on if active charge port
When we receive source capabilities packet from a source, if we are already the active charging port, then we know we can request max power, otherwise request vSafe5V. Normally, when you first attach a charger, the port won't already be the active charge port when we receive source cap. But, if we already have a power contract with a source and the source sends us new source capabilities, then this comes in to play. BUG=chrome-os-partner:34168 BRANCH=samus TEST=test with plankton. when you press the 5/12/20 V buttons on plankton it changes the source capabilites of plankton and sends a new source cap packet to samus. thus, without this change, when you press one of the buttons twice, the second button press causes us to negotiate to vSafe5V instead of the max power. with this change, the requested power stays constant when plankton re-issues source capabilities. Change-Id: I3cc1e6b109117566f59de07762fd1af9adec05bf Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/233753 Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
committed by
chrome-internal-fetch
parent
ddc5bfd3d0
commit
5e2409745d
@@ -868,7 +868,12 @@ static void handle_data_request(int port, uint16_t head,
|
||||
pd_store_src_cap(port, cnt, payload);
|
||||
/* src cap 0 should be fixed PDO */
|
||||
pd_update_pdo_flags(port, payload[0]);
|
||||
pd_send_request_msg(port, PD_REQUEST_MIN);
|
||||
#ifdef CONFIG_CHARGE_MANAGER
|
||||
if (charge_manager_get_active_charge_port() == port)
|
||||
pd_send_request_msg(port, PD_REQUEST_MAX);
|
||||
else
|
||||
#endif
|
||||
pd_send_request_msg(port, PD_REQUEST_MIN);
|
||||
}
|
||||
break;
|
||||
#endif /* CONFIG_USB_PD_DUAL_ROLE */
|
||||
|
||||
Reference in New Issue
Block a user