mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Andrei Kuchynski <akuchynski@chromium.org>
Cc: Gris Ge <cnfourt@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Benson Leung <bleung@chromium.org>,
	Jameson Thies <jthies@google.com>,
	Pooja Katiyar <pooja.katiyar@intel.com>,
	Hsin-Te Yuan <yuanhsinte@chromium.org>,
	Johan Hovold <johan@kernel.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: typec: ucsi: Skip CAM query when partner has no alt modes
Date: Mon, 28 Sep 2026 16:39:01 +0200	[thread overview]
Message-ID: <arp8BXZIrW6UFdbi@black.igk.intel.com> (raw)
In-Reply-To: <CAMMMRMeX9-r_coX1zbUNoMGU+GUW56o4iY_jfyE5_ovFYs6UCA@mail.gmail.com>

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

      reply	other threads:[~2026-09-28 14:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-27  2:16 Gris Ge
2026-09-28  8:47 ` Andrei Kuchynski
2026-09-28 14:39   ` Heikki Krogerus [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=arp8BXZIrW6UFdbi@black.igk.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=akuchynski@chromium.org \
    --cc=bleung@chromium.org \
    --cc=cnfourt@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=johan@kernel.org \
    --cc=jthies@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pooja.katiyar@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=yuanhsinte@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®