Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2128907imd; Fri, 2 Nov 2018 06:30:15 -0700 (PDT) X-Google-Smtp-Source: AJdET5dETqpUOiVbK34Z8tpI8Hsk6R7BoBZMvaWAM98JwXlrbQ3cHGZniZ8xT9Is5ctQQRluwa76 X-Received: by 2002:a63:ef47:: with SMTP id c7mr11102821pgk.386.1541165415940; Fri, 02 Nov 2018 06:30:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541165415; cv=none; d=google.com; s=arc-20160816; b=Ka3mGu5PGe6DOIsd8/C9SEgfZkAH/YEJ9sNbR2w2noUqXqwqee/AnHFYo66YYcqOWR C9Ddj3XHKXami8GFTQx5G0rfqXHKyD/vSDDMGFDr33J5LxkQN1ZRh2AQLebRXimezK1+ MD0iMEqzPBmOfAFmvdv49+5eoszKx+RPxKFXjOGnnKXnYmzhhkcDMAUNXBzZVQXg2AxK BS/4uNUkCM57XcI73BLmnOxhDpCC7E36HL78mS17/VsGjtr9BcpqHIgnSIOsVp4EvzUf sqxg5kkk0S8SQXZk+7oNqTMNnooKUw2ZF+SCnCqfUGXCyBQIyh0+9K1qDgw8gTZKMY1P nO0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=otkVPfEbgJ3psFdQS+QksBonZ7w0gbhwqBdLCeG5ll8=; b=gY4LtzyxVzUSV/abrYf+KVcsJVmfufsID2Gv+VXc9KBIun3pSt9Ex/9l8xnR3ZjVFj jxHxEiwn7PYnTZqwgTdTSiAkOfuqvkr35oF06iEDSqAf0z5u9XDGNVVp6hUTlZa7FDAs ZK9AcLuzCYlTedW7TDG0RnYdkmZE04+EuqyfHYDl5u6hzcS+EAHFxbRDWUIsb5OWm8Wr 74H4NZyFSHREIdDezMIkm6f1YkArdB08larng32XrRspV0XD0Mofj3J1O6knIoHBRN2/ 7e9jT4KSf/bKej8VIr4YcGZ/G0uLmHdyphxam6y9qx27zbpH8/W9ICvACJYm+Z5kFlQR sLkQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id w13-v6si33332995plq.198.2018.11.02.06.30.00; Fri, 02 Nov 2018 06:30:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727719AbeKBWgC (ORCPT + 99 others); Fri, 2 Nov 2018 18:36:02 -0400 Received: from mga03.intel.com ([134.134.136.65]:18950 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726026AbeKBWgC (ORCPT ); Fri, 2 Nov 2018 18:36:02 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Nov 2018 06:28:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,456,1534834800"; d="scan'208";a="104738383" Received: from kuha.fi.intel.com ([10.237.72.189]) by fmsmga001.fm.intel.com with SMTP; 02 Nov 2018 06:28:48 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Fri, 02 Nov 2018 15:28:47 +0200 Date: Fri, 2 Nov 2018 15:28:47 +0200 From: Heikki Krogerus To: Badhri Jagan Sridharan Cc: Rob Herring , Mark Rutland , Greg Kroah-Hartman , Chanwoo Choi , Andrzej Hajda , Li Jun , linux@roeck-us.net, jackp@codeaurora.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: Re: [PATCH v3 3/3] usb: typec: tcpm: charge current handling for sink during hard reset Message-ID: <20181102132847.GC6543@kuha.fi.intel.com> References: <20181001194501.58338-1-badhri@google.com> <20181001194501.58338-3-badhri@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181001194501.58338-3-badhri@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 01, 2018 at 12:45:01PM -0700, Badhri Jagan Sridharan wrote: > During the initial connect to a non-pd port, sink would hard reset > twice before deeming that the port partner is non-pd. TCPM sets the > the charge path to false during the hard reset. This causes unnecessary > connects/disconnects of charge path and makes port take longer to > charge from the non-pd ports. Avoid this by not setting the charge path > to false unless the partner has already identified to be pd capable. > > When partner is a pd port, set the charge path to false in > SNK_HARD_RESET_SINK_OFF. Set the current limits to default value based > of CC pull up and resume the charge path when port enters > SNK_HARD_RESET_SINK_ON. > > Signed-off-by: Badhri Jagan Sridharan Reviewed-by: Heikki Krogerus > -------- > Changes in V3: > Rebase on top of usb-next > > Changes in V2: > Based on feedback of jackp@codeaurora.org > - vsafe_5v_hard_reset flag from tcpc_config is removed > - Patch only differentiates between pd port partner and non-pd port > partner > > V1 version of the patch is here: > https://lkml.org/lkml/2018/9/14/11 > --- > drivers/usb/typec/tcpm/tcpm.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c > index c3ac0e46106b..c25a69922ee6 100644 > --- a/drivers/usb/typec/tcpm/tcpm.c > +++ b/drivers/usb/typec/tcpm/tcpm.c > @@ -3273,7 +3273,8 @@ static void run_state_machine(struct tcpm_port *port) > case SNK_HARD_RESET_SINK_OFF: > memset(&port->pps_data, 0, sizeof(port->pps_data)); > tcpm_set_vconn(port, false); > - tcpm_set_charge(port, false); > + if (port->pd_capable) > + tcpm_set_charge(port, false); > tcpm_set_roles(port, port->self_powered, TYPEC_SINK, > TYPEC_DEVICE); > /* > @@ -3305,6 +3306,12 @@ static void run_state_machine(struct tcpm_port *port) > * Similar, dual-mode ports in source mode should transition > * to PE_SNK_Transition_to_default. > */ > + if (port->pd_capable) { > + tcpm_set_current_limit(port, > + tcpm_get_current_limit(port), > + 5000); > + tcpm_set_charge(port, true); > + } > tcpm_set_attached_state(port, true); > tcpm_set_state(port, SNK_STARTUP, 0); > break; > -- > 2.19.0.605.g01d371f741-goog thanks, -- heikki