Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: typec: tcpm: Fix misuses of AMS invocation

tcpm_ams_start is used to initiate an AMS as well as checking Collision
Avoidance conditions but not for flagging passive AMS (initiated by the
port partner). Fix the misuses of tcpm_ams_start in tcpm_pd_svdm.

ATTENTION doesn't need responses so the AMS flag is not needed here.

Fixes: 0bc3ee92880d ("usb: typec: tcpm: Properly interrupt VDM AMS")
Signed-off-by: Kyle Tso <kyletso@google.com>
Link: https://lore.kernel.org/r/20210601123151.3441914-5-kyletso@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Kyle Tso and committed by
Greg Kroah-Hartman
80137c18 7ac50510

+5 -6
+5 -6
drivers/usb/typec/tcpm/tcpm.c
··· 1555 1555 svdm_version = PD_VDO_SVDM_VER(p[0]); 1556 1556 } 1557 1557 1558 - tcpm_ams_start(port, DISCOVER_IDENTITY); 1558 + port->ams = DISCOVER_IDENTITY; 1559 1559 /* 1560 1560 * PD2.0 Spec 6.10.3: respond with NAK as DFP (data host) 1561 1561 * PD3.1 Spec 6.4.4.2.5.1: respond with NAK if "invalid field" or ··· 1576 1576 } 1577 1577 break; 1578 1578 case CMD_DISCOVER_SVID: 1579 - tcpm_ams_start(port, DISCOVER_SVIDS); 1579 + port->ams = DISCOVER_SVIDS; 1580 1580 break; 1581 1581 case CMD_DISCOVER_MODES: 1582 - tcpm_ams_start(port, DISCOVER_MODES); 1582 + port->ams = DISCOVER_MODES; 1583 1583 break; 1584 1584 case CMD_ENTER_MODE: 1585 - tcpm_ams_start(port, DFP_TO_UFP_ENTER_MODE); 1585 + port->ams = DFP_TO_UFP_ENTER_MODE; 1586 1586 break; 1587 1587 case CMD_EXIT_MODE: 1588 - tcpm_ams_start(port, DFP_TO_UFP_EXIT_MODE); 1588 + port->ams = DFP_TO_UFP_EXIT_MODE; 1589 1589 break; 1590 1590 case CMD_ATTENTION: 1591 - tcpm_ams_start(port, ATTENTION); 1592 1591 /* Attention command does not have response */ 1593 1592 *adev_action = ADEV_ATTENTION; 1594 1593 return 0;