Skip to content

Commit 2d6d801

Browse files
Xu Yanggregkh
authored andcommitted
usb: typec: tcpm: reset counter when enter into unattached state after try role
The try_src_count and try_snk_count may still be 1 after enter into unattached state. This may be caused by below case: - SNK_TRY->SNK_TRY_WAIT->SRC_TRYWAIT->SNK_UNATTACHED - SRC_TRY->SRC_TRY_WAIT->SNK_TRYWAIT->SNK_UNATTACHED The port->attached is not true at the end and tcpm_reset_port() will not be called. This will reset counter into for these cases, otherwise the tcpm won't try role when new cable attached. Signed-off-by: Xu Yang <[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 c97cd0b commit 2d6d801

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/usb/typec/tcpm/tcpm.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3720,6 +3720,9 @@ static void tcpm_detach(struct tcpm_port *port)
37203720
if (tcpm_port_is_disconnected(port))
37213721
port->hard_reset_count = 0;
37223722

3723+
port->try_src_count = 0;
3724+
port->try_snk_count = 0;
3725+
37233726
if (!port->attached)
37243727
return;
37253728

0 commit comments

Comments
 (0)