public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: typec: ucsi: Add UCSI_USB4_IMPLIES_USB quirk for X1E80100
@ 2026-03-12 10:14 Krishna Kurapati
  2026-03-13  8:53 ` Heikki Krogerus
  2026-03-13 11:38 ` Heikki Krogerus
  0 siblings, 2 replies; 5+ messages in thread
From: Krishna Kurapati @ 2026-03-12 10:14 UTC (permalink / raw)
  To: Heikki Krogerus, Greg Kroah-Hartman, Andrei Kuchynski, Abel Vesa,
	Pooja Katiyar, Johan Hovold, Venkat Jayaraman, Jameson Thies,
	Hsin-Te Yuan, Benson Leung, Dmitry Baryshkov, Anjelique Melendez
  Cc: linux-usb, linux-kernel, Krishna Kurapati

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>
---
 drivers/usb/typec/ucsi/ucsi.c       | 6 ++++--
 drivers/usb/typec/ucsi/ucsi.h       | 3 +++
 drivers/usb/typec/ucsi/ucsi_glink.c | 2 ++
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
index f38a4d7ebc42..e042499613c9 100644
--- a/drivers/usb/typec/ucsi/ucsi.c
+++ b/drivers/usb/typec/ucsi/ucsi.c
@@ -1182,8 +1182,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);
diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h
index 43a0d01ade8f..cff9ddc2ae21 100644
--- a/drivers/usb/typec/ucsi/ucsi.h
+++ b/drivers/usb/typec/ucsi/ucsi.h
@@ -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)
diff --git a/drivers/usb/typec/ucsi/ucsi_glink.c b/drivers/usb/typec/ucsi/ucsi_glink.c
index 11b3e24e34e2..1cb519cc0532 100644
--- a/drivers/usb/typec/ucsi/ucsi_glink.c
+++ b/drivers/usb/typec/ucsi/ucsi_glink.c
@@ -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,qcm6490-pmic-glink", .data = &quirk_sc8280xp, },
@@ -379,6 +380,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, },
 	{}
 };
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] usb: typec: ucsi: Add UCSI_USB4_IMPLIES_USB quirk for X1E80100
  2026-03-12 10:14 [PATCH] usb: typec: ucsi: Add UCSI_USB4_IMPLIES_USB quirk for X1E80100 Krishna Kurapati
@ 2026-03-13  8:53 ` Heikki Krogerus
  2026-03-13  9:14   ` Krishna Kurapati PSSNV
  2026-03-13 11:38 ` Heikki Krogerus
  1 sibling, 1 reply; 5+ messages in thread
From: Heikki Krogerus @ 2026-03-13  8:53 UTC (permalink / raw)
  To: Krishna Kurapati
  Cc: Greg Kroah-Hartman, Andrei Kuchynski, Abel Vesa, Pooja Katiyar,
	Johan Hovold, Venkat Jayaraman, Jameson Thies, Hsin-Te Yuan,
	Benson Leung, Dmitry Baryshkov, Anjelique Melendez, linux-usb,
	linux-kernel

Thu, Mar 12, 2026 at 03:44:31PM +0530, Krishna Kurapati kirjoitti:
> 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.

Do we need a quirk for this - can't we just always check the
USB4_GET<X>? With USB4, don't we always support USB2?

thanks,

> Signed-off-by: Krishna Kurapati <krishna.kurapati@oss.qualcomm.com>
> ---
>  drivers/usb/typec/ucsi/ucsi.c       | 6 ++++--
>  drivers/usb/typec/ucsi/ucsi.h       | 3 +++
>  drivers/usb/typec/ucsi/ucsi_glink.c | 2 ++
>  3 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
> index f38a4d7ebc42..e042499613c9 100644
> --- a/drivers/usb/typec/ucsi/ucsi.c
> +++ b/drivers/usb/typec/ucsi/ucsi.c
> @@ -1182,8 +1182,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);
> diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h
> index 43a0d01ade8f..cff9ddc2ae21 100644
> --- a/drivers/usb/typec/ucsi/ucsi.h
> +++ b/drivers/usb/typec/ucsi/ucsi.h
> @@ -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)
> diff --git a/drivers/usb/typec/ucsi/ucsi_glink.c b/drivers/usb/typec/ucsi/ucsi_glink.c
> index 11b3e24e34e2..1cb519cc0532 100644
> --- a/drivers/usb/typec/ucsi/ucsi_glink.c
> +++ b/drivers/usb/typec/ucsi/ucsi_glink.c
> @@ -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,qcm6490-pmic-glink", .data = &quirk_sc8280xp, },
> @@ -379,6 +380,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, },
>  	{}
>  };
>  
> -- 
> 2.34.1

-- 
heikki

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] usb: typec: ucsi: Add UCSI_USB4_IMPLIES_USB quirk for X1E80100
  2026-03-13  8:53 ` Heikki Krogerus
@ 2026-03-13  9:14   ` Krishna Kurapati PSSNV
  2026-03-13 11:38     ` Heikki Krogerus
  0 siblings, 1 reply; 5+ messages in thread
From: Krishna Kurapati PSSNV @ 2026-03-13  9:14 UTC (permalink / raw)
  To: Heikki Krogerus
  Cc: Greg Kroah-Hartman, Andrei Kuchynski, Abel Vesa, Pooja Katiyar,
	Johan Hovold, Venkat Jayaraman, Jameson Thies, Hsin-Te Yuan,
	Benson Leung, Dmitry Baryshkov, Anjelique Melendez, linux-usb,
	linux-kernel

On Fri, Mar 13, 2026 at 2:24 PM Heikki Krogerus
<heikki.krogerus@linux.intel.com> wrote:
>
> Thu, Mar 12, 2026 at 03:44:31PM +0530, Krishna Kurapati kirjoitti:
> > 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.
>
> Do we need a quirk for this - can't we just always check the
> USB4_GET<X>? With USB4, don't we always support USB2?
>

Thanks for the review Heikki.

So you mean check for all the 3 bits (Bit 21/23 and 24) and if none of
them is set, then pass ROLE_NONE ?
I wasn't sure if all PPMs would work that way or not and hence made
this quirk. Let me know if something like the following is fine:

!((UCSI_CONSTAT(con, PARTNER_FLAG_USB)) ||
   (UCSI_CONSTAT(con, PARTNER_FLAG_USB4_GEN3)) ||
   (UCSI_CONSTAT(con, PARTNER_FLAG_USB4_GEN4)))

The if check would see if all the 3 bits are "0" and then pass NONE to
usb controller.

Regards,
Krishna,

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] usb: typec: ucsi: Add UCSI_USB4_IMPLIES_USB quirk for X1E80100
  2026-03-13  9:14   ` Krishna Kurapati PSSNV
@ 2026-03-13 11:38     ` Heikki Krogerus
  0 siblings, 0 replies; 5+ messages in thread
From: Heikki Krogerus @ 2026-03-13 11:38 UTC (permalink / raw)
  To: Krishna Kurapati PSSNV
  Cc: Greg Kroah-Hartman, Andrei Kuchynski, Abel Vesa, Pooja Katiyar,
	Johan Hovold, Venkat Jayaraman, Jameson Thies, Hsin-Te Yuan,
	Benson Leung, Dmitry Baryshkov, Anjelique Melendez, linux-usb,
	linux-kernel

Fri, Mar 13, 2026 at 02:44:40PM +0530, Krishna Kurapati PSSNV wrote:
> On Fri, Mar 13, 2026 at 2:24 PM Heikki Krogerus
> <heikki.krogerus@linux.intel.com> wrote:
> >
> > Thu, Mar 12, 2026 at 03:44:31PM +0530, Krishna Kurapati kirjoitti:
> > > 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.
> >
> > Do we need a quirk for this - can't we just always check the
> > USB4_GET<X>? With USB4, don't we always support USB2?
> >
> 
> Thanks for the review Heikki.
> 
> So you mean check for all the 3 bits (Bit 21/23 and 24) and if none of
> them is set, then pass ROLE_NONE ?
> I wasn't sure if all PPMs would work that way or not and hence made
> this quirk. Let me know if something like the following is fine:

Well, maybe it's better to play it safe. Let's go with this. We can
always drop the quirk later.

thanks,

> !((UCSI_CONSTAT(con, PARTNER_FLAG_USB)) ||
>    (UCSI_CONSTAT(con, PARTNER_FLAG_USB4_GEN3)) ||
>    (UCSI_CONSTAT(con, PARTNER_FLAG_USB4_GEN4)))
> 
> The if check would see if all the 3 bits are "0" and then pass NONE to
> usb controller.
> 
> Regards,
> Krishna,

-- 
heikki

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] usb: typec: ucsi: Add UCSI_USB4_IMPLIES_USB quirk for X1E80100
  2026-03-12 10:14 [PATCH] usb: typec: ucsi: Add UCSI_USB4_IMPLIES_USB quirk for X1E80100 Krishna Kurapati
  2026-03-13  8:53 ` Heikki Krogerus
@ 2026-03-13 11:38 ` Heikki Krogerus
  1 sibling, 0 replies; 5+ messages in thread
From: Heikki Krogerus @ 2026-03-13 11:38 UTC (permalink / raw)
  To: Krishna Kurapati
  Cc: Greg Kroah-Hartman, Andrei Kuchynski, Abel Vesa, Pooja Katiyar,
	Johan Hovold, Venkat Jayaraman, Jameson Thies, Hsin-Te Yuan,
	Benson Leung, Dmitry Baryshkov, Anjelique Melendez, linux-usb,
	linux-kernel

Thu, Mar 12, 2026 at 03:44:31PM +0530, Krishna Kurapati kirjoitti:
> 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>

> ---
>  drivers/usb/typec/ucsi/ucsi.c       | 6 ++++--
>  drivers/usb/typec/ucsi/ucsi.h       | 3 +++
>  drivers/usb/typec/ucsi/ucsi_glink.c | 2 ++
>  3 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
> index f38a4d7ebc42..e042499613c9 100644
> --- a/drivers/usb/typec/ucsi/ucsi.c
> +++ b/drivers/usb/typec/ucsi/ucsi.c
> @@ -1182,8 +1182,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);
> diff --git a/drivers/usb/typec/ucsi/ucsi.h b/drivers/usb/typec/ucsi/ucsi.h
> index 43a0d01ade8f..cff9ddc2ae21 100644
> --- a/drivers/usb/typec/ucsi/ucsi.h
> +++ b/drivers/usb/typec/ucsi/ucsi.h
> @@ -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)
> diff --git a/drivers/usb/typec/ucsi/ucsi_glink.c b/drivers/usb/typec/ucsi/ucsi_glink.c
> index 11b3e24e34e2..1cb519cc0532 100644
> --- a/drivers/usb/typec/ucsi/ucsi_glink.c
> +++ b/drivers/usb/typec/ucsi/ucsi_glink.c
> @@ -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,qcm6490-pmic-glink", .data = &quirk_sc8280xp, },
> @@ -379,6 +380,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, },
>  	{}
>  };
>  
> -- 
> 2.34.1

-- 
heikki

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-03-13 11:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-12 10:14 [PATCH] usb: typec: ucsi: Add UCSI_USB4_IMPLIES_USB quirk for X1E80100 Krishna Kurapati
2026-03-13  8:53 ` Heikki Krogerus
2026-03-13  9:14   ` Krishna Kurapati PSSNV
2026-03-13 11:38     ` Heikki Krogerus
2026-03-13 11:38 ` Heikki Krogerus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox