Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp15832901rwd; Mon, 26 Jun 2023 01:50:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6QSwulSKNEB2sXtEpTKFSmJnEY7UHzVJBGuz2oojOH+2wLvYpZxwQY0XQGdl3ZId0B3kp2 X-Received: by 2002:a17:902:f682:b0:1ac:6b92:70c8 with SMTP id l2-20020a170902f68200b001ac6b9270c8mr8317653plg.48.1687769433508; Mon, 26 Jun 2023 01:50:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687769433; cv=none; d=google.com; s=arc-20160816; b=sqC7JUfctKApPJBOe88hqjhTBT3Hdc9J5VCWkcxt8Y1IdbwzJx2Jk7y0/A40feeQg7 nh6nrSzpTq9/lCMrWv98Ql0fumf8D7ZuaHZsbr7EOzpmEKslQ9ZZLvoX6oSNoUmmZOfb +LLDILoEwd165IxD6O36Q1yAqb6eHy+ZpJBEq7iJe6VhP7XXKGNxpb9Y4jxhy+a1dfTF i+z/mFzawcIm2YvZ5zS5Dil3kQhOrAqX86Z5qz/SQ+QqA1nRry6BVa4e/9t7R7RJ8jzm bo2QVFVszCoM+3VrrpHiIDM1arITrhKMDr6hxkQEa+I2COl126sQy7EWqY4343WQAKGZ gpDA== 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=tTUjw4+7Xl+QcmvPZMmj+Da9MCHWJTSj1dQ0nX58RBg=; fh=4Ja3Lj82BOf8KI3eEGD/vwBe4mGV8iy4tvxyqo1X1Q8=; b=H2CpAxsXL+Kw9CdAcm8tzUB9y+h9LP/Ht5P3Fue4a8x6xlwhAyCIVq9L313c+erAjy CzUs50LyiV8FC5m7/9HI7fWmrKDWQ0dxS3Bb218JUsv1Lwv0eSEcBKxoGk+/gZH716PU ZrhMsPtapOQHVgEBWY260KRiwUymvEAEt2eoXcpylPePv9rAuyw2XgATqsMrZSPWDh8v C/CRxlP9kJZWPb4vpyKt/JYipn0wcMG3KntDsO5kbpPhbq1xvFztQtRPd2QjZ+O5TUXd yFSJokywNwWD2VgtOxmbPQwK51bLQCvUHEfFyeMwOwKtPbXkWf2KtTcVyU2VuSuSDG9y vqBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=J8rFdf+n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id io23-20020a17090312d700b0019f25dae4f5si4479097plb.198.2023.06.26.01.50.16; Mon, 26 Jun 2023 01:50:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=J8rFdf+n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230020AbjFZIfO (ORCPT + 99 others); Mon, 26 Jun 2023 04:35:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229579AbjFZIfM (ORCPT ); Mon, 26 Jun 2023 04:35:12 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEA2C1A1; Mon, 26 Jun 2023 01:35:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687768511; x=1719304511; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=8onuanaQNfRRRF00iDqDufDXkTnWdCag9mJHw4FNFiw=; b=J8rFdf+nsOMlznX6iTvQnJpNwbnz4y9FoQXj7flldilRzUrtuZ5hlm41 KqybmkFXLbtO38X6mFipgSq6g1JNBxgf2kwtF9vsWyBlqjoh4UaZsqBOF paFOdxaE1Xi9BIOJJPkSpv7njAXP1TTF1kOuoq5tOCnBbPo1CSm8r8EF5 mZ7dt8h4P6Lb2ajRrR9OBVR534zON0a89b+IGxnYxBToEW4AtPImRENnH pnlWMw5V+mPkYQ5xDwKnukaEp+ABud1/x7cPf4QUGtvYoBBjFjeX+8+16 h5g8TEYlRjUEno0J8/k9W+hRFlRncU0r1V9tuMMnnrQ4DepJayMwryxmo w==; X-IronPort-AV: E=McAfee;i="6600,9927,10752"; a="447595950" X-IronPort-AV: E=Sophos;i="6.01,159,1684825200"; d="scan'208";a="447595950" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2023 01:35:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10752"; a="860606274" X-IronPort-AV: E=Sophos;i="6.01,159,1684825200"; d="scan'208";a="860606274" Received: from kuha.fi.intel.com ([10.237.72.185]) by fmsmga001.fm.intel.com with SMTP; 26 Jun 2023 01:35:07 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Mon, 26 Jun 2023 11:35:06 +0300 Date: Mon, 26 Jun 2023 11:35:06 +0300 From: Heikki Krogerus To: Frank Wang Cc: linux@roeck-us.net, gregkh@linuxfoundation.org, sebastian.reichel@collabora.com, heiko@sntech.de, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, huangtao@rock-chips.com, william.wu@rock-chips.com, jianwei.zheng@rock-chips.com, yubing.zhang@rock-chips.com, wmc@rock-chips.com Subject: Re: [v4,1/2] usb: typec: tcpm: fix cc role at port reset Message-ID: References: <20230616075241.27690-1-frank.wang@rock-chips.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230616075241.27690-1-frank.wang@rock-chips.com> X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 16, 2023 at 03:52:40PM +0800, Frank Wang wrote: > In the current implementation, the tcpm set CC1/CC2 role to open when > it do port reset would cause the VBUS removed by the Type-C partner. > > This sets CC1/CC2 according to the default state of port to fix it. > > Signed-off-by: Frank Wang Acked-by: Heikki Krogerus > --- > Changelog: > (no changes since v3) > > v2: > - Make some tweaking based on the default state of port, commented by Guenter Roeck. > > v1: > - https://patchwork.kernel.org/project/linux-usb/patch/20230313025843.17162-2-frank.wang@rock-chips.com/ > > drivers/usb/typec/tcpm/tcpm.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c > index 3c6b0c8e2d3ae..9f6aaa3e70ca8 100644 > --- a/drivers/usb/typec/tcpm/tcpm.c > +++ b/drivers/usb/typec/tcpm/tcpm.c > @@ -4885,7 +4885,8 @@ static void run_state_machine(struct tcpm_port *port) > break; > case PORT_RESET: > tcpm_reset_port(port); > - tcpm_set_cc(port, TYPEC_CC_OPEN); > + tcpm_set_cc(port, tcpm_default_state(port) == SNK_UNATTACHED ? > + TYPEC_CC_RD : tcpm_rp_cc(port)); > tcpm_set_state(port, PORT_RESET_WAIT_OFF, > PD_T_ERROR_RECOVERY); > break; thanks, -- heikki