Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2245429rbb; Tue, 27 Feb 2024 16:07:15 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCURMfppFPV4BjbvHwXPYOV2iV1dVSMRtS+f37lAy+oL8o4lIJTrqgQyDpKpQPevnvQh46wRqtsd43p+WTFtEoYOQjV5jVdSrlqh9H9lYg== X-Google-Smtp-Source: AGHT+IFp5PsRJrTX/3rw2tCqHN8mJ+mxMH1Ix7AVFVKVG4AHcOh+Z1A0K90ZpkR3+AAUl1R7sbSU X-Received: by 2002:a05:6a21:31c7:b0:1a0:e1d2:e097 with SMTP id zb7-20020a056a2131c700b001a0e1d2e097mr3591354pzb.12.1709078835373; Tue, 27 Feb 2024 16:07:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709078835; cv=pass; d=google.com; s=arc-20160816; b=nt9YNX9ZHMMB6N4Da8wjECLY61DgQMehea03qXnTN1Or/2qeUNoChpx9BFUo+SWxht 0M9LgpXIQLcZvOLIuxaX812gxHak8flqJaHaQ1cWo0v9JPF5operMFZIlnZq6Oxh685x KGduP/TdYYQKUFO3hqO0lw+qFHM+kAML/+tK6w0mmw+HE8+Ww19ukBTsYehRFsP6XuYp 1VlA9DDoSQbXj/DwJLJWe8u68vcpiDhNWuwdjxmeGvyb8L+6rCWe6BefYGpZ6loGVVNd EReqGfmm44FiV57/pTcGNcCc+6f/I7TAqxNUcYWqwkjCOE4bXFLCTw5cUX7ZDZdxy1rJ oBmQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=JwJ7r+hhbElRRt/Ehuz+IMcLRUC1TV153CrNCo3tLcw=; fh=UTfa56dfiOws2sDv3W9GExXvF2T8JKSnZFUVOnL4i/U=; b=xwXbdkwsm2W0aKLaXfGcaks3HmVocHh0OEvMVVzSmi57x/4do076+WoQJdVEdVH1Tl qv+oK3lLnoqigvwlJJYFl+2h9wxhviC8z602G8FLJC1MQC6MtqibULVy7LxUdSo1LzhX 5mezBX93GUc6ygUGqbzrHZYEhWSJkFc8N5xJf7RkCd/Mhb9DDF7tk7NuMldO22asUVsk +qs9qoUUwawv+KMLsze5WExX7SL65sTmWxcnbMf8ZJTnZqLC/TX5K/R6P+7QhYladkZA Ucw06PbwluHswqaLqhFQuUDqr6l5LVUyhTqrxpbqiLy55t8pu/usHXv/K381FRqTdbSC HuAA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=pDv1DsS8; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-84257-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84257-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id h16-20020a63f910000000b005dc1c316cf5si6195735pgi.357.2024.02.27.16.07.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 16:07:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84257-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=pDv1DsS8; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-84257-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84257-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B448828480F for ; Wed, 28 Feb 2024 00:07:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5211E20F1; Wed, 28 Feb 2024 00:07:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="pDv1DsS8" Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 487ECEDD for ; Wed, 28 Feb 2024 00:07:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709078827; cv=none; b=QJCJGXCM5jc3Gdj4W8AcgcTsWnXpahIbjaoKKmJOxgVUQArWiAS0jVSLGy/FdolI4EOu+Nw+wwjQylR/HfW7UGhqxoGMCRwlMa/Xak9Xmv6N+Pw45sEAMK9Tu3Cknxy8uimAVTVj5RqrGb4Oo5t0557ubnpFhQl1SSpR7wP1Npg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709078827; c=relaxed/simple; bh=y3oeCWuiY7SKVrYuIRHS+ZMSQe7tGBXllwPklBBcm7M=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=iG10xfEBwcTr8zD/m2U1QEOT4g4n6tDevvTuKqB8r5hWCHyitoidnGNjZJ6529gagR86BYVGfbZvFMG/LrthiCs+9gx5e1Kw3dSX8h0WvdUQj6VvSW6+Q49hVNrte51xjvrPs7bMQVTg11HBtMGeGXQMJhLnlb42RK+Oh6cJbs0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=pDv1DsS8; arc=none smtp.client-ip=209.85.215.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-pg1-f180.google.com with SMTP id 41be03b00d2f7-5dbcfa0eb5dso4480882a12.3 for ; Tue, 27 Feb 2024 16:07:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709078824; x=1709683624; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=JwJ7r+hhbElRRt/Ehuz+IMcLRUC1TV153CrNCo3tLcw=; b=pDv1DsS8vCxLehRIvwqgPu4hvL6Yjte+QKydppB2WKMvf/gPBDz8Qwu+A6ZS09Avxs LS6+t2dblHHwsn0SfeC8J2aAGz1mM9NN48EZ1xJUhO+FGBU7MNYYY3eLdLexc7ZgIrh/ RrkgyOhAga+03tROj9LrrWxwrGuq+kW0Wf2XpZttI5b7BkSyMfUAag5UhLPaJ4AtqZvK 5aLn0r2JVaecs4RSG0xa2soI+KI7f8Nq2wAegUBBCYUVWI7XtsCA7svmz/jWkFOsI+FF Rsv4ZWFFmSyGLPX+mquh+49hxINyq3F4aor4gCKUzz1BJQZBCrB80HpOJJ3EltzvXF5A 7veA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709078824; x=1709683624; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JwJ7r+hhbElRRt/Ehuz+IMcLRUC1TV153CrNCo3tLcw=; b=hE9B/NNVdD0hbHzwr9HKGqgIzQmR5jCP8+obQb64zanXIi5avCfdqFXpo3zxAHcJI8 l5m7o3VwPG6TJduKPtQKfL690mpsETmkbWaDoLBqrVtZoYwglLUz2zXZ5jJMiqSnvnQy jTfgVU0aHaY186XVDXiZqJveYJsKN+ycasiZzFoM523bB83Wu53e5Myz/kUDdQq3m8a9 oZxn6GJ0ydPSkaqkzhDJEHPd2hCjDJ5249/nwAfedqWclTa9F9qMgcvHon9+sQ+PSWyj HyBIwFJNbcYw3R8am+hwBV7tOmlZ6ELusEgmGIf589efCVq+3K+If73ysEPSxJgSZj+5 WqZg== X-Forwarded-Encrypted: i=1; AJvYcCWVEbX6CBO/+YNUBHBkvXwNruX+TeygU1fF6Xt6HifzyyvTVurW3lbS72M+ZYD0TfunwwUOYBBDLgZ2Ueu0f1qOugn7kre9OEXYKGda X-Gm-Message-State: AOJu0YxtTUNoPZ/RyCmAmz5+Wo1iOIRtYHqkr8WQ2SQBhffYm/oXYGP6 ob80XNlT8+Vxtz69FRD7XPoKqnp0eM8flcWz6sJwG+E86juVIo3DjRuOxqMNiuUYjkgg9FC6rT/ m8YfQ25NV1nHzo6RxeUimLcZjdOxU3K/hMgLI X-Received: by 2002:a05:6a20:ac44:b0:1a1:15ce:1f64 with SMTP id dh4-20020a056a20ac4400b001a115ce1f64mr1594408pzb.29.1709078824383; Tue, 27 Feb 2024 16:07:04 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240227235832.744908-1-badhri@google.com> In-Reply-To: <20240227235832.744908-1-badhri@google.com> From: Badhri Jagan Sridharan Date: Tue, 27 Feb 2024 16:06:27 -0800 Message-ID: Subject: Re: [PATCH v1] usb: typec: tpcm: Fix PORT_RESET behavior for self powered devices To: gregkh@linuxfoundation.org, linux@roeck-us.net, heikki.krogerus@linux.intel.com Cc: kyletso@google.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, rdbabiera@google.com, amitsd@google.com, stable@vger.kernel.org, frank.wang@rock-chips.com, broonie@kernel.org, stable@kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable HI all, Please ignore this patch. Adding the right tag "Cc: stable@vger.kernel.org" for CCing stable. Thanks, Badhri On Tue, Feb 27, 2024 at 3:58=E2=80=AFPM Badhri Jagan Sridharan wrote: > > While commit 69f89168b310 ("usb: typec: tpcm: Fix issues with power being > removed during reset") fixes the boot issues for bus powered devices such > as LibreTech Renegade Elite/Firefly, it trades off the CC pins NOT being > Hi-Zed during errory recovery (i.e PORT_RESET) for devices which are NOT > bus powered(a.k.a self powered). This change Hi-Zs the CC pins only for > self powered devices, thus preventing brown out for bus powered devices > > Adhering to spec is gaining more importance due to the Common charger > initiative enforced by the European Union. > > Quoting from the spec: > 4.5.2.2.2.1 ErrorRecovery State Requirements > The port shall not drive VBUS or VCONN, and shall present a > high-impedance to ground (above zOPEN) on its CC1 and CC2 pins. > > Hi-Zing the CC pins is the inteded behavior for PORT_RESET. > CC pins are set to default state after tErrorRecovery in > PORT_RESET_WAIT_OFF. > > 4.5.2.2.2.2 Exiting From ErrorRecovery State > A Sink shall transition to Unattached.SNK after tErrorRecovery. > A Source shall transition to Unattached.SRC after tErrorRecovery. > > Fixes: 69f89168b310 ("usb: typec: tpcm: Fix issues with power being remov= ed during reset") > Cc: stable@kernel.org > Cc: Mark Brown > Signed-off-by: Badhri Jagan Sridharan > --- > drivers/usb/typec/tcpm/tcpm.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.= c > index c9a78f55ca48..bbe1381232eb 100644 > --- a/drivers/usb/typec/tcpm/tcpm.c > +++ b/drivers/usb/typec/tcpm/tcpm.c > @@ -5593,8 +5593,11 @@ static void run_state_machine(struct tcpm_port *po= rt) > break; > case PORT_RESET: > tcpm_reset_port(port); > - tcpm_set_cc(port, tcpm_default_state(port) =3D=3D SNK_UNA= TTACHED ? > - TYPEC_CC_RD : tcpm_rp_cc(port)); > + if (port->self_powered) > + tcpm_set_cc(port, TYPEC_CC_OPEN); > + else > + tcpm_set_cc(port, tcpm_default_state(port) =3D=3D= SNK_UNATTACHED ? > + TYPEC_CC_RD : tcpm_rp_cc(port)); > tcpm_set_state(port, PORT_RESET_WAIT_OFF, > PD_T_ERROR_RECOVERY); > break; > > base-commit: a560a5672826fc1e057068bda93b3d4c98d037a2 > -- > 2.44.0.rc1.240.g4c46232300-goog >