From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0572C4644C; Mon, 1 Apr 2024 16:46:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711989977; cv=none; b=nn+eQGmi7jFZGOlTqLwul8SbOU7VDNs1kHWIT7rMNRVN7VJ2cIU6LFdlr2lG/HvbcIZ33m8R8GOzRxXGT2/bV0e0QuBLUnjwTCWnFTZ5n8h/miiBPhto5S4FauBUU7cw7GihX0CVC4KjKYxI8Jh5IgWGonZ8Mh63EGK6gIfKVco= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711989977; c=relaxed/simple; bh=7N01FboA15G92vAsEYHpDABxL7mJKlGF0d+4kpZH20Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UDdA1zslhWw3JLezwVTTsRztegwrU4yCd4HmJf/3EQX3i5R/u9yFLfv7/EBcvsTxBMNoP2WZuZ2dxd97Kmd2gZjex6/SPeVhFWPM3I0GH8VWvGrPXaOu8+ZVkJDAYDnpF3+hGmJ+UevM9vUzolBjim0g6WiIkRC7X/0Cj8Cf51M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=oC4Z6oMm; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="oC4Z6oMm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56273C433F1; Mon, 1 Apr 2024 16:46:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1711989976; bh=7N01FboA15G92vAsEYHpDABxL7mJKlGF0d+4kpZH20Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oC4Z6oMmrUl+dgLRZHfNZ99tdObK7XkWENhz0SKu0A4Q+cCWclPNnfxMoONrrjC4S pRkm5oOKXDYy8bOr8IKwY5e+W4Jy2QFeBiunhkoucHuW/gN0x3nAdeIqCmn6S6SuHv rTVaKOFfsYiHi0L6DVB/RTYyonAR8w3EuvcGd8Co= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Mark Brown , Badhri Jagan Sridharan Subject: [PATCH 6.6 208/396] usb: typec: tpcm: Fix PORT_RESET behavior for self powered devices Date: Mon, 1 Apr 2024 17:44:17 +0200 Message-ID: <20240401152554.129995563@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240401152547.867452742@linuxfoundation.org> References: <20240401152547.867452742@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Badhri Jagan Sridharan commit 197331b27ac890d0209232d5f669830cd00e8918 upstream. 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 removed during reset") Cc: stable@vger.kernel.org Cc: Mark Brown Signed-off-by: Badhri Jagan Sridharan Tested-by: Mark Brown Link: https://lore.kernel.org/r/20240228000512.746252-1-badhri@google.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/typec/tcpm/tcpm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -4859,8 +4859,11 @@ static void run_state_machine(struct tcp break; case PORT_RESET: tcpm_reset_port(port); - tcpm_set_cc(port, tcpm_default_state(port) == SNK_UNATTACHED ? - 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) == SNK_UNATTACHED ? + TYPEC_CC_RD : tcpm_rp_cc(port)); tcpm_set_state(port, PORT_RESET_WAIT_OFF, PD_T_ERROR_RECOVERY); break;