Skip to content

Commit f4ff9e6

Browse files
committed
Merge tag 'usb-5.14-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fix from Greg KH: "Here is a single USB typec tcpm fix for a reported problem for 5.14-rc7. It showed up in 5.13 and resolves an issue that Hans found. It has been in linux-next this week with no reported problems" * tag 'usb-5.14-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: usb: typec: tcpm: Fix VDMs sometimes not being forwarded to alt-mode drivers
2 parents a09434f + 5571ea3 commit f4ff9e6

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

drivers/usb/typec/tcpm/tcpm.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,6 +1737,10 @@ static int tcpm_pd_svdm(struct tcpm_port *port, struct typec_altmode *adev,
17371737
return rlen;
17381738
}
17391739

1740+
static void tcpm_pd_handle_msg(struct tcpm_port *port,
1741+
enum pd_msg_request message,
1742+
enum tcpm_ams ams);
1743+
17401744
static void tcpm_handle_vdm_request(struct tcpm_port *port,
17411745
const __le32 *payload, int cnt)
17421746
{
@@ -1764,11 +1768,11 @@ static void tcpm_handle_vdm_request(struct tcpm_port *port,
17641768
port->vdm_state = VDM_STATE_DONE;
17651769
}
17661770

1767-
if (PD_VDO_SVDM(p[0])) {
1771+
if (PD_VDO_SVDM(p[0]) && (adev || tcpm_vdm_ams(port) || port->nr_snk_vdo)) {
17681772
rlen = tcpm_pd_svdm(port, adev, p, cnt, response, &adev_action);
17691773
} else {
17701774
if (port->negotiated_rev >= PD_REV30)
1771-
tcpm_queue_message(port, PD_MSG_CTRL_NOT_SUPP);
1775+
tcpm_pd_handle_msg(port, PD_MSG_CTRL_NOT_SUPP, NONE_AMS);
17721776
}
17731777

17741778
/*
@@ -2471,10 +2475,7 @@ static void tcpm_pd_data_request(struct tcpm_port *port,
24712475
NONE_AMS);
24722476
break;
24732477
case PD_DATA_VENDOR_DEF:
2474-
if (tcpm_vdm_ams(port) || port->nr_snk_vdo)
2475-
tcpm_handle_vdm_request(port, msg->payload, cnt);
2476-
else if (port->negotiated_rev > PD_REV20)
2477-
tcpm_pd_handle_msg(port, PD_MSG_CTRL_NOT_SUPP, NONE_AMS);
2478+
tcpm_handle_vdm_request(port, msg->payload, cnt);
24782479
break;
24792480
case PD_DATA_BIST:
24802481
port->bist_request = le32_to_cpu(msg->payload[0]);

0 commit comments

Comments
 (0)