Skip to contentSkip to conversation

usb: typec: ucsi: Leave the mux to the altmode driver for alt mode partners

PATCH In review Joonhoe Kim 3 participants 3 messages Nov 3 – Nov 6

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: typec: ucsi: Leave the mux to the altmode driver for alt mode partners

Commit 25a2bc21c863 ("usb: typec: ucsi: call typec_set_mode on non-altmode partner change") set TYPEC_STATE_USB only when the partner flags were exactly USB, so that the altmode drivers set up the switches, muxes and retimers for alt mode partners. Commit 226ff2e681d0 ("usb: typec: ucsi: Convert connector specific commands to bitmaps") turned that into a test of the USB bit alone, so a partner that reports both USB and alt mode now gets TYPEC_STATE_USB as well.

On pmic_glink platforms the altmode driver programs the same mux chain, and the two notifications are not ordered. When the UCSI connector change comes last, an FSA4480 switches the SBU lines off, the DisplayPort AUX channel stops working and the sink is never detected. On the Lenovo Y700 Gen 5 (TB323FU, Kaanapali) this happens when a DisplayPort sink is plugged in during system suspend.

Set TYPEC_STATE_USB only when the partner does not report alt mode. USB4 partners keep TYPEC_STATE_USB, as they do now.

Fixes 226ff2e681d0 ("usb: typec: ucsi: Convert connector specific commands to bitmaps")
---
 drivers/usb/typec/ucsi/ucsi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/typec/ucsi/ucsi.c +2 -1
index 2f9adf4f8bde..395554ba0312 100644
@@ -1356,7 +1356,8 @@ static void ucsi_partner_change(struct ucsi_connector *con)
 			typec_set_mode(con->port, TYPEC_MODE_AUDIO);
 			break;
 		default:
-			if (UCSI_CONSTAT(con, PARTNER_FLAG_USB))
+			if (UCSI_CONSTAT(con, PARTNER_FLAG_USB) &&
+			    !UCSI_CONSTAT(con, PARTNER_FLAG_ALT_MODE))
 				typec_set_mode(con->port, TYPEC_STATE_USB);
 		}
 

base-commit: 7649ba73f9e7e1e04d0b46213e39c79ae09dd55c

Signature · 1 line
2.43.0
#1 lore raw
Sashiko has reviewed this patch and found no issues.
Quoted 15 lines

Commit 25a2bc21c863 ("usb: typec: ucsi: call typec_set_mode on non-altmode partner change") set TYPEC_STATE_USB only when the partner flags were exactly USB, so that the altmode drivers set up the switches, muxes and retimers for alt mode partners. Commit 226ff2e681d0 ("usb: typec: ucsi: Convert connector specific commands to bitmaps") turned that into a test of the USB bit alone, so a partner that reports both USB and alt mode now gets TYPEC_STATE_USB as well.

On pmic_glink platforms the altmode driver programs the same mux chain, and the two notifications are not ordered. When the UCSI connector change comes last, an FSA4480 switches the SBU lines off, the DisplayPort AUX channel stops working and the sink is never detected. On the Lenovo Y700 Gen 5 (TB323FU, Kaanapali) this happens when a DisplayPort sink is plugged in during system suspend.

Quoted 6 lines

Set TYPEC_STATE_USB only when the partner does not report alt mode. USB4 partners keep TYPEC_STATE_USB, as they do now.

Fixes 226ff2e681d0 ("usb: typec: ucsi: Convert connector specific commands to bitmaps")

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Joonhoe Kim
Quoted 15 lines · Joonhoe Kim

Commit 25a2bc21c863 ("usb: typec: ucsi: call typec_set_mode on non-altmode partner change") set TYPEC_STATE_USB only when the partner flags were exactly USB, so that the altmode drivers set up the switches, muxes and retimers for alt mode partners. Commit 226ff2e681d0 ("usb: typec: ucsi: Convert connector specific commands to bitmaps") turned that into a test of the USB bit alone, so a partner that reports both USB and alt mode now gets TYPEC_STATE_USB as well.

On pmic_glink platforms the altmode driver programs the same mux chain, and the two notifications are not ordered. When the UCSI connector change comes last, an FSA4480 switches the SBU lines off, the DisplayPort AUX channel stops working and the sink is never detected. On the Lenovo Y700 Gen 5 (TB323FU, Kaanapali) this happens when a DisplayPort sink is plugged in during system suspend.

Quoted 6 lines

Set TYPEC_STATE_USB only when the partner does not report alt mode. USB4 partners keep TYPEC_STATE_USB, as they do now.

Fixes 226ff2e681d0 ("usb: typec: ucsi: Convert connector specific commands to bitmaps")
Quoted 22 lines
---
 drivers/usb/typec/ucsi/ucsi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/typec/ucsi/ucsi.c +2 -1
index 2f9adf4f8bde..395554ba0312 100644
@@ -1356,7 +1356,8 @@ static void ucsi_partner_change(struct ucsi_connector *con)
 			typec_set_mode(con->port, TYPEC_MODE_AUDIO);
 			break;
 		default:
-			if (UCSI_CONSTAT(con, PARTNER_FLAG_USB))
+			if (UCSI_CONSTAT(con, PARTNER_FLAG_USB) &&
+			    !UCSI_CONSTAT(con, PARTNER_FLAG_ALT_MODE))
 				typec_set_mode(con->port, TYPEC_STATE_USB);
 		}
 

base-commit: 7649ba73f9e7e1e04d0b46213e39c79ae09dd55c

Signature · 1 line
2.43.0
Signature · 1 line
heikki