Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2831271rdb; Fri, 22 Sep 2023 09:27:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE90j/dvmBOxfTtiQkdPgfKeFk48H49EmR1Q1S2G2tDa9BLNZ//xa5Yy+fuVtgd6GrtOXTP X-Received: by 2002:a17:902:d48f:b0:1c0:c640:3f3e with SMTP id c15-20020a170902d48f00b001c0c6403f3emr10623933plg.42.1695400022705; Fri, 22 Sep 2023 09:27:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695400022; cv=none; d=google.com; s=arc-20160816; b=JF/2GICY+w+sm2PRK7r//cGZP7wUSUf/IlaVPNqjDPGAEofFnxMTrRL8pFvRrmXTxy Ygo8bU8IwvYP+xG2Z0PCGvzG4wvhGlSb63ZJwozgVm/OPgX78Ssime4l4GwjC1OEAvV7 2IzYzGGvom3lROITruDfQTsvfP18WZp3vHPKXzTLnLne0qFLrp9h1PvNhQtN6MDdO2JH uoIP13i7nDyB0PihDrA2VqCGiRU9TVVQAWsatFkOnQ2yIJk4YG0WAT/Bz4OEcR7Nd7D2 LQx5+xdjhuGXfz3O4fcGG20agxjwxOkLi3GmTftXshQHF5zUQMSSbA2/93O1q32n7AG1 B9nA== 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:dkim-signature; bh=Y+KRGHSZP+oowKZdnb3efi6cLw3hvSmm7DRa1rByzhU=; fh=Ud1JS9nXVkJYi7ZoANfeo/NBtOWUNR+KzQ5xJ3I1hM4=; b=gD5x3ISnzyM+NvaAJ8Wp2yeDKfY+C4FW/1DvoP5+BSERdSDvh68n8+iCHhn3z2xcUF 2CpD7QNPTH5+56NAwjo2WhEjDBVCQ/TMpH7ntTHOQzJbP6n89mPDmyXgEhuSdBqaxrBT E7nqMg8LkrmC1jZ9Tbh8vA7tcfcx7L8W6PwYmXoNnzr6SF/VXK0zIUuNYnoROWSPloPt nSx53IcK00F+vP58yE/2O82gdrTvxVPVq1ndmNmsx+DowmSVmHT+FqL49cSZtA2jJjG8 dolDq76/6WisRiio+9fZD3kGmQ8AGznDoXlt/oHJB1xUnyS12sWn7VfKC0/gRufNHQ5h +2iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=a9DZ3MoD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id l12-20020a170903244c00b001bbb6f4cd6dsi4490788pls.334.2023.09.22.09.27.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 09:27:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=a9DZ3MoD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id AB6208399764; Fri, 22 Sep 2023 03:53:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233460AbjIVKxx (ORCPT + 99 others); Fri, 22 Sep 2023 06:53:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229564AbjIVKxv (ORCPT ); Fri, 22 Sep 2023 06:53:51 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96106C2; Fri, 22 Sep 2023 03:53:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695380025; x=1726916025; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=gh+iGFfn3Us/xv2NrPwWywq7/uM80gChhhpRj60ApIg=; b=a9DZ3MoD/Fhw8+cmY1UThm1F736A59GBCwCzjh6pxrPovR5TmpaW00zS +OOvlgGnpvT1X9tL/Jo/MUMQudz3nySeHjswvO8mlOD8Twrz4INST4Sj8 /U6dmBCICHYMJkVtIL83QXQM/UajIbTWXSIYNXyyR6SnvW0vy32WRHIJN gI9ULaoBoNFuIPDsJdJKfIKAm45mHZ8DDRohKyGg+Kleug/G4TWJnVpnR uiD8JUiI5ctmHsUOsZ78gCTL4BdjRnfk5Ytihm0tdrk6FSoAT6tmnw/s1 dMOvFYYUg9lKPuvrSnmt2WutWPumkAWdRurpZc+oNc9+Xxr5qLppE319K g==; X-IronPort-AV: E=McAfee;i="6600,9927,10840"; a="384633962" X-IronPort-AV: E=Sophos;i="6.03,167,1694761200"; d="scan'208";a="384633962" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2023 03:53:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10840"; a="871207597" X-IronPort-AV: E=Sophos;i="6.03,167,1694761200"; d="scan'208";a="871207597" Received: from kuha.fi.intel.com ([10.237.72.185]) by orsmga004.jf.intel.com with SMTP; 22 Sep 2023 03:53:42 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Fri, 22 Sep 2023 13:53:41 +0300 Date: Fri, 22 Sep 2023 13:53:41 +0300 From: Heikki Krogerus To: Michael Wu Cc: linux@roeck-us.net, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RESEND v2] usb:typec:tcpm:support double Rp to Vbus cable as sink Message-ID: References: <20230920063030.66312-1-michael@allwinnertech.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230920063030.66312-1-michael@allwinnertech.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Fri, 22 Sep 2023 03:53:53 -0700 (PDT) On Wed, Sep 20, 2023 at 02:30:30PM +0800, Michael Wu wrote: > The USB Type-C Cable and Connector Specification defines the wire > connections for the USB Type-C to USB 2.0 Standard-A cable assembly > (Release 2.2, Chapter 3.5.2). > The Notes says that Pin A5 (CC) of the USB Type-C plug shall be connected > to Vbus through a resister Rp. > However, there is a large amount of such double Rp connected to Vbus > non-standard cables which produced by UGREEN circulating on the market, and > it can affects the normal operations of the state machine easily, > especially to CC1 and CC2 be pulled up at the same time. > In fact, we can regard those cables as sink to avoid abnormal state. > > Message as follow: > [ 58.900212] VBUS on > [ 59.265433] CC1: 0 -> 3, CC2: 0 -> 3 [state TOGGLING, polarity 0, connected] > [ 62.623308] CC1: 3 -> 0, CC2: 3 -> 0 [state TOGGLING, polarity 0, disconnected] > [ 62.625006] VBUS off > [ 62.625012] VBUS VSAFE0V > > Signed-off-by: Michael Wu Reviewed-by: Heikki Krogerus > --- > v1 -> v2: Simplify expression and add a comment to the code. > > drivers/usb/typec/tcpm/tcpm.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > Signed-off-by: Michael Wu > --- > drivers/usb/typec/tcpm/tcpm.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c > index d962f67c95ae6..6e843c511b856 100644 > --- a/drivers/usb/typec/tcpm/tcpm.c > +++ b/drivers/usb/typec/tcpm/tcpm.c > @@ -517,9 +517,9 @@ static const char * const pd_rev[] = { > ((cc) == TYPEC_CC_RP_DEF || (cc) == TYPEC_CC_RP_1_5 || \ > (cc) == TYPEC_CC_RP_3_0) > > +/* As long as cc is pulled up, we can consider it as sink. */ > #define tcpm_port_is_sink(port) \ > - ((tcpm_cc_is_sink((port)->cc1) && !tcpm_cc_is_sink((port)->cc2)) || \ > - (tcpm_cc_is_sink((port)->cc2) && !tcpm_cc_is_sink((port)->cc1))) > + (tcpm_cc_is_sink((port)->cc1) || tcpm_cc_is_sink((port)->cc2)) > > #define tcpm_cc_is_source(cc) ((cc) == TYPEC_CC_RD) > #define tcpm_cc_is_audio(cc) ((cc) == TYPEC_CC_RA) > -- > 2.29.0 -- heikki