usb: typec: tcpm: Disregard vbus off while in PR_SWAP_SNK_SRC_SOURCE_ON
Subsystems (3)
Badhri Jagan Sridharan
maintainerPATCH 1/1 usb: typec: tcpm: Disregard vbus off while in PR_SWAP_SNK_SRC_SOURCE_ON
During PR_SWAP sequence, when TCPM is waiting in PR_SWAP_SNK_SRC_SOURCE_ON for the vbus source to ramp up, TCPM would prematurely exit PR_SWAP_SNK_SRC_SOURCE_ON and transition to SNK_UNATTACHED state when a vbus off notification is received. This should not be the case as vbus can still be off while in PR_SWAP_SNK_SRC_SOURCE_ON and the vbus source has PD_T_NEWSRC to ramp up.
--- drivers/usb/typec/tcpm/tcpm.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/usb/typec/tcpm/tcpm.c +8 -0
@@ -4218,6 +4218,14 @@ static void _tcpm_pd_vbus_off(struct tcpm_port *port)/* Do nothing, expected */ break ; +case PR_SWAP_SNK_SRC_SOURCE_ON : +/* +* Do nothing when vbus off notification is received. +* TCPM can wait for PD_T_NEWSRC in PR_SWAP_SNK_SRC_SOURCE_ON +* for the vbus source to ramp up. +*/ +break ; +case PORT_RESET_WAIT_OFF :tcpm_set_state (port,tcpm_default_state (port),0 );break ;
Signature · 1 line
2.29.2.454.gaff20da3a2-goog
Quoted 8 lines · Badhri Jagan Sridharan
During
PR_SWAPsequence, when TCPM is waiting inPR_SWAP_SNK_SRC_SOURCE_ONfor the vbus source to ramp up, TCPM would prematurely exitPR_SWAP_SNK_SRC_SOURCE_ONand transition toSNK_UNATTACHEDstate when a vbus off notification is received. This should not be the case as vbus can still be off while inPR_SWAP_SNK_SRC_SOURCE_ONand the vbus source hasPD_T_NEWSRCto ramp up.Signed-off-by Badhri Jagan Sridharan <[email protected]>
Quoted 26 lines
--- drivers/usb/typec/tcpm/tcpm.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/usb/typec/tcpm/tcpm.c +8
-0@@ -4218,6 +4218,14 @@ static void _tcpm_pd_vbus_off(struct tcpm_port *port)/* Do nothing, expected */ break ; +case PR_SWAP_SNK_SRC_SOURCE_ON : +/* +* Do nothing when vbus off notification is received. +* TCPM can wait for PD_T_NEWSRC in PR_SWAP_SNK_SRC_SOURCE_ON +* for the vbus source to ramp up. +*/ +break ; +case PORT_RESET_WAIT_OFF :tcpm_set_state (port,tcpm_default_state (port),0 );break ;Signature · 1 line
2.29.2.454.gaff20da3a2-goog
Quoted 8 lines · Badhri Jagan Sridharan
During
PR_SWAPsequence, when TCPM is waiting inPR_SWAP_SNK_SRC_SOURCE_ONfor the vbus source to ramp up, TCPM would prematurely exitPR_SWAP_SNK_SRC_SOURCE_ONand transition toSNK_UNATTACHEDstate when a vbus off notification is received. This should not be the case as vbus can still be off while inPR_SWAP_SNK_SRC_SOURCE_ONand the vbus source hasPD_T_NEWSRCto ramp up.Signed-off-by Badhri Jagan Sridharan <[email protected]>
FWIW:
Quoted 25 lines
--- drivers/usb/typec/tcpm/tcpm.c | 8 ++++++++ 1 file changed, 8 insertions(+)drivers/usb/typec/tcpm/tcpm.c +8
-0@@ -4218,6 +4218,14 @@ static void _tcpm_pd_vbus_off(struct tcpm_port *port)/* Do nothing, expected */ break ; +case PR_SWAP_SNK_SRC_SOURCE_ON : +/* +* Do nothing when vbus off notification is received. +* TCPM can wait for PD_T_NEWSRC in PR_SWAP_SNK_SRC_SOURCE_ON +* for the vbus source to ramp up. +*/ +break ; +case PORT_RESET_WAIT_OFF :tcpm_set_state (port,tcpm_default_state (port),0 );break ;Signature · 1 line
2.29.2.454.gaff20da3a2-goog
thanks,
Signature · 1 line
heikki
Greg Kroah-Hartman
maintainerQuoted 8 lines · Heikki Krogerus
Quoted 7 lines · Badhri Jagan Sridharan
During
PR_SWAPsequence, when TCPM is waiting inPR_SWAP_SNK_SRC_SOURCE_ONfor the vbus source to ramp up, TCPM would prematurely exitPR_SWAP_SNK_SRC_SOURCE_ONand transition toSNK_UNATTACHEDstate when a vbus off notification is received. This should not be the case as vbus can still be off while inPR_SWAP_SNK_SRC_SOURCE_ONand the vbus source hasPD_T_NEWSRCto ramp up.
Quoted 5 lines
Quoted 1 line
Signed-off-by Badhri Jagan Sridharan <[email protected]>FWIW:
Acked-by Heikki Krogerus <[email protected]>
Thanks, i've added this, and your other ack, to the commits in my tree.
greg k-h