summaryrefslogtreecommitdiffstats
path: root/drivers/usb/typec
diff options
context:
space:
mode:
authorLi Jun <jun.li@nxp.com>2020-02-20 00:05:43 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-03-04 10:51:21 +0100
commit67540460193bb5dc3841590bc76e1421d56dc173 (patch)
tree36c9416cc269e8a71f181c074428c5964e0dd0b4 /drivers/usb/typec
parent9cb9322a26ae84424c3e16e58617b3d8962fdbbb (diff)
downloadlinux-67540460193bb5dc3841590bc76e1421d56dc173.tar.bz2
usb: typec: tcpm: move to SNK_UNATTACHED if sink removed for DRP
Per typec spec: Figure 4-15 Connection State Diagram: DRP Figure 4-16 Connection State Diagram: DRP with Accessory and Try.SRC Support Figure 4-17 Connection State Diagram: DRP with Accessory and Try.SNK Support DRP port should move to Unattached.SNK instead of Unattached.SRC if sink removed. Signed-off-by: Li Jun <jun.li@nxp.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/1582128343-22438-1-git-send-email-jun.li@nxp.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/typec')
-rw-r--r--drivers/usb/typec/tcpm/tcpm.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index bc0032a6b9a1..de3576e6530a 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -3680,8 +3680,12 @@ static void _tcpm_cc_change(struct tcpm_port *port, enum typec_cc_status cc1,
case SRC_SEND_CAPABILITIES:
case SRC_READY:
if (tcpm_port_is_disconnected(port) ||
- !tcpm_port_is_source(port))
- tcpm_set_state(port, SRC_UNATTACHED, 0);
+ !tcpm_port_is_source(port)) {
+ if (port->port_type == TYPEC_PORT_SRC)
+ tcpm_set_state(port, SRC_UNATTACHED, 0);
+ else
+ tcpm_set_state(port, SNK_UNATTACHED, 0);
+ }
break;
case SNK_UNATTACHED:
if (tcpm_port_is_sink(port))