usb: typec: tcpm: Move TCPC to APPLY_RC state during PR_SWAP
authorBadhri Jagan Sridharan <badhri@google.com>
Mon, 17 May 2021 19:21:11 +0000 (12:21 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 May 2021 18:05:56 +0000 (20:05 +0200)
commit59d4d06c8ab0375dcc4bab329e6ecd44dd46373e
tree8eb341a311b8787d90f2f145fbded200d549a71c
parentdea6f87e60d193b2b3e21f9c6d657e53617369da
usb: typec: tcpm: Move TCPC to APPLY_RC state during PR_SWAP

When vbus auto discharge is enabled, TCPCI based TCPC transitions
into Attached.SNK/Attached.SRC state. During PR_SWAP, TCPCI based
TCPC would disconnect when partner changes power roles. TCPC has
to be moved APPLY RC state during PR_SWAP. This is done by
ROLE_CONTROL.CC1 != ROLE_CONTROL.CC2 and
POWER_CONTROL.AutodischargeDisconnect is 0. Once the swap sequence
is done, AutoDischargeDisconnect is re-enabled.

Fixes: f321a02caebd ("usb: typec: tcpm: Implement enabling Auto Discharge disconnect support")
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Link: https://lore.kernel.org/r/20210517192112.40934-3-badhri@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/tcpm/tcpm.c
include/linux/usb/tcpm.h