Skip to contentSkip to conversation

usb: typec: tcpm: support sink port for debounce

PATCH In review Michael Wu 2 participants 2 messages Mar 12, 2024

Subsystems (3)
lore
Share & tools
lore

Michael Wu

author
#0 lore raw

PATCH 1/1 usb: typec: tcpm: support sink port for debounce

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]
---
 drivers/usb/typec/tcpm/tcpm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/typec/tcpm/tcpm.c +2 -0
index 0965972310275..9228dbd78bf2b 100644
@@ -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))
Signature · 1 line
2.29.0
maintainer
#1 lore raw
Quoted 7 lines · Michael Wu

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.

Recommended by whom (or what)?

Quoted 24 lines
[  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]
---
 drivers/usb/typec/tcpm/tcpm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/typec/tcpm/tcpm.c +2 -0
index 0965972310275..9228dbd78bf2b 100644
@@ -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))
Signature · 1 line
2.29.0
Signature · 1 line
heikki