Skip to content

Commit bf20c69

Browse files
RD Babieragregkh
authored andcommitted
usb: typec: tcpm: clear pd_event queue in PORT_RESET
When a Fast Role Swap control message attempt results in a transition to ERROR_RECOVERY, the TCPC can still queue a TCPM_SOURCING_VBUS event. If the event is queued but processed after the tcpm_reset_port() call in the PORT_RESET state, then the following occurs: 1. tcpm_reset_port() calls tcpm_init_vbus() to reset the vbus sourcing and sinking state 2. tcpm_pd_event_handler() turns VBUS on before the port is in the default state. 3. The port resolves as a sink. In the SNK_DISCOVERY state, tcpm_set_charge() cannot set vbus to charge. Clear pd events within PORT_RESET to get rid of non-applicable events. Fixes: b17dd57 ("staging: typec: tcpm: Improve role swap with non PD capable partners") Cc: [email protected] Signed-off-by: RD Babiera <[email protected]> Reviewed-by: Heikki Krogerus <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent edc5a00 commit bf20c69

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/usb/typec/tcpm/tcpm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5605,6 +5605,7 @@ static void run_state_machine(struct tcpm_port *port)
56055605
break;
56065606
case PORT_RESET:
56075607
tcpm_reset_port(port);
5608+
port->pd_events = 0;
56085609
if (port->self_powered)
56095610
tcpm_set_cc(port, TYPEC_CC_OPEN);
56105611
else

0 commit comments

Comments
 (0)