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 615DA8F5E; Tue, 8 Jul 2025 16:56:35 +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=1751993795; cv=none; b=pVDiLvXykS3KKgJdbliyOYxbQRsVd7SqeZx6o/1NXZNyRtxTRPs8nAoN0U65sBmBDO91v9+k5jRV/9O7R2xBo5OqM9N0wzAU4JFBs8Bf6fdfpl/XRMG1jPL1IL/j/0SB2EACACiipSOX6hEs3yG3mU/I1aw5zD0+92D9VsmyMis= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751993795; c=relaxed/simple; bh=AeZcPSl1MiJECnTm8xM3YfPlb2ZOYmItNI9p1Esg4vY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=d86ycEzgS+P0Qk16v7ZEyfF+ErX4C2UC3AqZufp6YE+wpVG8rgRzoHkmU2qKpSCJrskVQYGoXawnX+LqNCjj2KGV38D7oy32yZGITL+BWMhJKK9o5clj6/MJfntazz4RBxZu2B8fx8amUS3RNTGzxkgIzGamp/3xk2TmO8giydY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=p4j1vJds; 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="p4j1vJds" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF2A9C4CEED; Tue, 8 Jul 2025 16:56:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1751993795; bh=AeZcPSl1MiJECnTm8xM3YfPlb2ZOYmItNI9p1Esg4vY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p4j1vJdsQ8pzNDItAokrSamnFB+jodDbj/67p1WzrTeLN0sRltzqhp0N5r2K3Jc0l 8NaoFnWkGbj7t+eAC63SY0pQCkRxS9izpmrB7V3xNL+VrtAW023Q6AvBgO5QrCdB7j RrQ0j3xZtyZKx+e+tppmza3t7qgDScoj2YFqN+ic= 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.15 021/160] usb: typec: displayport: Receive DP Status Update NAK request exit dp altmode Date: Tue, 8 Jul 2025 18:20:58 +0200 Message-ID: <20250708162232.093731984@linuxfoundation.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250708162231.503362020@linuxfoundation.org> References: <20250708162231.503362020@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 5.15-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 97a912f0c4eed..c76b872535d17 100644 --- a/drivers/usb/typec/altmodes/displayport.c +++ b/drivers/usb/typec/altmodes/displayport.c @@ -298,6 +298,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