Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp65435pxa; Mon, 10 Aug 2020 18:52:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwp0AMIhC4BkBE+uOjZyh/saW2ur3HylDWHe4Y827NqiHuNVBidzMx9mE5By+pRCEkc46J X-Received: by 2002:a17:906:cc51:: with SMTP id mm17mr24840093ejb.137.1597110775964; Mon, 10 Aug 2020 18:52:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597110775; cv=none; d=google.com; s=arc-20160816; b=pIjOHXFzTxRTvUP5T4kLKC6qkAOJPrdZrBV3b3tRkhSPcZdKY94JvVIPG2PXRckluD QjR4D3lfwQ/KHvCBJJ7covC94pCGyOqMB6I9C0k0CbXh47Td/E0MMHeIk5WchuJojqQF ahv2D+tnzEhw4681+FX4R/Qcu82AYYRdlUEHU7J55n7+Vn9pa0OH91bxsCY53C/9NwNT uy1/5n0laavJqC1fhkDSw1cNE7u7U71TJ/J/yz2tmgYNY2i25Ut5Ux3z2LZiWpSjHieM eRNCzQ8poya64pXl+u1K+z45OOR3+enx+lZeZkObzboS1AX4bdG2KyPjA26BQ6fJu5Vg OWIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject:dkim-signature; bh=cQifSZOziOnvUK04OfVsd2hJ+niYunqai4Bzh6MMUq4=; b=tocW9C21dQJ+PIFEBYPSHoOlAq4lJ9Ns5iTNc4+TiyW0krEL5QjXQ6ItTtLywOl/TQ uD/uTe3sEDiaoWccvKpoN/ovfyjlwSxq9wwPCAGQ6lpVs6Sop7f16uofIr3nEQBl439J m6+PByPlDMdr4FD8Vv3syULRwK02Y5t4N188eodaVC2YmmvadZmycUNcTGmyd9LvmqCx T4wYFOSgpIXXByfleL98VJrbWrPcQHK3yNb6kYxYFAZpyU8THUOF52C6SwW+KFaDrZIk Mettc9On9tgdJPv71FJmpbitW2Lhgau/vUML+lj/yiJ5g56qNN/pyQZSrzfFkLgHOSsl qMvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=GpMKX9Qs; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l7si11363412eja.172.2020.08.10.18.52.33; Mon, 10 Aug 2020 18:52:55 -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=fail header.i=@gmail.com header.s=20161025 header.b=GpMKX9Qs; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728172AbgHKBvO (ORCPT + 99 others); Mon, 10 Aug 2020 21:51:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728046AbgHKBvN (ORCPT ); Mon, 10 Aug 2020 21:51:13 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CADAAC06174A; Mon, 10 Aug 2020 18:51:13 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id m71so6351614pfd.1; Mon, 10 Aug 2020 18:51:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=cQifSZOziOnvUK04OfVsd2hJ+niYunqai4Bzh6MMUq4=; b=GpMKX9QsiJdKjPn5Jj//JsC4RG82dGOsZkU3qkonR198ZambfctqGxjsjdodfw/kQO pLAAfP7eLrnhcD4SxAj/z9wbio5EjQzjWODNhFd/wMi05guYpCytbPAgboVRm7g1ohrp VbnN+QiotDhkWqseLUA4G7I6pEvt3xKgpA7WIrNNqINoYX+8WFB6kasctuEa22zgrKmX tCEUcsHIaRoOq/W4Ex5mMsxmRB+OTYSCPrV4nyrGRMWN62wvYdNon2a5VfykeliVt7Pc P+0r5CsSMMwCywWgvUDXXKaxPWSqk/E3U/E5TxCJvaEkhrriy85o2h7X1gbKDf0GXA+U 2zWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=cQifSZOziOnvUK04OfVsd2hJ+niYunqai4Bzh6MMUq4=; b=XfdwdQqE4gaKRWz/9TUCmdL9OgX7QyRPyVME4NNi9MgJuBoTrNUKIA2jso9Y2Qba6U 7N4c2qOZk8iX/mJwTPoXRiH1z0bkXwCLvS1SlfpQ5rGsetMxPPyeh+jeT5mlPiySuEhv qNOyFNMF/qYKKFRCh/drcEcEImCmu/jrBzakgvzdwb13G7F19g7SeCABAgo9x+zlbF1M SWyOZtqXXH1aTAVkfcau7yx8hSAchjQKE3/17gQ6cDh0OwzSyn32lHLJgF1liJny2WBZ 82z907aczpqqn8Wyi8i0cZHyFY+pX9r4C4ecSRSjLTiX90pnMs1q8Va1q9TN254KnIXx qSEQ== X-Gm-Message-State: AOAM532QfsJ/5VJO+w7Ajepbr13CT9K7pkj1l2EjhQg04cbRDUHcwtlF NCmoEbTAuWiqPlGgQ4IiLc9Z4K9Y X-Received: by 2002:aa7:8743:: with SMTP id g3mr3830918pfo.76.1597110673022; Mon, 10 Aug 2020 18:51:13 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id h1sm24700567pfr.39.2020.08.10.18.51.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 10 Aug 2020 18:51:12 -0700 (PDT) Subject: Re: [PATCH v1] usb: typec: tcpm: Fix TDA 2.2.1.1 and TDA 2.2.1.2 failures To: Badhri Jagan Sridharan , Heikki Krogerus , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org References: <20200811011126.130297-1-badhri@google.com> From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB9lN5WTLRKSO7wICuLiSz5WZHXMkyF4d+/O5ll7yz/o/JxK5vO/sduYDIlFTvBZDh gzaEtNf5tQjsjG4io8E0Yq0ViobLkS2RTNZT8ICq/Jmvl0SpbHRvYwa2DhNsK0YjHFQBB0FX IdhdUEzNefcNcYvqigJpdICoP2e4yJSyflHFO4dr0OrdnGLe1Zi/8Xo/2+M1dSSEt196rXaC kwu2KgIgmkRBb3cp2vIBBIIowU8W3qC1+w+RdMUrZxKGWJ3juwcgveJlzMpMZNyM1jobSXZ0 VHGMNJ3MwXlrEFPXaYJgibcg6brM6wGfX/LBvc/haWw4yO24lT5eitm4UBdIy9pKkKmHHh7s jfZJkB5fWKVdoCv/omy6UyH6ykLOPFugl+hVL2Prf8xrXuZe1CMS7ID9Lc8FaL1ROIN/W8Vk BIsJMaWOhks//7d92Uf3EArDlDShwR2+D+AMon8NULuLBHiEUQARA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kynOs3pVbcbq1pxbhk3TRWCGRU5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= Message-ID: Date: Mon, 10 Aug 2020 18:51:10 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200811011126.130297-1-badhri@google.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/10/20 6:11 PM, Badhri Jagan Sridharan wrote: >>From the spec: > "7.1.5 Response to Hard Resets > Hard Reset Signaling indicates a communication failure has occurred and > the Source Shall stop driving VCONN, Shall remove Rp from the VCONN pin > and Shall drive VBUS to vSafe0V as shown in Figure 7-9. The USB connection > May reset during a Hard Reset since the VBUS voltage will be less than > vSafe5V for an extended period of time. After establishing the vSafe0V > voltage condition on VBUS, the Source Shall wait tSrcRecover before > re-applying VCONN and restoring VBUS to vSafe5V. A Source Shall conform > to the VCONN timing as specified in [USB Type-C 1.3]." > > Signed-off-by: Badhri Jagan Sridharan > --- > drivers/usb/typec/tcpm/tcpm.c | 16 +++++++++++++--- > 1 file changed, 13 insertions(+), 3 deletions(-) > > diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c > index 3ef37202ee37..e41c4e5d3c71 100644 > --- a/drivers/usb/typec/tcpm/tcpm.c > +++ b/drivers/usb/typec/tcpm/tcpm.c > @@ -3372,13 +3372,19 @@ static void run_state_machine(struct tcpm_port *port) > tcpm_set_state(port, SNK_HARD_RESET_SINK_OFF, 0); > break; > case SRC_HARD_RESET_VBUS_OFF: > - tcpm_set_vconn(port, true); > + /* > + * 7.1.5 Response to Hard Resets > + * Hard Reset Signaling indicates a communication failure has occurred and the > + * Source Shall stop driving VCONN, Shall remove Rp from the VCONN pin and Shall > + * drive VBUS to vSafe0V as shown in Figure 7-9. > + */ > + tcpm_set_vconn(port, false); > tcpm_set_vbus(port, false); > tcpm_set_roles(port, port->self_powered, TYPEC_SOURCE, > tcpm_data_role_for_source(port)); > - tcpm_set_state(port, SRC_HARD_RESET_VBUS_ON, PD_T_SRC_RECOVER); I am a bit concerned about this. If I understand correctly, it means that we won't turn VBUS back on unless a SRC_HARD_RESET_VBUS_OFF PD event is received. Is that correct ? What happens if that event is never received ? Thanks, Guenter > break; > case SRC_HARD_RESET_VBUS_ON: > + tcpm_set_vconn(port, true); > tcpm_set_vbus(port, true); > port->tcpc->set_pd_rx(port->tcpc, true); > tcpm_set_attached_state(port, true); > @@ -3944,7 +3950,11 @@ static void _tcpm_pd_vbus_off(struct tcpm_port *port) > tcpm_set_state(port, SNK_HARD_RESET_WAIT_VBUS, 0); > break; > case SRC_HARD_RESET_VBUS_OFF: > - tcpm_set_state(port, SRC_HARD_RESET_VBUS_ON, 0); > + /* > + * After establishing the vSafe0V voltage condition on VBUS, the Source Shall wait > + * tSrcRecover before re-applying VCONN and restoring VBUS to vSafe5V. > + */ > + tcpm_set_state(port, SRC_HARD_RESET_VBUS_ON, PD_T_SRC_RECOVER); > break; > case HARD_RESET_SEND: > break; >