Commit f4ff9e6b authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
parents a09434f1 5571ea31
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -1737,6 +1737,10 @@ static int tcpm_pd_svdm(struct tcpm_port *port, struct typec_altmode *adev,
	return rlen;
}

static void tcpm_pd_handle_msg(struct tcpm_port *port,
			       enum pd_msg_request message,
			       enum tcpm_ams ams);

static void tcpm_handle_vdm_request(struct tcpm_port *port,
				    const __le32 *payload, int cnt)
{
@@ -1764,11 +1768,11 @@ static void tcpm_handle_vdm_request(struct tcpm_port *port,
		port->vdm_state = VDM_STATE_DONE;
	}

	if (PD_VDO_SVDM(p[0])) {
	if (PD_VDO_SVDM(p[0]) && (adev || tcpm_vdm_ams(port) || port->nr_snk_vdo)) {
		rlen = tcpm_pd_svdm(port, adev, p, cnt, response, &adev_action);
	} else {
		if (port->negotiated_rev >= PD_REV30)
			tcpm_queue_message(port, PD_MSG_CTRL_NOT_SUPP);
			tcpm_pd_handle_msg(port, PD_MSG_CTRL_NOT_SUPP, NONE_AMS);
	}

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