* [PATCH] usb: typec: ucsi: Skip CAM query when partner has no alt modes
@ 2026-09-27 2:16 Gris Ge
2026-09-28 8:47 ` Andrei Kuchynski
0 siblings, 1 reply; 3+ messages in thread
From: Gris Ge @ 2026-09-27 2:16 UTC (permalink / raw)
To: Heikki Krogerus, Greg Kroah-Hartman
Cc: Gris Ge, stable, Benson Leung, Andrei Kuchynski, Jameson Thies,
Pooja Katiyar, Hsin-Te Yuan, Johan Hovold, linux-usb,
linux-kernel
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")
Cc: stable@vger.kernel.org # v7.0+
Assisted-by: Codex:deepseek-v4.1-flash
Signed-off-by: Gris Ge <cnfourt@gmail.com>
---
drivers/usb/typec/ucsi/ucsi.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
index bef3f9b71d71..71b28e4df470 100644
--- a/drivers/usb/typec/ucsi/ucsi.c
+++ b/drivers/usb/typec/ucsi/ucsi.c
@@ -360,6 +360,15 @@ void ucsi_altmode_update_active(struct ucsi_connector *con)
u8 cur;
int i;
+ /*
+ * Alternate mode support is optional, and the PPM is not required to
+ * support GET_CURRENT_CAM when it does not support alternate modes.
+ * There is also nothing to update when the partner has not registered
+ * any alternate modes, so don't send the command in that case.
+ */
+ if (!con->partner_altmode[0])
+ return;
+
command = UCSI_GET_CURRENT_CAM | UCSI_CONNECTOR_NUMBER(con->num);
ret = ucsi_send_command(con->ucsi, command, &cur, sizeof(cur));
if (ret < 0) {
--
2.55.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] usb: typec: ucsi: Skip CAM query when partner has no alt modes
2026-09-27 2:16 [PATCH] usb: typec: ucsi: Skip CAM query when partner has no alt modes Gris Ge
@ 2026-09-28 8:47 ` Andrei Kuchynski
2026-09-28 14:39 ` Heikki Krogerus
0 siblings, 1 reply; 3+ messages in thread
From: Andrei Kuchynski @ 2026-09-28 8:47 UTC (permalink / raw)
To: Gris Ge
Cc: Heikki Krogerus, Greg Kroah-Hartman, stable, Benson Leung,
Jameson Thies, Pooja Katiyar, Hsin-Te Yuan, Johan Hovold,
linux-usb, linux-kernel
On Sun, Sep 27, 2026 at 2:17 AM Gris Ge <cnfourt@gmail.com> wrote:
>
> 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")
> Cc: stable@vger.kernel.org # v7.0+
> Assisted-by: Codex:deepseek-v4.1-flash
> Signed-off-by: Gris Ge <cnfourt@gmail.com>
> ---
> drivers/usb/typec/ucsi/ucsi.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
> index bef3f9b71d71..71b28e4df470 100644
> --- a/drivers/usb/typec/ucsi/ucsi.c
> +++ b/drivers/usb/typec/ucsi/ucsi.c
> @@ -360,6 +360,15 @@ void ucsi_altmode_update_active(struct ucsi_connector *con)
> u8 cur;
> int i;
>
> + /*
> + * Alternate mode support is optional, and the PPM is not required to
> + * support GET_CURRENT_CAM when it does not support alternate modes.
> + * There is also nothing to update when the partner has not registered
> + * any alternate modes, so don't send the command in that case.
> + */
> + if (!con->partner_altmode[0])
Should we move this validation into ucsi_handle_connector_change?
if (con->partner_altmode[0])
ucsi_altmode_update_active(con);
All other call sites are already guarded by this condition.
Besides, I don't think we need that comment above.
Thanks,
Andrei
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] usb: typec: ucsi: Skip CAM query when partner has no alt modes
2026-09-28 8:47 ` Andrei Kuchynski
@ 2026-09-28 14:39 ` Heikki Krogerus
0 siblings, 0 replies; 3+ messages in thread
From: Heikki Krogerus @ 2026-09-28 14:39 UTC (permalink / raw)
To: Andrei Kuchynski
Cc: Gris Ge, Greg Kroah-Hartman, stable, Benson Leung, Jameson Thies,
Pooja Katiyar, Hsin-Te Yuan, Johan Hovold, linux-usb,
linux-kernel
On Mon, Sep 28, 2026 at 08:47:40AM +0000, Andrei Kuchynski wrote:
> On Sun, Sep 27, 2026 at 2:17 AM Gris Ge <cnfourt@gmail.com> wrote:
> >
> > 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")
> > Cc: stable@vger.kernel.org # v7.0+
> > Assisted-by: Codex:deepseek-v4.1-flash
> > Signed-off-by: Gris Ge <cnfourt@gmail.com>
> > ---
> > drivers/usb/typec/ucsi/ucsi.c | 9 +++++++++
> > 1 file changed, 9 insertions(+)
> >
> > diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
> > index bef3f9b71d71..71b28e4df470 100644
> > --- a/drivers/usb/typec/ucsi/ucsi.c
> > +++ b/drivers/usb/typec/ucsi/ucsi.c
> > @@ -360,6 +360,15 @@ void ucsi_altmode_update_active(struct ucsi_connector *con)
> > u8 cur;
> > int i;
> >
> > + /*
> > + * Alternate mode support is optional, and the PPM is not required to
> > + * support GET_CURRENT_CAM when it does not support alternate modes.
> > + * There is also nothing to update when the partner has not registered
> > + * any alternate modes, so don't send the command in that case.
> > + */
> > + if (!con->partner_altmode[0])
>
> Should we move this validation into ucsi_handle_connector_change?
>
> if (con->partner_altmode[0])
> ucsi_altmode_update_active(con);
>
> All other call sites are already guarded by this condition.
Makes sense to me.
> Besides, I don't think we need that comment above.
I agree.
--
heikki
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-28 14:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-27 2:16 [PATCH] usb: typec: ucsi: Skip CAM query when partner has no alt modes Gris Ge
2026-09-28 8:47 ` Andrei Kuchynski
2026-09-28 14:39 ` Heikki Krogerus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®