Skip to contentSkip to conversation

usb: typec: ucsi: Skip CAM query when partner has no alt modes

PATCH In review Gris Ge 3 participants 3 messages Sep 30 – Oct 9

Subsystems (3)
lore
Share & tools
lore

Gris Ge

author
#0 lore raw

PATCH v2 1/1 usb: typec: ucsi: Skip CAM query when partner has no alt modes

Since Thunderbolt alternate mode support was added, ucsi_altmode_update_active() is called on every Connector Partner Changed event. This made the driver send UCSI_GET_CURRENT_CAM to PPMs even when the partner had no alternate modes registered. Firmware that does not support the optional alternate mode details answered Not Supported, which produced a spurious error on every partner change:

```
ucsi_acpi USBC000:00: GET_CURRENT_CAM command failed
```

Fixed by skipping the command when there is nothing to update.

Fixes da87d45b1951 ("usb: typec: ucsi: Add Thunderbolt alternate mode support")
Assisted-by Codex:deepseek-v4.1-flash

---
v2:
- skip the invoke of ucsi_altmode_update_active() in ucsi_handle_connector_change()
v1: https://lore.kernel.org/linux-usb/[email protected]/

 drivers/usb/typec/ucsi/ucsi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/typec/ucsi/ucsi.c +2 -1
index bef3f9b71d71..c392afdc27ae 100644
@@ -1519,7 +1519,8 @@ static void ucsi_handle_connector_change(struct work_struct *work)
 
 	if (con->partner && (change & UCSI_CONSTAT_PARTNER_CHANGE)) {
 		ucsi_partner_change(con);
-		ucsi_altmode_update_active(con);
+		if (con->partner_altmode[0])
+			ucsi_altmode_update_active(con);
 
 		/* Complete pending data role swap */
 		if (!completion_done(&con->complete))

--
2.55.0

Reviewed-by on v2 1/1
#1 lore raw
Quoted 12 lines · Gris Ge

Since Thunderbolt alternate mode support was added, ucsi_altmode_update_active() is called on every Connector Partner Changed event. This made the driver send UCSI_GET_CURRENT_CAM to PPMs even when the partner had no alternate modes registered. Firmware that does not support the optional alternate mode details answered Not Supported, which produced a spurious error on every partner change:

```
ucsi_acpi USBC000:00: GET_CURRENT_CAM command failed
```
Quoted 6 lines

Fixed by skipping the command when there is nothing to update.

Fixes da87d45b1951 ("usb: typec: ucsi: Add Thunderbolt alternate mode support")
Assisted-by Codex:deepseek-v4.1-flash
Quoted 26 lines

---
v2:
- skip the invoke of ucsi_altmode_update_active() in ucsi_handle_connector_change()
v1: https://lore.kernel.org/linux-usb/[email protected]/

 drivers/usb/typec/ucsi/ucsi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/typec/ucsi/ucsi.c +2 -2
index bef3f9b71d71..c392afdc27ae 100644
@@ -1519,7 +1519,8 @@ static void ucsi_handle_connector_change(struct work_struct *work)
 
        if (con->partner && (change & UCSI_CONSTAT_PARTNER_CHANGE)) {
                ucsi_partner_change(con);
-               ucsi_altmode_update_active(con);
+               if (con->partner_altmode[0])
+                       ucsi_altmode_update_active(con);
 
                /* Complete pending data role swap */
                if (!completion_done(&con->complete))
--

2.55.0

maintainer Reviewed-by on v2 1/1
#2 lore raw
In reply to Gris Ge
Quoted 11 lines · Gris Ge

Since Thunderbolt alternate mode support was added, ucsi_altmode_update_active() is called on every Connector Partner Changed event. This made the driver send UCSI_GET_CURRENT_CAM to PPMs even when the partner had no alternate modes registered. Firmware that does not support the optional alternate mode details answered Not Supported, which produced a spurious error on every partner change:

```
ucsi_acpi USBC000:00: GET_CURRENT_CAM command failed
```
Quoted 6 lines

Fixed by skipping the command when there is nothing to update.

Fixes da87d45b1951 ("usb: typec: ucsi: Add Thunderbolt alternate mode support")
Assisted-by Codex:deepseek-v4.1-flash
Quoted 25 lines

---
v2:
- skip the invoke of ucsi_altmode_update_active() in ucsi_handle_connector_change()
v1: https://lore.kernel.org/linux-usb/[email protected]/

 drivers/usb/typec/ucsi/ucsi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/typec/ucsi/ucsi.c +2 -2
index bef3f9b71d71..c392afdc27ae 100644
@@ -1519,7 +1519,8 @@ static void ucsi_handle_connector_change(struct work_struct *work)
 
 	if (con->partner && (change & UCSI_CONSTAT_PARTNER_CHANGE)) {
 		ucsi_partner_change(con);
-		ucsi_altmode_update_active(con);
+		if (con->partner_altmode[0])
+			ucsi_altmode_update_active(con);
 
 		/* Complete pending data role swap */
 		if (!completion_done(&con->complete))
--

2.55.0

Signature · 1 line
heikki