mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] usb: typec: tcpm: support sink port for debounce
@ 2024-03-12  1:13 Michael Wu
  2024-03-12 11:07 ` Heikki Krogerus
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Wu @ 2024-03-12  1:13 UTC (permalink / raw)
  To: heikki.krogerus, gregkh, linux, badhri, kyletso, frank.wang,
	rdbabiera, xu.yang_2
  Cc: linux-usb, linux-kernel

When both CC1 and CC2 pins are simultaneously pulled up, it often leads
to the double Rp to Vbus cable being stuck in the SNK_ATTACH_WAIT state.
And the state machine fails to transition to the SNK_ATTACHED state.

Therefore, it is recommended to focus on transitioning the sink port to
the SNK_DEBOUNCED state instead. By doing so, the desired outcome can be
achieved more effectively.

[  134.525750] VBUS on
[  134.713240] CC1: 0 -> 3, CC2: 0 -> 3 [state TOGGLING, polarity 0, connected]
[  134.713249] state change TOGGLING -> SNK_ATTACH_WAIT [rev3 NONE_AMS]

Signed-off-by: Michael Wu <michael@allwinnertech.com>
---
 drivers/usb/typec/tcpm/tcpm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 0965972310275..9228dbd78bf2b 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -4197,6 +4197,8 @@ static void run_state_machine(struct tcpm_port *port)
 		else if (tcpm_port_is_disconnected(port))
 			tcpm_set_state(port, SNK_UNATTACHED,
 				       PD_T_PD_DEBOUNCE);
+		else if (tcpm_port_is_sink(port))
+			tcpm_set_state(port, SNK_DEBOUNCED, 0);
 		break;
 	case SNK_DEBOUNCED:
 		if (tcpm_port_is_disconnected(port))
-- 
2.29.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-12 11:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-12  1:13 [PATCH] usb: typec: tcpm: support sink port for debounce Michael Wu
2024-03-12 11:07 ` Heikki Krogerus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®