Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp119126pxb; Tue, 2 Feb 2021 00:24:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJyVjJCZrc8OmzSMQlMymcht0ZSLhCnoiVekGXvoB/9hbbRcKP+VARwN9eWmDxfFUHVtH1Lu X-Received: by 2002:a50:eb81:: with SMTP id y1mr21967696edr.176.1612254293558; Tue, 02 Feb 2021 00:24:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612254293; cv=none; d=google.com; s=arc-20160816; b=TOiPUTDnOIfxad5PzCvARCuUbIgcnIG8IrebFs2D0V+4xyRTsWIEQi2+ZtDrX5jyMC VcZbLy8rjDpC+DAwJfag24VOggDBSjtv57j2+ElkLBTg+j06oWM6GChG5MY73IjBcPSH NG39EnaAgPnzqeA/wZQIkooRwIH0yCJb2sf0To/HN/kFz5/UU9vC7ggKTwr30dK3PlVi dp+6vnFtM1KLgh+5fD8DSHoE0fN6JH1ecVp/UJQnK/l9K0WGUWzJXIJUWiJil6Q7E2lC F7fkvbONvjYYEYd66trrRJ4QP2NtYS9hMttyUeeuJqR2m+yoKTMycMmWZs4ZjZkfypiT EJJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:ironport-sdr :ironport-sdr; bh=HSh3Weuelf6bsIpapJsQEV68kMe1+vr9m8CkZpzN0YY=; b=I0QF8A3DYBMczhbSp36trCAYc904yGtiA5ikLd+GhPbpD1zjsy/C1T18lDtPliUvUt XONxCzntKN0dQAME5j+yI2JXOMv8eNuNyjiVlB9NUB18EmhqNWfLUkideVx02YWaGR6g JUw9sz8wN8qx9Fp9569vb8SsBSPanC6J/KQZWOYyUsr+yHbN/S3fdM62HbYHYTatJNRi 8H9HLz1jX/VuDIP21JxixAimyyuQOKOo6D+VBd8d4BKGeetbPGrZKF6a3UiYLKc/orHU PeXk1oBh60ctpqAMwOd4ryoCIaiv7azePPjmUjreDO96NI5Azz9CByCq7rV0r0U1+x6L PCwA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y1si2282401edp.72.2021.02.02.00.24.29; Tue, 02 Feb 2021 00:24: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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232593AbhBBIXj (ORCPT + 99 others); Tue, 2 Feb 2021 03:23:39 -0500 Received: from mga05.intel.com ([192.55.52.43]:4860 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231324AbhBBIXW (ORCPT ); Tue, 2 Feb 2021 03:23:22 -0500 IronPort-SDR: TjiajcQu8hiWbokg6NvcsRgCRx6oi9x9GDItJ8GtCMocRS04jbVY/rH6YAXORY8cbzOuZegX2b XMABRm7vjbuw== X-IronPort-AV: E=McAfee;i="6000,8403,9882"; a="265649233" X-IronPort-AV: E=Sophos;i="5.79,394,1602572400"; d="scan'208";a="265649233" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2021 00:21:36 -0800 IronPort-SDR: WAnMADibO6TaXQ29FfB/fxgl6lF2DbEN/KLanN7lHaF/PIxH6zZ25JwiYMxZX4I1aInMm5UsN+ y3mv8IKyRBig== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,394,1602572400"; d="scan'208";a="479481555" Received: from kuha.fi.intel.com ([10.237.72.162]) by fmsmga001.fm.intel.com with SMTP; 02 Feb 2021 00:21:34 -0800 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Tue, 02 Feb 2021 10:21:33 +0200 Date: Tue, 2 Feb 2021 10:21:33 +0200 From: Heikki Krogerus To: Badhri Jagan Sridharan Cc: Guenter Roeck , Greg Kroah-Hartman , Kyle Tso , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] usb: typec: tcpm: Handle vbus shutoff when in source mode Message-ID: <20210202082133.GB1433721@kuha.fi.intel.com> References: <20210201100212.49863-1-badhri@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210201100212.49863-1-badhri@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 01, 2021 at 02:02:12AM -0800, 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: Heikki Krogerus > --- > 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. > -- > 2.30.0.365.g02bc693789-goog thanks, -- heikki