Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3864257pxb; Mon, 1 Feb 2021 06:40:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJwX0R57sVu2+lJDgeYQ/8bQ9vCF5577aB6KSdDqZ+azHZeX5KzmQ/HiEQqKypPPREnzRw6P X-Received: by 2002:aa7:d696:: with SMTP id d22mr6333084edr.361.1612190453123; Mon, 01 Feb 2021 06:40:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612190453; cv=none; d=google.com; s=arc-20160816; b=sBzZY1nGnWB/5hwL0nvfSqipcph15dUMdCSj7FfzajcpAofKqRZIDX3QbR3fomCWsJ JswOet/Sy9/Q8TQTzuF/zJhJjHu+G7WvbEL/g72EIEAcRf4cOnmwVllXEV6KUwSQH9OI UNbcnEOirIiDrFvdgwXjVoT73mF/8jP8ssRd6nHhMZpmiH9UagjtyW92B4CV4HXcOLDj KriQoUy4LgfUXRjSu/A7txEzi/Z6QnI/Kslk9jg5gtnoztIzPf6R5UdYh7ghRxCW6H6q rejZ0wlbLvl0ccuhwSwQeVNFyGFvL+lHVUMRVHhfAkbpi+KBXiiElinoti83q5qb4W8J tGBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:autocrypt:from :references:cc:to:subject:sender:dkim-signature; bh=qRIw2UXSxz3gUelPEgccuRXhCuVWqRdQACon+q1QLxs=; b=gxvGKYG/G//BBi06c8F3i/RAgnXpiHhWEtFEsPat4JntZl8ee7K7O7+r39yYxJ+q8k VpLmNCSanSzmrPLVhCRo/AsPB97cWGemSnmGv2vsNcMCSjg2hvwDzKyWLTjXghA2ydgc smP0G0odhCqGh2EnUF6ft2iKNBJfUnr4+bMtyBmNJxJs+5Yu9W436TdgEVXKmwQaF+Gm s6BLLj5ik7IUv+rq7c/uvDdO3/NKsGZAelnye1xl7CnfzRlmzvokjIT074prE+PDaumR 97Eq+BK4xfzb7OiuPLxLWiO5i15Zu/wU8Y2eKJHfnZLB0y5P6pLLtNbK5u2VTxnV1Elm RlBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=W2he0nEA; 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 m30si1001365edj.75.2021.02.01.06.40.28; Mon, 01 Feb 2021 06:40:53 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=W2he0nEA; 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 S230170AbhBAOjO (ORCPT + 99 others); Mon, 1 Feb 2021 09:39:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231270AbhBAOi6 (ORCPT ); Mon, 1 Feb 2021 09:38:58 -0500 Received: from mail-oi1-x234.google.com (mail-oi1-x234.google.com [IPv6:2607:f8b0:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC356C061756; Mon, 1 Feb 2021 06:38:17 -0800 (PST) Received: by mail-oi1-x234.google.com with SMTP id w8so18991173oie.2; Mon, 01 Feb 2021 06:38:17 -0800 (PST) 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=qRIw2UXSxz3gUelPEgccuRXhCuVWqRdQACon+q1QLxs=; b=W2he0nEAcgZWzr4RuFuP2Naboz9UGIJN08JOuXJB6AuGSD5Eti3o5PFazEeZLKCe5Q Clu/AlQ57jKyKFe8QW3IcHdNC2PaRoGrA/HDWIOKGVXonOdQOVeVUqNe+fBNHmjVeQJR nJpIqa4o9D7yRGpc9WmNSuJwP7b/hd04mvz3vaBi8t32z52Czi0TKznD0q7mGfjgN9tt NEzc8Z+ORcngo3dpnkKBpz1MSgWGUkX1KTqECNu+sv9SzmaCxttudWIPZY/sRw6B/Pi0 PaIPOSj+a41gL0WMq2TTB8sBa+2F6wMG1nxz2Qd4vkZAw4X43sdVqNb9k6anVzR+J99Q qTag== 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=qRIw2UXSxz3gUelPEgccuRXhCuVWqRdQACon+q1QLxs=; b=Lzov8gADjIdzdrqNK4yVQzOwNoC2Ho+AFDA/hcRN00yeCjVFwJ9EkcEP6k+/XjX0jC HvHOEx4SGRdrO3rOS5hoGm1Kx+3FP5AsISDqgUCTCTQ10sEn5RIoKX5Tbp9TmTOpET8A 0lBWrDxFUuZaMOLjGCsrK5ojsyA+n0D6MJjOR6tDEaMPUvaATe0cFP8vrgkopLNCsSqe 2Q2e5QjaWRV1Alsdbj52OYRYuZnVbS+yDd0cFRVcMxt1wxR69NvNA7Ht5cjx3BcfCOfV Hg++9ZjOzqpElMz5uRiR3BwrJ4VKUFOviJioy+2lFnOMwsSAriBG/rLDmXhymdaxMCHV nkvA== X-Gm-Message-State: AOAM533ELoLAVUGgoc9ESj778UY3OFsAEamTcy+pVxXZERQ/9ZsXylm+ NFw1KDTvs0eMMQ+7/wSvRLWz3ILEEGo= X-Received: by 2002:aca:54d6:: with SMTP id i205mr11026243oib.130.1612190296919; Mon, 01 Feb 2021 06:38:16 -0800 (PST) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id b17sm4435150oii.58.2021.02.01.06.38.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 01 Feb 2021 06:38:15 -0800 (PST) Sender: Guenter Roeck Subject: Re: [PATCH v1] usb: typec: tcpm: Handle vbus shutoff when in source mode To: Badhri Jagan Sridharan , Heikki Krogerus , Greg Kroah-Hartman , Kyle Tso Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210201100212.49863-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+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Cn7UG+qVWZeKEsFKFOkynOs3pVbcbq1pxbhk3TRWCGRU5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= Message-ID: <8336de0f-cad1-3f1c-c009-d7c592910ab3@roeck-us.net> Date: Mon, 1 Feb 2021 06:38:14 -0800 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: <20210201100212.49863-1-badhri@google.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/1/21 2:02 AM, Badhri Jagan Sridharan wrote: > While in source mode, vbus could be shutoff by protections > circuits. TCPM does not move back to toggling state to > re-initiate connection. Fix this by moving to SRC_UNATTACHED > state when vbus shuts off while in source mode. > > Signed-off-by: Badhri Jagan Sridharan Reviewed-by: Guenter Roeck > --- > drivers/usb/typec/tcpm/tcpm.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c > index 0afd8ef692e8..ff0732c12b8a 100644 > --- a/drivers/usb/typec/tcpm/tcpm.c > +++ b/drivers/usb/typec/tcpm/tcpm.c > @@ -4897,6 +4897,17 @@ static void _tcpm_pd_vbus_off(struct tcpm_port *port) > /* Do nothing, waiting for sink detection */ > break; > > + case SRC_STARTUP: > + case SRC_SEND_CAPABILITIES: > + case SRC_SEND_CAPABILITIES_TIMEOUT: > + case SRC_NEGOTIATE_CAPABILITIES: > + case SRC_TRANSITION_SUPPLY: > + case SRC_READY: > + case SRC_WAIT_NEW_CAPABILITIES: > + /* Force to unattached state to re-initiate connection */ > + tcpm_set_state(port, SRC_UNATTACHED, 0); > + break; > + > case PORT_RESET: > /* > * State set back to default mode once the timer completes. >