Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751316AbdH0RXp (ORCPT ); Sun, 27 Aug 2017 13:23:45 -0400 Received: from bh-25.webhostbox.net ([208.91.199.152]:47634 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751182AbdH0RXo (ORCPT ); Sun, 27 Aug 2017 13:23:44 -0400 Date: Sun, 27 Aug 2017 10:23:42 -0700 From: Guenter Roeck To: Badhri Jagan Sridharan Cc: Greg Kroah-Hartman , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 07/11] staging: typec: tcpm: Consider port_type while determining unattached_state Message-ID: <20170827172342.GP22819@roeck-us.net> References: <20170827063254.32297-1-Badhri@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170827063254.32297-1-Badhri@google.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Authenticated_sender: guenter@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: guenter@roeck-us.net X-Authenticated-Sender: bh-25.webhostbox.net: guenter@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1908 Lines: 56 On Sat, Aug 26, 2017 at 11:32:54PM -0700, Badhri Jagan Sridharan wrote: > While performing PORT_RESET, upon receiving the cc disconnect > signal from the underlaying tcpc device, TCPM transitions into > unattached state. Consider, the current type of port while determining stray ,; not really worth a resend. > the unattached state. > > In the below logs, although the port_type was set to sink, TCPM > transitioned into SRC_UNATTACHED. > > [ 762.290654] state change SRC_READY -> PORT_RESET > [ 762.324531] Setting voltage/current limit 0 mV 0 mA > [ 762.327912] polarity 0 > [ 762.334864] cc:=0 > [ 762.347193] pending state change PORT_RESET -> PORT_RESET_WAIT_OFF @ 100 ms > [ 762.347200] VBUS off > [ 762.347203] CC1: 2 -> 0, CC2: 0 -> 0 [state PORT_RESET, polarity 0, disconnected] > [ 762.347206] state change PORT_RESET -> SRC_UNATTACHED > > Signed-off-by: Badhri Jagan Sridharan Reviewed-by: Guenter Roeck > --- > drivers/staging/typec/tcpm.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c > index 0ae33330a5c7..645f43ee83df 100644 > --- a/drivers/staging/typec/tcpm.c > +++ b/drivers/staging/typec/tcpm.c > @@ -2117,10 +2117,16 @@ static inline enum tcpm_state ready_state(struct tcpm_port *port) > > static inline enum tcpm_state unattached_state(struct tcpm_port *port) > { > - if (port->pwr_role == TYPEC_SOURCE) > + if (port->port_type == TYPEC_PORT_DRP) { > + if (port->pwr_role == TYPEC_SOURCE) > + return SRC_UNATTACHED; > + else > + return SNK_UNATTACHED; > + } else if (port->port_type == TYPEC_PORT_DFP) { > return SRC_UNATTACHED; > - else > - return SNK_UNATTACHED; > + } > + > + return SNK_UNATTACHED; > } > > static void tcpm_check_send_discover(struct tcpm_port *port) > -- > 2.14.1.342.g6490525c54-goog >