Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2444044rdb; Thu, 21 Sep 2023 20:58:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IELHAmCAZ8Bmy1CHhNRqFakXEGRf7pwPfAQxIFznlLTYCqgv+PttoUIunqGanmjSDIHOZe/ X-Received: by 2002:a05:6358:919c:b0:141:3a1:1877 with SMTP id j28-20020a056358919c00b0014103a11877mr7298728rwa.14.1695355117527; Thu, 21 Sep 2023 20:58:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695355117; cv=none; d=google.com; s=arc-20160816; b=RnRMAz68F+4HJXhJQcgJBpmWgoxjMMQKwL4Q1B5ZcCXxc6LTWiDP3gDu8gYXhNOjFZ k+Z+TwPlX1PCEsMVx6FLvpqn8bO1JnTNJFs1LmO9SnK0q1L9fRHHj94o6t+0syRibj8B ZQz8F+JFyaeBUi25SiLa1cU86NhAqc76EVp10EJBKKBQ3yoo+WHXy6IwwyuBG77TtZuF k7f1Kb7j3CEwjKWS/zQIipKVU7x7Xx7LC6i/CC47gq0BPtSiE1hMX0EXMb9shhR8RAFn sSH7BwiRmg8GL7ggJGx1aLOw0JsUar/3OREq16q/y5V7zj1x7qSZrzk1N+MkJPz/LZP5 i97w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:sender:dkim-signature; bh=M9HdsDbH7/BYH1yt3a5xJbh+tKoPnezjQwqx5ecLr6A=; fh=j9fLzuI7DRqg1xrAYzBxhfocNvjM8MHI1eWPy80pBU4=; b=o37xxUx6XQZHuGCKlZoaDt1PAxg48GNhVUOz6Qt5zPsdWaJYA3nrhjQKHakAy3Ungu 78blybWfwoaqEwxudeOMr4hHShEVM585sQFdNphzSE4e3YJioAIlUDz6A/0WKByc7xyD NYOLIFdR/kw92OVKrzferg4GFN3jNCSB/CkPjYAEArie3fP1nLDuqF5TJ2OTy6LlkwdM kFNOq8L30d2rTC7JpQy7gy6Yia//wLCWXzdJXSdnjlfnNGnvm3gl1WG1GAZ0a0wNnu0B QWx23VyZVVa266mRrvujfCLYyQJW2DO9uL9tEGKUxymYMWczoZMFoLRxJSNJAxbPLgcz G1YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=nMxdaYdO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id l12-20020a63da4c000000b00565f0e91894si2922682pgj.394.2023.09.21.20.58.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 20:58:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=nMxdaYdO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id A94C5823F4D7; Thu, 21 Sep 2023 14:11:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232290AbjIUVLp (ORCPT + 99 others); Thu, 21 Sep 2023 17:11:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233455AbjIUVKy (ORCPT ); Thu, 21 Sep 2023 17:10:54 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0A331EC29; Thu, 21 Sep 2023 13:39:48 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1c364fb8a4cso12856295ad.1; Thu, 21 Sep 2023 13:39:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695328788; x=1695933588; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=M9HdsDbH7/BYH1yt3a5xJbh+tKoPnezjQwqx5ecLr6A=; b=nMxdaYdOqHw5sIaJaUL6nsLFOOPkFDdvX84JSuAozb10hOYpWDDg71aXZM8VW4MDmY kMN7zrTWC/qk4mfce7b88rWT3YmfuwH5ePTX1m3b7F6vy9waJd/MuQ7+gC3zEzZYyzBl Qj74BssfYnTPyqfYbtvqmVVtcpQEW1YUenmffQzx5o4OZnXkQC2fc8MKei8IA7wceSg1 Lb3T1rFYJ1KvkGD77Pc9/P/V2Cy5mOxI3WhVLgGl55v+rZtMoo1VGqF4GDumqjEvD7mA dw/W4DTKzRKJHejt4kv08yNzX4Oa9PdU3MYa5ce8zIKlAkm4RgJUxv3xVdxvGD/uzAYV CQbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695328788; x=1695933588; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=M9HdsDbH7/BYH1yt3a5xJbh+tKoPnezjQwqx5ecLr6A=; b=knCfW5FWVJjRt/aSLWSjw11XPP0sPC4kX/b+p+XOlNlwMOytx9vHE5FeMD//NVigJE q/gyz4wHrq5M5Aoo7SSa6zx0JXk5LbHsuQuodpQaHQobmwMVQhUp/Kmvuh0gPzw9QuCa AfnVRbiZ6bPuk62PQnjj6zwsTqYke/LgJYaDiMk30UNjs8vOkDyLHJSuPJtiJElz/ar/ l4a5TQTWccfHBicl55IBTo3isbfMFpFeQukr0EQfDZt1pVeqN1l4GY5MDd0fhTmQzabD SBJqIRjugVjj8G2mkbLaMUyowkgQq3/kcmQaIG6CQiAB8+jxoSTC0/m4HpE4idFJR2IP QVIw== X-Gm-Message-State: AOJu0YyM3MOS6NnMaSnCs4KnDkp+RxdQUiSzCQwTLu0ZevQOJ6qsapsk rcCEG/eTv/OkRMCgcR7DkTDEdpHmCVo= X-Received: by 2002:a17:903:11cf:b0:1c1:f6d1:3118 with SMTP id q15-20020a17090311cf00b001c1f6d13118mr7273168plh.27.1695328788371; Thu, 21 Sep 2023 13:39:48 -0700 (PDT) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id l20-20020a170903005400b001bc18e579aesm1966828pla.101.2023.09.21.13.39.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 Sep 2023 13:39:47 -0700 (PDT) Sender: Guenter Roeck Message-ID: <82429728-7158-ed85-975e-55739de217cb@roeck-us.net> Date: Thu, 21 Sep 2023 13:39:46 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [RESEND v2] usb:typec:tcpm:support double Rp to Vbus cable as sink Content-Language: en-US To: Michael Wu , heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230920063030.66312-1-michael@allwinnertech.com> From: Guenter Roeck In-Reply-To: <20230920063030.66312-1-michael@allwinnertech.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.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 (morse.vger.email [0.0.0.0]); Thu, 21 Sep 2023 14:11:48 -0700 (PDT) On 9/19/23 23:30, 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: Guenter Roeck > --- > 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)