Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp302808pxf; Thu, 18 Mar 2021 00:00:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlEo8lznGS0RRpfvjoTJ9d+RAFp9/wh3B+yovkiGU1icnnzxL/27ECmYiCAPPD6HKPKQ+r X-Received: by 2002:aa7:d445:: with SMTP id q5mr1747465edr.382.1616050828634; Thu, 18 Mar 2021 00:00:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616050828; cv=none; d=google.com; s=arc-20160816; b=JQ1N583ABB9x3sdZSkUjtBnWzzgiMAWDEIe4No1/I578z0aA4FBsD9OZFWO58SjYGD 1JA8P7tvAKrjHemwHdGIYhCM3Ewt0csrm5v+W+xtVzrKsawwi9LsjnbAuyqzKjsbe9y3 kY68VQRJNXaAtNlrLes1fdDZW7Ryc87TLjKM4XYOQp97jQ7b/OATDrkTanGYuXvt9PBy IsAFtOgR9DB7xZBzLLBeK3B8yWh1kGUbL7nLsAZL4BIkGgmvG0JjVldbn6exuhM2RYO1 EzHakw8oyNNPB6aqAeP0glzXfokeO8wR7mI12uKoQoVWicN1S9bDVKpN6/msx3rLFFH9 bbzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:from:subject :mime-version:message-id:date:dkim-signature; bh=8f2GKIzq0FyXnU+AW5A6Hbsc9cchKFSkjsCGCUulBbg=; b=h8Ju/nfbE/mBYQRR8mxjUTTAHrkvQoIBCZbiQY1C2Qil0keGr2hTcJQ3AHGP4S1OdB 6Tjjzyw0m3o7HMZNqvNhh6y3ulRdazfgePmA0CfFuEk4erAx5vc7U19GZK/xVpii8K+f i60VIOeS/dlE/KSSE7qSpsYUL9kVU8ZA9vxL47mFyQNdNjBlRz03YbYyRLw6DAlkGGvH I28am06BvjKMCjv6iahzCTcMB8mNVeiMgMFoG+Qt69BTHHvz5d5OoY17o48lYMQ8oh7T yrp0t1NVKZmwZ2I38DCGw1GmWiiOCLBm9YcJsBu+Zv08nFbSwjsf+I+yQauAtxe7Ddbf gQmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ZRkpKE8Y; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u4si952416ejy.135.2021.03.18.00.00.05; Thu, 18 Mar 2021 00:00:28 -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=@google.com header.s=20161025 header.b=ZRkpKE8Y; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229780AbhCRG4T (ORCPT + 99 others); Thu, 18 Mar 2021 02:56:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229734AbhCRG4J (ORCPT ); Thu, 18 Mar 2021 02:56:09 -0400 Received: from mail-qk1-x749.google.com (mail-qk1-x749.google.com [IPv6:2607:f8b0:4864:20::749]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FAE3C06174A for ; Wed, 17 Mar 2021 23:56:08 -0700 (PDT) Received: by mail-qk1-x749.google.com with SMTP id b136so7764029qkc.20 for ; Wed, 17 Mar 2021 23:56:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc :content-transfer-encoding; bh=8f2GKIzq0FyXnU+AW5A6Hbsc9cchKFSkjsCGCUulBbg=; b=ZRkpKE8YKlxqollKBzPwMKOT/KrbDPDRJmSo0mf4L+3SY19Q2tUxE2fuYYSkQ1Tom+ A9LdKsBLmnyq3t2SuWaz3P6t1g40m5SqcAfNuisDOREHLY3IJ0whhNYyIPS6G+qszLFs OX0uJbD4k5QzTube3BYADfDrWFq8h6LgdTiz+rTKI0sRZfXHP1GbBHu4p8y+OPqMVRPv txzKOGz8BszMhbD99/V90BOlRmeYH2hLUH1+ZhlwzlpWdcnLiidWrSqPKF2xF78eMj61 3JAs04Z2DCjv1lbhddcFVpR80yQgcidQFw3COpH69HwuVXZIV9E+N8qKabalRgfe9ErG XtlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc :content-transfer-encoding; bh=8f2GKIzq0FyXnU+AW5A6Hbsc9cchKFSkjsCGCUulBbg=; b=DXJMUvJh94KAnrcA2Xq3EgAKXl1tjtLljUNV1x4mbLf7ZCfxt78PO6bvVu5RWWXsWI CYVu3t9vNIFStPFi1qODQiAfCpbBldr23taxGdRylBWxGaBuMPxZqQnuxC6S0lqAB/SF HAvAb0DzEQEQFy65IYG6NvDiJEzQo/RIG2iBMKjgdO+0ph9aQz2wIBR2v39noy54Okyp Z/TZhzj0m/AOYOesY18TYgeNQiYZnpXwU+S5CjXxd3Pt8WoHYvKCwmR17wtxjIkoqfe8 6jLX93ZU4wFGJahkBvk2dR+N1AKmsHe7dcsVLCgwuS1qjSnjosT9FpVaRRpkstpcGmip LQVw== X-Gm-Message-State: AOAM532mFikVnCD1uERBui9l5BXhcPxQUhle+bbzof2RWbnGe7v2ZRZj Wwqx9M80ppakFrbXmZv+uJTrKkFIQzw= X-Received: from badhri.mtv.corp.google.com ([2620:15c:211:201:dc6b:2250:2aa4:b316]) (user=badhri job=sendgmr) by 2002:a05:6214:20a1:: with SMTP id 1mr2870609qvd.30.1616050567713; Wed, 17 Mar 2021 23:56:07 -0700 (PDT) Date: Wed, 17 Mar 2021 23:56:04 -0700 Message-Id: <20210318065604.3757307-1-badhri@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog Subject: [PATCH v1] usb: typec: tcpm: PD3.0 sinks can send Discover Identity even in device mode From: Badhri Jagan Sridharan To: Guenter Roeck , Heikki Krogerus , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Badhri Jagan Sridharan Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From 6.4.4.2 Structured VDM: =E2=80=A2 Either Port May be an Initiator of Structured VDMs except for the= Enter Mode and Exit Mode Commands which Shall only be initiated by the DFP." The above implies that when PD3.0 link is established PD3.0 sinks can send out discover identity command/AMS once PD negotiation is done. This allows discovering identity for PD3.0 UFP ports as well. Signed-off-by: Badhri Jagan Sridharan --- drivers/usb/typec/tcpm/tcpm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index 11d0c40bc47d..410856ec1702 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -3653,8 +3653,8 @@ static inline enum tcpm_state unattached_state(struct= tcpm_port *port) =20 static void tcpm_check_send_discover(struct tcpm_port *port) { - if (port->data_role =3D=3D TYPEC_HOST && port->send_discover && - port->pd_capable) + if ((port->data_role =3D=3D TYPEC_HOST || port->negotiated_rev > PD_REV20= ) && + port->send_discover && port->pd_capable) tcpm_send_vdm(port, USB_SID_PD, CMD_DISCOVER_IDENT, NULL, 0); port->send_discover =3D false; } --=20 2.31.0.rc2.261.g7f71774620-goog