mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-11 02:15:14 +00:00
usb-pd: Clear active contract bit before browning out system
In the case where we are resetting Vbus and it is our only power source, then we will brown out before we set the active port to 0. BRANCH=none BUG=none TEST=Did a cold reset on grunt with no battery power. System booted as normal. Change-Id: I3823af6b0475e4cf8abbe12dd8ae4ceef26d1eab Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/911613 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
This commit is contained in:
@@ -1853,13 +1853,18 @@ static void pd_partner_port_reset(int port)
|
||||
(RESET_FLAG_BROWNOUT | RESET_FLAG_POWER_ON))
|
||||
return;
|
||||
|
||||
/*
|
||||
* Clear the active contract bit before we apply Rp in case we
|
||||
* intentionally brown out because we cut off our only power supply.
|
||||
*/
|
||||
pd_set_saved_active(port, 0);
|
||||
|
||||
/* Provide Rp for 200 msec. or until we no longer have VBUS. */
|
||||
tcpm_set_cc(port, TYPEC_CC_RP);
|
||||
timeout = get_time().val + 200 * MSEC;
|
||||
|
||||
while (get_time().val < timeout && pd_is_vbus_present(port))
|
||||
msleep(10);
|
||||
pd_set_saved_active(port, 0);
|
||||
}
|
||||
#endif /* CONFIG_USB_PD_DUAL_ROLE */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user