]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
usb: typec: displayport: Receive DP Status Update NAK request exit dp altmode
authorJos Wang <joswang@lenovo.com>
Sun, 9 Feb 2025 07:19:26 +0000 (15:19 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 6 Jul 2025 08:57:56 +0000 (10:57 +0200)
[ 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 <joswang@lenovo.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20250209071926.69625-1-joswang1221@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/typec/altmodes/displayport.c

index f80124102328c70ba21a7af5ec593e82f237d3af..26e0e72f4f166e86f1bc18aafd9cdd483c9c363c 100644 (file)
@@ -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);