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 89A2128937D; Tue, 15 Jul 2025 13:50:47 +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=1752587447; cv=none; b=jJNNQdcaAYlQExiJx31OQQVmea6aP5v3asj3EXfqNBO7CrryLzaljv+tTFoTFzO2WYaleFzIpndLrxGqp8c9jmxyHxeBdB6k9osfepo5Zc4DTzL1mlywLJDnxeAUYoGokoLASxjp6qwyYL8/qZCC2gHxerT8MTJAYHwHxj9dPmk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752587447; c=relaxed/simple; bh=opGpRGvyR+JlfypA7dxlHib92NfC/S1gMYOFSxPpfrw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gqikwE1qfP0i2BKLDrDBNdP3qusq2g3H7GFCUloJClPgEmWEBnTqz6PchNYXlxUs5qRyOt1aE+MMVDwiX7oIai4PU3pQPAgz9MOLO74thu67sSrlMRIsho3bRxj+du0hdNPvmx/xNx6+DNScG1EXNlhtuXi9J4vVm6Yit60Lrpc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=CZHBXz9N; 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="CZHBXz9N" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1957DC4CEE3; Tue, 15 Jul 2025 13:50:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1752587447; bh=opGpRGvyR+JlfypA7dxlHib92NfC/S1gMYOFSxPpfrw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CZHBXz9Ncv0dXFZ7IiZvKeG/k3BOadOcaHjmOdz5MiPSEK9loq2zyDv9v51z2e1Sf bA3Fxu0ciRGmLnTWzHBe6FvnuhiIcic1IbYYzc11ECIUBgpxFAtuR6qJH4bX2RC89d Fnm1h0UCoRdEXvclstyr58ptg+EyYRQ5TlPcqEis= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jos Wang , Heikki Krogerus , Sasha Levin Subject: [PATCH 5.10 016/208] usb: typec: displayport: Receive DP Status Update NAK request exit dp altmode Date: Tue, 15 Jul 2025 15:12:05 +0200 Message-ID: <20250715130811.483920643@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250715130810.830580412@linuxfoundation.org> References: <20250715130810.830580412@linuxfoundation.org> User-Agent: quilt/0.68 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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jos Wang [ Upstream commit b4b38ffb38c91afd4dc387608db26f6fc34ed40b ] Although some Type-C DRD devices that do not support the DP Sink function (such as Huawei Mate 40Pro), the Source Port initiates Enter Mode CMD, but the device responds to Enter Mode ACK, the Source port then initiates DP Status Update CMD, and the device responds to DP Status Update NAK. As PD2.0 spec ("6.4.4.3.4 Enter Mode Command"),A DR_Swap Message Shall Not be sent during Modal Operation between the Port Partners. At this time, the source port initiates DR_Swap message through the "echo device > /sys/class/typec/port0/data_role" command to switch the data role from host to device. The device will initiate a Hard Reset for recovery, resulting in the failure of data role swap. Therefore, when DP Status Update NAK is received, Exit Mode CMD is initiated to exit the currently entered DP altmode. Signed-off-by: Jos Wang Reviewed-by: Heikki Krogerus Link: https://lore.kernel.org/r/20250209071926.69625-1-joswang1221@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/typec/altmodes/displayport.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c index e0456e5e10b68..a577db01e67e1 100644 --- a/drivers/usb/typec/altmodes/displayport.c +++ b/drivers/usb/typec/altmodes/displayport.c @@ -304,6 +304,10 @@ static int dp_altmode_vdm(struct typec_altmode *alt, break; case CMDT_RSP_NAK: switch (cmd) { + case DP_CMD_STATUS_UPDATE: + if (typec_altmode_exit(alt)) + dev_err(&dp->alt->dev, "Exit Mode Failed!\n"); + break; case DP_CMD_CONFIGURE: dp->data.conf = 0; ret = dp_altmode_configured(dp); -- 2.39.5