mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
pd: add hard reset counter to sink hard reset recovery state
The new hard reset recovery state was endlessly sending hard resets. Added in hard reset counter to cap the number of hard resets for a sink. BUG=none BRANCH=samus TEST=test with non-PD type-C charger and verify that we only send two hard resets and set the appropriate input current limit after the hard resets. Change-Id: I95a3739be28ad2a5fed245aad021bcd6d51d94b1 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/233754 Reviewed-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
committed by
chrome-internal-fetch
parent
5e2409745d
commit
4b8be2f778
@@ -1938,7 +1938,10 @@ void pd_task(void)
|
||||
set_state_timeout(port,
|
||||
get_time().val +
|
||||
PD_T_SAFE_0V,
|
||||
PD_STATE_HARD_RESET_SEND);
|
||||
hard_reset_count <
|
||||
PD_HARD_RESET_COUNT ?
|
||||
PD_STATE_HARD_RESET_SEND :
|
||||
PD_STATE_SNK_DISCOVERY);
|
||||
}
|
||||
|
||||
if (!pd_snk_is_vbus_provided(port) &&
|
||||
@@ -2179,7 +2182,9 @@ void pd_task(void)
|
||||
break;
|
||||
case PD_STATE_HARD_RESET_SEND:
|
||||
#ifdef CONFIG_USB_PD_DUAL_ROLE
|
||||
if (pd[port].last_state == PD_STATE_SNK_DISCOVERY)
|
||||
if (pd[port].last_state == PD_STATE_SNK_DISCOVERY ||
|
||||
pd[port].last_state ==
|
||||
PD_STATE_SNK_HARD_RESET_RECOVER)
|
||||
hard_reset_count++;
|
||||
#endif
|
||||
if (pd[port].last_state != pd[port].task_state) {
|
||||
|
||||
Reference in New Issue
Block a user