Skip to content

Commit 9017897

Browse files
Badhri Jagan Sridharangregkh
authored andcommitted
usb: typec: tcpm: Ignore CC and vbus changes in PORT_RESET change
After PORT_RESET, the port is set to the appropriate default_state. Ignore processing CC changes here as this could cause the port to be switched into sink states by default. echo source > /sys/class/typec/port0/port_type Before: [ 154.528547] pending state change PORT_RESET -> PORT_RESET_WAIT_OFF @ 100 ms [ 154.528560] CC1: 0 -> 0, CC2: 3 -> 0 [state PORT_RESET, polarity 0, disconnected] [ 154.528564] state change PORT_RESET -> SNK_UNATTACHED After: [ 151.068814] pending state change PORT_RESET -> PORT_RESET_WAIT_OFF @ 100 ms [rev3 NONE_AMS] [ 151.072440] CC1: 3 -> 0, CC2: 0 -> 0 [state PORT_RESET, polarity 0, disconnected] [ 151.172117] state change PORT_RESET -> PORT_RESET_WAIT_OFF [delayed 100 ms] [ 151.172136] pending state change PORT_RESET_WAIT_OFF -> SRC_UNATTACHED @ 870 ms [rev3 NONE_AMS] [ 152.060106] state change PORT_RESET_WAIT_OFF -> SRC_UNATTACHED [delayed 870 ms] [ 152.060118] Start toggling Signed-off-by: Badhri Jagan Sridharan <[email protected]> Cc: stable <[email protected]> Reviewed-by: Heikki Krogerus <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 1c2e54f commit 9017897

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

drivers/usb/typec/tcpm/tcpm.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3794,6 +3794,14 @@ static void _tcpm_cc_change(struct tcpm_port *port, enum typec_cc_status cc1,
37943794
*/
37953795
break;
37963796

3797+
case PORT_RESET:
3798+
case PORT_RESET_WAIT_OFF:
3799+
/*
3800+
* State set back to default mode once the timer completes.
3801+
* Ignore CC changes here.
3802+
*/
3803+
break;
3804+
37973805
default:
37983806
if (tcpm_port_is_disconnected(port))
37993807
tcpm_set_state(port, unattached_state(port), 0);
@@ -3855,6 +3863,15 @@ static void _tcpm_pd_vbus_on(struct tcpm_port *port)
38553863
case SRC_TRY_DEBOUNCE:
38563864
/* Do nothing, waiting for sink detection */
38573865
break;
3866+
3867+
case PORT_RESET:
3868+
case PORT_RESET_WAIT_OFF:
3869+
/*
3870+
* State set back to default mode once the timer completes.
3871+
* Ignore vbus changes here.
3872+
*/
3873+
break;
3874+
38583875
default:
38593876
break;
38603877
}
@@ -3908,10 +3925,19 @@ static void _tcpm_pd_vbus_off(struct tcpm_port *port)
39083925
case PORT_RESET_WAIT_OFF:
39093926
tcpm_set_state(port, tcpm_default_state(port), 0);
39103927
break;
3928+
39113929
case SRC_TRY_WAIT:
39123930
case SRC_TRY_DEBOUNCE:
39133931
/* Do nothing, waiting for sink detection */
39143932
break;
3933+
3934+
case PORT_RESET:
3935+
/*
3936+
* State set back to default mode once the timer completes.
3937+
* Ignore vbus changes here.
3938+
*/
3939+
break;
3940+
39153941
default:
39163942
if (port->pwr_role == TYPEC_SINK &&
39173943
port->attached)

0 commit comments

Comments
 (0)