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 5FD621DA23; Thu, 3 Jul 2025 15:20:42 +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=1751556042; cv=none; b=N7EjIefjxJoUAlgZtcJFYmLTOEcRU13X2fnhlv1gVfaE3RYVA5lsQ9p41Cc7FhJ+8xgosBZzNcJ2bITTqOROTzv6CXjY2d4F8pUDvba6SiunaAj9XTr/NTnuRQB0QYFmd9OOrALGyHo5mF4757IoD35wAXgc5EWu+Cm3Qt5H/aU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751556042; c=relaxed/simple; bh=y5in2tjo4rWaS4LdE2XMxgjJ4TVGhLsGP3fc336G4QM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TqVlT6slddtMITWwmvKsDEWxwaNT5X2iMr3iYiRuo+Iv7ww9YkbIyXCusmD6BJ4DTQcC6wuhsRAcrjBNUnlGw4NouxJjydZJSBI6zivFnG59YsZh0VIkGPpAeH/8fwrhBUZ1BaQJoDCtcvu6JMe++tnAk1pec/nUtTnIqKya9JI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=CUKz26Yf; 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="CUKz26Yf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CDF2AC4CEE3; Thu, 3 Jul 2025 15:20:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1751556042; bh=y5in2tjo4rWaS4LdE2XMxgjJ4TVGhLsGP3fc336G4QM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CUKz26Yf7VZEOdP9TOxd38R4M+zRLVpZNz2Tzyzb9zAA5bWD4cST9l9sWum73DE/w 5A/0W3bN0pt5WHWo8xqvCzudeTo5ylx0gq+JdUcuUIzU5x3Vd7PeU0rCg4CJDVOGXz nRuHLgj4MHOlcnvIViqzQiVkut3qh2hxFZ0iBBWk= 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 6.1 029/132] usb: typec: displayport: Receive DP Status Update NAK request exit dp altmode Date: Thu, 3 Jul 2025 16:41:58 +0200 Message-ID: <20250703143940.552574911@linuxfoundation.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250703143939.370927276@linuxfoundation.org> References: <20250703143939.370927276@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.1-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 f80124102328c..26e0e72f4f166 100644 --- a/drivers/usb/typec/altmodes/displayport.c +++ b/drivers/usb/typec/altmodes/displayport.c @@ -320,6 +320,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