]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
usb: typec: ucsi: Add UCSI_USB4_IMPLIES_USB quirk for X1E80100
authorKrishna Kurapati <krishna.kurapati@oss.qualcomm.com>
Thu, 12 Mar 2026 10:14:31 +0000 (15:44 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Mar 2026 15:03:14 +0000 (16:03 +0100)
On X1E80100, when we connect a USB4 capable dock, the PARTNER_FLAGS
indicate USB4_GEN3 being set whilst keeping the PARTNER_FLAGS_USB
cleared. Due to this, during ucsi_partner_change call, the usb role
is marked as ROLE_NONE and passed to DWC3 controller the same way.

Fix this by adding UCSI_USB4_IMPLIES_USB quirk and check for it to
decide and pass on proper ROLE information to DWC3 layer.

Signed-off-by: Krishna Kurapati <krishna.kurapati@oss.qualcomm.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://patch.msgid.link/20260312101431.2375709-1-krishna.kurapati@oss.qualcomm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/ucsi/ucsi.c
drivers/usb/typec/ucsi/ucsi.h
drivers/usb/typec/ucsi/ucsi_glink.c

index 4efbe41d7714029d22ee508d3abd3303d0f59e24..fe1fb8a68a1d88ee6b8c79868489b3d19b0b441c 100644 (file)
@@ -1184,8 +1184,10 @@ static void ucsi_partner_change(struct ucsi_connector *con)
                }
        }
 
-       /* Only notify USB controller if partner supports USB data */
-       if (!(UCSI_CONSTAT(con, PARTNER_FLAG_USB)))
+       if ((!UCSI_CONSTAT(con, PARTNER_FLAG_USB)) &&
+           ((con->ucsi->quirks & UCSI_USB4_IMPLIES_USB) &&
+            (!(UCSI_CONSTAT(con, PARTNER_FLAG_USB4_GEN3) ||
+               UCSI_CONSTAT(con, PARTNER_FLAG_USB4_GEN4)))))
                u_role = USB_ROLE_NONE;
 
        ret = usb_role_switch_set_role(con->usb_role_sw, u_role);
index 43a0d01ade8ff2b0528e0afcbe93af36bcfa244e..cff9ddc2ae215757ca5ce558da02b98d8bc56612 100644 (file)
@@ -497,6 +497,9 @@ struct ucsi {
        unsigned long quirks;
 #define UCSI_NO_PARTNER_PDOS   BIT(0)  /* Don't read partner's PDOs */
 #define UCSI_DELAY_DEVICE_PDOS BIT(1)  /* Reading PDOs fails until the parter is in PD mode */
+
+/* USB4 connection can imply that USB communcation is supported */
+#define UCSI_USB4_IMPLIES_USB  BIT(2)
 };
 
 #define UCSI_MAX_DATA_LENGTH(u) (((u)->version < UCSI_VERSION_2_0) ? 0x10 : 0xff)
index c7878ea0d37aed783e08c9d8929dd4fc5e9522e5..12e07b9fe622805a80a5b07b1e8a9cd9a60b4ec0 100644 (file)
@@ -371,6 +371,7 @@ static void pmic_glink_ucsi_destroy(void *data)
 static unsigned long quirk_sc8180x = UCSI_NO_PARTNER_PDOS;
 static unsigned long quirk_sc8280xp = UCSI_NO_PARTNER_PDOS | UCSI_DELAY_DEVICE_PDOS;
 static unsigned long quirk_sm8450 = UCSI_DELAY_DEVICE_PDOS;
+static unsigned long quirk_x1e80100 = UCSI_DELAY_DEVICE_PDOS | UCSI_USB4_IMPLIES_USB;
 
 static const struct of_device_id pmic_glink_ucsi_of_quirks[] = {
        { .compatible = "qcom,glymur-pmic-glink", .data = &quirk_sm8450, },
@@ -381,6 +382,7 @@ static const struct of_device_id pmic_glink_ucsi_of_quirks[] = {
        { .compatible = "qcom,sm8350-pmic-glink", .data = &quirk_sc8180x, },
        { .compatible = "qcom,sm8450-pmic-glink", .data = &quirk_sm8450, },
        { .compatible = "qcom,sm8550-pmic-glink", .data = &quirk_sm8450, },
+       { .compatible = "qcom,x1e80100-pmic-glink", .data = &quirk_x1e80100, },
        {}
 };