From patchwork Mon Feb 12 18:42:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 199995 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp103784dyb; Mon, 12 Feb 2024 10:47:54 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVN+FtQbJuYyPLRLSJYHH88FJBRTbM8QJUXOZaVSBX8C/5faJA5N519jkfSubkKjCn2YYSzK7v2W7KrDEnoSqOV0UK4Lg== X-Google-Smtp-Source: AGHT+IHqNKeIOI1KfJavpFQtZz8IjAb6GXRR2SRwLtIfKyJvnco5RkgA78sBgQfoFGyhtx6cXauc X-Received: by 2002:a05:6512:39c9:b0:511:83b3:a9a9 with SMTP id k9-20020a05651239c900b0051183b3a9a9mr5484624lfu.14.1707763673893; Mon, 12 Feb 2024 10:47:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707763673; cv=pass; d=google.com; s=arc-20160816; b=s2itYZWYp9yC6FshSlHklcoqf9TQwn5ChzKJhEgyDB9EBKn10Qod6v4krCAS5393kE zHZmFwspPCrMuE99aQZd/k0hbyb4oDfXIveRsC9mna/0hem9f0oDodQi4ibcwmmLlLli IZR9SQUi3eENmueYPljWXWAp9yrhhcmpYO2rfqIM/WsvtkdTmpywFWN+h48XI1cCw/vR m0avu5o6LveSd4tzdA3cQ6CCcJjwF/KqAJ7WJG3jAmzD73ZBj5GuHJP2QDDT24UmZWhK DI7zBEQpPXpK+mUe3Ua4VqFTX8GTVucS7brbv3Lkv9FFp3W2oYKin8IqO78jvgNOancH r5yw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:message-id:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:subject:date :from:dkim-signature; bh=mzXu/Ah2Rm8qYD3ZhhJ+1VTeyX6oaA+QZCY+fR/CF60=; fh=743GOTnYWtabNfODyl/x/pIZBp05UQHJf9stLuNx61Y=; b=ILug4L52M1TCTpTLjBB6LeeOdGIToLVZ5APt7pXCwUIEyewWIq2f0IBKcmN5qMQRwq BtzinqmYIkUlk5b8U3+6pKjZB9Y4GEVVUN+fh8CfwknfcBVoGYWm2r5EK2tnG67h7gfU 7TtkhukExRtDBjtBeywxd8PCMtHf7mDeS/tC0MhR3D7T3Fu5SacGcXnECBlCaXIBSLys /Gtvzd4teSHeWgl0r8quqbokls09Juxs4VjhmchW+zd/aPwM/pnTasm0B2gYlExSLbqF FL2anKXyhUcQuIHmyxsn2CojjMp/Dnu6QT2T1plXM8LZbC0QeTuBBwtP9RorxQZRF5tT OGmQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VifBjncT; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-62217-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62217-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCWsurOg4yT5+jODFsUEyyAXiNxIN584MadnDYmNeHf4vsKrOkrht5yvGcSnwCh9pSLykZVit17QNXTtMs3+nX4FISespw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id oz27-20020a170906cd1b00b00a3bf8bb0afasi421304ejb.1013.2024.02.12.10.47.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 10:47:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62217-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VifBjncT; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-62217-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62217-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id BEA001F24350 for ; Mon, 12 Feb 2024 18:47:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D63A951005; Mon, 12 Feb 2024 18:42:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VifBjncT" 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 1A92F4F88E; Mon, 12 Feb 2024 18:42:40 +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=1707763361; cv=none; b=BTLrYxiIeLSM36mLRI9VjB9oho4w3LdDj1hRtMRTbY2y15N10wKieFjKbRUEeIteS+Rz6m9YDiRb6eYIqnOB3kzuqi/o7+0VsnHxrq3UiQwFZKFbAvU+xM52t7nN9aSGgUYI5xtUv3DzrdqwBQiICZwDZrTdX4FwkINsZE/D0Yo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707763361; c=relaxed/simple; bh=irer2YtQLNsknzcYh5DTwio375EH3XNe3jCuZA+5ASY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=mde/8//aL8awIYOkL23HE1xZj4gnHMzExR3wW6mnWuo8PuBs2EPEwbEAhzDfSE39UUBMIV2dGoq72ks2w3Q22oxpL6/rZY5IVmNpK0NSD7/+TaLU+py0VaXGnCz79EYoKvg3CQCftH5d9X7ZAR7zzfbaQtNADWWG9zdkBXj5srg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VifBjncT; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A79C1C433F1; Mon, 12 Feb 2024 18:42:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707763360; bh=irer2YtQLNsknzcYh5DTwio375EH3XNe3jCuZA+5ASY=; h=From:Date:Subject:To:Cc:From; b=VifBjncTzm/SLmDloF6KudUAhLMU3zwB/Rc/bEv4ZXXj85D3XaKXQlcAmd2r00kYd KXUi+QdWYSAaviDRAozXc3iojVFFFp39oDduA3NFimDwlpR/7wlWrPcYJChs54IpT0 wK8NqEi8K8sag4Q4lBdvc28ywS+asdkcH3h3jSHf/Ulk6PecgeSp3gmc9toWXOAYP0 w6ocisprHyqF3EC/r3+Rb5CsYlWhq+iiaZrIRn6EDb4iGk9zX9yHsC1OzKbSHcqno+ Wkds3mofpO1WWgj4y5ULuH1D1r5X+zqFWn9h0EQOLfT0T13ntlmUumtHHY7mb55rbl syMMRZaiJyM+g== From: Mark Brown Date: Mon, 12 Feb 2024 18:42:13 +0000 Subject: [PATCH] usb: typec: tpcm: Fix issues with power being removed during reset Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240212-usb-fix-renegade-v1-1-22c43c88d635@kernel.org> X-B4-Tracking: v=1; b=H4sIAIRmymUC/x2MQQqAMAzAviI9W5idovgV8TC3qr1M6VAE2d8dH kNIXkiswgnG6gXlW5IcsUBTV+B3FzdGCYWBDLWGGsIrLbjKg8qRNxcYB9sH2/nVG09QslO5+H8 5zTl/muZROmIAAAA= To: Guenter Roeck , Heikki Krogerus , Greg Kroah-Hartman , Badhri Jagan Sridharan , =?utf-8?q?G=C3=A1bor_Stefanik?= Cc: rdbabiera@google.com, amitsd@google.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.13-dev-a684c X-Developer-Signature: v=1; a=openpgp-sha256; l=1677; i=broonie@kernel.org; h=from:subject:message-id; bh=irer2YtQLNsknzcYh5DTwio375EH3XNe3jCuZA+5ASY=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBlymadxjfOunvW5iuuvs6fLTNKMZiykKsoChOlBpq+ W2B7YsiJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZcpmnQAKCRAk1otyXVSH0PXGB/ sGjzS7y8rugetcpFH7Oub8vjhofM6VhXi+yLi4bybuapgOYCHidxWUP8CNGOVpiX+2iYIt7HuXYhGV RvwALySl2kR987R1PDdF/AkVhYq5KotLAkSny1djJZMywDhiy+AtFy0+ZVy1kH5kPBvON5sAsZO3qk rv+5UL/RhKjd23IVZghZ7GB/gDinEZphaO14t1mA9cwaPllVQKry6Jk1L9vFfSjdzhtX3Ebun1uWZn j+iuBsDkM5I2dYtL+w5P2maUsfCkZ5+lyzF5Umzy52Bx6RfMONkcCWo5TN7dPBC4sVc8xdOMHNcChT ZTDDlGjE4uW2YtMVQ/I2AouFN3+03k X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790720002185293057 X-GMAIL-MSGID: 1790720002185293057 Since the merge of b717dfbf73e8 ("Revert "usb: typec: tcpm: fix cc role at port reset"") into mainline the LibreTech Renegade Elite/Firefly has died during boot, the main symptom observed in testing is a sudden stop in console output. Gábor Stefanik identified in review that the patch would cause power to be removed from devices without batteries (like this board), observing that while the patch is correct according to the spec this appears to be an oversight in the spec. Given that the change makes previously working systems unusable let's revert it, there was some discussion of identifying systems that have alternative power and implementing the standards conforming behaviour in only that case. Fixes: b717dfbf73e8 ("Revert "usb: typec: tcpm: fix cc role at port reset"") Signed-off-by: Mark Brown --- drivers/usb/typec/tcpm/tcpm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- base-commit: 841c35169323cd833294798e58b9bf63fa4fa1de change-id: 20240212-usb-fix-renegade-837d35cfc0c2 Best regards, diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index f7d7daa60c8d..a0978ed1a257 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -4876,7 +4876,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;