]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
usb: typec: ucsi: Set usb mode on partner change
authorJameson Thies <jthies@google.com>
Thu, 2 Apr 2026 18:24:38 +0000 (18:24 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 7 Apr 2026 11:47:59 +0000 (13:47 +0200)
Currently the partner usb_mode is only set in ucsi_register_partner().
If the partner enters USB4 operation after it is registered, this is not
reported to the typec class. The UCSI spec states that the Connector
Partner Changed bit can represent a Connector Partner Flags change. When
handling a UCSI partner change, check the partner flags for USB4
operation.

Signed-off-by: Jameson Thies <jthies@google.com>
Reviewed-by: Benson Leung <bleung@chromium.org>
Link: https://patch.msgid.link/20260402182438.867396-1-jthies@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/ucsi/ucsi.c

index f6bb88b1ccee4135188c634ae7c22d88d65cde74..301c36529566056f0bf58cb915b386946e7ef649 100644 (file)
@@ -1187,6 +1187,12 @@ static void ucsi_partner_change(struct ucsi_connector *con)
                        if (UCSI_CONSTAT(con, PARTNER_FLAG_USB))
                                typec_set_mode(con->port, TYPEC_STATE_USB);
                }
+
+               if (((con->ucsi->version >= UCSI_VERSION_3_0 &&
+                   UCSI_CONSTAT(con, PARTNER_FLAG_USB4_GEN4)) ||
+                   (con->ucsi->version >= UCSI_VERSION_2_0 &&
+                   UCSI_CONSTAT(con, PARTNER_FLAG_USB4_GEN3))) && con->partner)
+                       typec_partner_set_usb_mode(con->partner, USB_MODE_USB4);
        }
 
        if ((!UCSI_CONSTAT(con, PARTNER_FLAG_USB)) &&