Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2732475pxj; Mon, 31 May 2021 09:20:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWTLWASaISE+k98fDVq+m49hmCmkd3oQt8O6i0cj7bDDx70S3mu3zGbx4vDiUFl+f21AuT X-Received: by 2002:a17:906:5d0c:: with SMTP id g12mr23405789ejt.447.1622478022318; Mon, 31 May 2021 09:20:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622478022; cv=none; d=google.com; s=arc-20160816; b=DukF1RS+GZXGEawRfhpQnsyvTMtOuMgpCU8TbdsEgKStV5UjzBJI/CE0qnsegG/2Lj RdQK0inwlX/HNptrwlXziUZOXPGspeEtJO1L4AfumvksesSY4pZi6u6K6R7MntgouzZn YG/lE0hjWJlu6UAcfXBrggq9/cBFnYyP1gzqF4QLAnOXhtdpGq0pONHBVr4vnN0mD+y6 BxAwIDlCb3pENoV/WIA72ztgGNM1l5xWXczSQL6xczxGHI6AJg4aiSHOO3kwFyjd+fNs s7EQfssRc+wyVdvi9PUozwjZSO+GWwhf4l0hsTlRIAjyw8udcKYlKc5AthH9ZzvMz7Dx g5Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tZznRthcT69WcwNi7Efgm8iCLwfBRgdIXtJIAhTJN/s=; b=x8fWFiyQUq25mdHDOzzJmP7AfXcvK1pMPNoVtuh7S0VXJp2IJc8RgvUVBCM4BDPACW gCBX5vvbawnGlbbBI1AP6a3+1VNJo9lqImdlSVJVWC8VGWPkngT6F3ZZzadPNLK9hPaT 87yHzUXuQ/cbBKKhExG6nhre7XsLQ79UQpOcVl9uoU47H0XOKQ4NiVfvmxqRt3KbQSxr apMbdnHX7mPTDDF6BE75b4DUP1vBFqQSsXL0YqoikxTo/OgAD6RXTcpdVFWoUmVnxkRV pwD5cXI143SZPATIFoTXq/gulpBb1yr+KDgjsVJ0WnbJT+WPSeVEhHWN3hvhscK5q6w9 YuRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ltHowRXi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f16si6808616ejc.261.2021.05.31.09.19.59; Mon, 31 May 2021 09:20:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ltHowRXi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233161AbhEaQUC (ORCPT + 99 others); Mon, 31 May 2021 12:20:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:36376 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233571AbhEaOlb (ORCPT ); Mon, 31 May 2021 10:41:31 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2016961C69; Mon, 31 May 2021 13:53:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622469203; bh=jFKVi9XL6ixV0hbqfoPYTOQJnIaF9QxvbHICEOH5Dn8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ltHowRXi9PDEigMVmg4ePToab6FNMgbwipF316mNLvz9+tZXfZLmIm08Zpvi5/CHk 2rcfZdnOt8wqNkKGWAJT1EtubmkKap8XdTcJZUuYkbPZd6h+OO8cSnCrU9k7y58soj SRmBX9Ws0UxGnMGhbSCNl64D+VR27e8BIdadkxbo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guenter Roeck , Heikki Krogerus , Kyle Tso Subject: [PATCH 5.12 109/296] usb: typec: tcpm: Respond Not_Supported if no snk_vdo Date: Mon, 31 May 2021 15:12:44 +0200 Message-Id: <20210531130707.603616914@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130703.762129381@linuxfoundation.org> References: <20210531130703.762129381@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kyle Tso commit a20dcf53ea9836387b229c4878f9559cf1b55b71 upstream. If snk_vdo is not populated from fwnode, it implies the port does not support responding to SVDM commands. Not_Supported Message shall be sent if the contract is in PD3. And for PD2, the port shall ignore the commands. Fixes: 193a68011fdc ("staging: typec: tcpm: Respond to Discover Identity commands") Cc: stable Reviewed-by: Guenter Roeck Acked-by: Heikki Krogerus Signed-off-by: Kyle Tso Link: https://lore.kernel.org/r/20210523015855.1785484-3-kyletso@google.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/typec/tcpm/tcpm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -2410,7 +2410,10 @@ static void tcpm_pd_data_request(struct NONE_AMS); break; case PD_DATA_VENDOR_DEF: - tcpm_handle_vdm_request(port, msg->payload, cnt); + 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]);