[PATCH] usb: typec: ps883x: Fix DP+USB3 configuration

Stephan Gerhold posted 1 patch 6 days, 15 hours ago
drivers/usb/typec/mux/ps883x.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
[PATCH] usb: typec: ps883x: Fix DP+USB3 configuration
Posted by Stephan Gerhold 6 days, 15 hours ago
Commit 6bebd9b77726 ("usb: typec: ps883x: Rework ps883x_set()") introduced
two regressions:

 1. The CONN_STATUS_0_USB_3_1_CONNECTED bit is mistakenly written to the
    wrong configuration register (cfg1 instead of cfg0). This breaks USB3
    when using USB3+DP adapters.

 2. The switch-case fallthrough block is inverted: Currently,
    TYPEC_DP_STATE_C (DP-only) inherits the USB3 configuration, while
    TYPEC_DP_STATE_D (DP+USB3) is missing the necessary DP sink flags.

Fix these by writing the USB3 bit to the correct register and swapping the
case statement order so both states get their correct bits assigned.

Cc: stable@vger.kernel.org
Fixes: 6bebd9b77726 ("usb: typec: ps883x: Rework ps883x_set()")
Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
---
 drivers/usb/typec/mux/ps883x.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/typec/mux/ps883x.c b/drivers/usb/typec/mux/ps883x.c
index 1256252eceed..c9bf4b4c2ba1 100644
--- a/drivers/usb/typec/mux/ps883x.c
+++ b/drivers/usb/typec/mux/ps883x.c
@@ -118,12 +118,12 @@ static int ps883x_set(struct ps883x_retimer *retimer, struct typec_retimer_state
 				CONN_STATUS_1_DP_HPD_LEVEL;
 
 			switch (state->mode)  {
+			case TYPEC_DP_STATE_D:
+				cfg0 |= CONN_STATUS_0_USB_3_1_CONNECTED;
+				fallthrough;
 			case TYPEC_DP_STATE_C:
 				cfg1 |= CONN_STATUS_1_DP_SINK_REQUESTED |
 					CONN_STATUS_1_DP_PIN_ASSIGNMENT_C_D;
-				fallthrough;
-			case TYPEC_DP_STATE_D:
-				cfg1 |= CONN_STATUS_0_USB_3_1_CONNECTED;
 				break;
 			default: /* MODE_E */
 				break;

---
base-commit: 645d4eda1d0db0202ed8e4a2c3abb2ebce6b86ef
change-id: 20260601-ps883x-usb3dp-fixes-32c09e9bd6f6

Best regards,
--  
Stephan Gerhold <stephan.gerhold@linaro.org>
Re: [PATCH] usb: typec: ps883x: Fix DP+USB3 configuration
Posted by Heikki Krogerus 2 days, 16 hours ago
On Mon, Jun 01, 2026 at 03:55:02PM +0200, Stephan Gerhold wrote:
> Commit 6bebd9b77726 ("usb: typec: ps883x: Rework ps883x_set()") introduced
> two regressions:
> 
>  1. The CONN_STATUS_0_USB_3_1_CONNECTED bit is mistakenly written to the
>     wrong configuration register (cfg1 instead of cfg0). This breaks USB3
>     when using USB3+DP adapters.
> 
>  2. The switch-case fallthrough block is inverted: Currently,
>     TYPEC_DP_STATE_C (DP-only) inherits the USB3 configuration, while
>     TYPEC_DP_STATE_D (DP+USB3) is missing the necessary DP sink flags.
> 
> Fix these by writing the USB3 bit to the correct register and swapping the
> case statement order so both states get their correct bits assigned.
> 
> Cc: stable@vger.kernel.org
> Fixes: 6bebd9b77726 ("usb: typec: ps883x: Rework ps883x_set()")
> Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  drivers/usb/typec/mux/ps883x.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/typec/mux/ps883x.c b/drivers/usb/typec/mux/ps883x.c
> index 1256252eceed..c9bf4b4c2ba1 100644
> --- a/drivers/usb/typec/mux/ps883x.c
> +++ b/drivers/usb/typec/mux/ps883x.c
> @@ -118,12 +118,12 @@ static int ps883x_set(struct ps883x_retimer *retimer, struct typec_retimer_state
>  				CONN_STATUS_1_DP_HPD_LEVEL;
>  
>  			switch (state->mode)  {
> +			case TYPEC_DP_STATE_D:
> +				cfg0 |= CONN_STATUS_0_USB_3_1_CONNECTED;
> +				fallthrough;
>  			case TYPEC_DP_STATE_C:
>  				cfg1 |= CONN_STATUS_1_DP_SINK_REQUESTED |
>  					CONN_STATUS_1_DP_PIN_ASSIGNMENT_C_D;
> -				fallthrough;
> -			case TYPEC_DP_STATE_D:
> -				cfg1 |= CONN_STATUS_0_USB_3_1_CONNECTED;
>  				break;
>  			default: /* MODE_E */
>  				break;
> 
> ---
> base-commit: 645d4eda1d0db0202ed8e4a2c3abb2ebce6b86ef
> change-id: 20260601-ps883x-usb3dp-fixes-32c09e9bd6f6
> 
> Best regards,
> --  
> Stephan Gerhold <stephan.gerhold@linaro.org>

-- 
heikki
Re: [PATCH] usb: typec: ps883x: Fix DP+USB3 configuration
Posted by Jens Glathe 6 days, 10 hours ago
On 6/1/26 15:55, Stephan Gerhold wrote:
> Commit 6bebd9b77726 ("usb: typec: ps883x: Rework ps883x_set()") introduced
> two regressions:
>
>   1. The CONN_STATUS_0_USB_3_1_CONNECTED bit is mistakenly written to the
>      wrong configuration register (cfg1 instead of cfg0). This breaks USB3
>      when using USB3+DP adapters.
>
>   2. The switch-case fallthrough block is inverted: Currently,
>      TYPEC_DP_STATE_C (DP-only) inherits the USB3 configuration, while
>      TYPEC_DP_STATE_D (DP+USB3) is missing the necessary DP sink flags.
>
> Fix these by writing the USB3 bit to the correct register and swapping the
> case statement order so both states get their correct bits assigned.

Hi Stephan,

thank you for the patch. I tested this on my PS8830-equipped boxes, with 
hubs that do USB3+DP splitting.

- Lenovo Thinkpad T14s G6

- Snapdragon Dev Kit for Windows X1E001DE

On both negotiation works well, and DP Altmode and USB3 can be used 
simultaneously. The exclusive cases (with/without hub) also work well.

Tested-by: Jens Glathe <jens.glathe@oldschoolsolutions.biz>

with best regards,

--

Jens

> Cc: stable@vger.kernel.org
> Fixes: 6bebd9b77726 ("usb: typec: ps883x: Rework ps883x_set()")
> Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
> ---
>   drivers/usb/typec/mux/ps883x.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/typec/mux/ps883x.c b/drivers/usb/typec/mux/ps883x.c
> index 1256252eceed..c9bf4b4c2ba1 100644
> --- a/drivers/usb/typec/mux/ps883x.c
> +++ b/drivers/usb/typec/mux/ps883x.c
> @@ -118,12 +118,12 @@ static int ps883x_set(struct ps883x_retimer *retimer, struct typec_retimer_state
>   				CONN_STATUS_1_DP_HPD_LEVEL;
>   
>   			switch (state->mode)  {
> +			case TYPEC_DP_STATE_D:
> +				cfg0 |= CONN_STATUS_0_USB_3_1_CONNECTED;
> +				fallthrough;
>   			case TYPEC_DP_STATE_C:
>   				cfg1 |= CONN_STATUS_1_DP_SINK_REQUESTED |
>   					CONN_STATUS_1_DP_PIN_ASSIGNMENT_C_D;
> -				fallthrough;
> -			case TYPEC_DP_STATE_D:
> -				cfg1 |= CONN_STATUS_0_USB_3_1_CONNECTED;
>   				break;
>   			default: /* MODE_E */
>   				break;
>
> ---
> base-commit: 645d4eda1d0db0202ed8e4a2c3abb2ebce6b86ef
> change-id: 20260601-ps883x-usb3dp-fixes-32c09e9bd6f6
>
> Best regards,
> --
> Stephan Gerhold <stephan.gerhold@linaro.org>
>
>