Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2dec2b26 authored by Vijayavardhan Vennapusa's avatar Vijayavardhan Vennapusa
Browse files

USB: pd: Drop ATTENTION command if no SVID handler is discovered



If DP adaptor sends ATTENTION command before USB PD driver sends
DISCOVER_IDENTITY command, TX command is being aborted and freed.
Due to this, DP adaptor is not getting detected as vdm state
machine is stuck at VDM_NONE. Fix it by dropping ATTENTION command
in this case unless atleast one SVID handler is discovered/connected.

Change-Id: Ib51911790f703c3497643cc99079ab20709390bc
Signed-off-by: default avatarVijayavardhan Vennapusa <vvreddy@codeaurora.org>
parent 4b19ee48
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
/* Copyright (c) 2016-2017, Linux Foundation. All rights reserved.
/* Copyright (c) 2016-2018, Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -1562,6 +1562,18 @@ static void handle_vdm_rx(struct usbpd *pd, struct rx_msg *rx_msg)

	/* if this interrupts a previous exchange, abort queued response */
	if (cmd_type == SVDM_CMD_TYPE_INITIATOR && pd->vdm_tx) {
		/*
		 * Drop ATTENTION command unless atleast one SVID handler is
		 * discovered/connected.
		 */
		if (cmd == USBPD_SVDM_ATTENTION && handler &&
						!handler->discovered) {
			usbpd_dbg(&pd->dev, "Send vdm command again queued SVDM tx (SVID:0x%04x)\n",
				VDM_HDR_SVID(pd->vdm_tx->data[0]));
			kick_sm(pd, 0);
			return;
		}

		usbpd_dbg(&pd->dev, "Discarding previously queued SVDM tx (SVID:0x%04x)\n",
				VDM_HDR_SVID(pd->vdm_tx->data[0]));