public inbox for chrome-platform@lists.linux.dev
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Andrei Kuchynski <akuchynski@chromium.org>
Cc: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>,
	Benson Leung <bleung@chromium.org>,
	Jameson Thies <jthies@google.com>,
	Tzung-Bi Shih <tzungbi@kernel.org>,
	linux-usb@vger.kernel.org, chrome-platform@lists.linux.dev,
	Guenter Roeck <groeck@chromium.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
	"Christian A. Ehrhardt" <lk@c--e.de>,
	Abel Vesa <abel.vesa@linaro.org>,
	Pooja Katiyar <pooja.katiyar@intel.com>,
	Pavan Holla <pholla@chromium.org>, Madhu M <madhu.m@intel.com>,
	Venkat Jayaraman <venkat.jayaraman@intel.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC 0/8] USB Type-C alternate mode selection
Date: Tue, 23 Dec 2025 13:16:39 +0200	[thread overview]
Message-ID: <aUp6FxThy1r2pNxD@kuha> (raw)
In-Reply-To: <CAMMMRMdwX8wKJz6OEvosVXFH2npr+7pd0pdq3eY9r-Pbr3tjMw@mail.gmail.com>

Hi,

Tue, Dec 16, 2025 at 03:57:40PM +0100, Andrei Kuchynski kirjoitti:
> On Thu, Dec 11, 2025 at 3:23 PM Heikki Krogerus
> <heikki.krogerus@linux.intel.com> wrote:
> >
> > Thu, Dec 11, 2025 at 03:40:24PM +0200, Heikki Krogerus kirjoitti:
> > > Without going into the code review yet, I'm okay with this in general,
> > > except with the artificial SID for the USB4. I still don't understand
> > > why do you guys think we should use that instead of an USB4 specific
> > > device type?
> > >
> > > I think somebody said earlier that the user space can't see the device
> > > type of the alt modes? If that's really the case, then I think there
> > > is some bigger issue here. Are you really sure that if you check the
> > > device type of an alternate mode for example with udevadm, it does not
> > > say DEVTYPE=typec_alternate_mode ?
> > >
> > >         % udevadm info -q property --property=DEVTYPE /sys/bus/typec/devices/port0-partner.0
> > >         DEVTYPE=typec_alternate_mode
> >
> > Or just use grep :)
> >
> >         % grep DEVTYPE /sys/bus/typec/devices/port0-partner.0/uevent
> >         DEVTYPE=typec_alternate_mode
> >
> > So, if that really does not work, then there is a bug somewhere that
> > we obviously need to fix.
> >
> > Please note that the port altmodes are now also part of the bus.
> >
> > Br,
> >
> > --
> > heikki
> 
> Thank you for the review, Heikki.
> 
> The USB4 SID is utilized for distinguishing between USB4 and alternate
> modes internally and is not exposed to user-space. This represents internal
> implementation detail, for example the boolean variable `is_alternate`
> could serve the same purpose as the SID.
> This patch series introduces no new sysfs entries; the only new attribute,
> `priority`, was introduced in the mode priority series, available at
> https://lore.kernel.org/all/20251124124639.1101335-1-akuchynski@chromium.org/
> 
> It is possible to use already existing `usb_capabily` and `usb_mode`
> attributes to manage USB4 mode, allowing verification of USB4 support on
> both the port and the partner. The activation of USB4 is accomplished
> through the implementation of the `enter_usb_mode` typec operation.
> 
> I would like your opinion on whether using a USB4 device type would be a
> better approach.

The device for the USB4 mode will need to have its own device type in
any case, but I'm indeed mainly concerned about how we expose the USB4
mode device to the user space.

As a kernel internal implementation detail the custom SID is probable
fine for now, although I was actually hoping that we could improve the
API a bit. So something like typec_register_mode() type of API. You
probable could introduce something like this for that API:

        struct typec_mode {
                /* enum typec_accessory         accessory; */
                enum usb_mode                   usb;      /* or just USB4 flag */
                struct typec_altmode_desc       *altmode; /* NULL with USB4 */
        };

> Please note that patches 6 and 7 are not part of the mode selection series.
> They are not yet complete and are provided only to demonstrate how the
> entire feature should work.

Got it.

> I confirm there is no issue with the DEVTYPE. Thank you.

Okay, good. So there are no bugs at least :)

Br,

-- 
heikki

  reply	other threads:[~2025-12-23 11:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-01 12:25 [PATCH RFC 0/8] USB Type-C alternate mode selection Andrei Kuchynski
2025-12-01 12:25 ` [PATCH RFC 1/8] usb: typec: Implement " Andrei Kuchynski
2025-12-01 12:25 ` [PATCH RFC 2/8] usb: typec: Integrate USB4 into the mode selection process Andrei Kuchynski
2025-12-01 12:25 ` [PATCH RFC 3/8] usb: typec: Introduce mode_selection bit Andrei Kuchynski
2025-12-01 12:26 ` [PATCH RFC 4/8] usb: typec: ucsi: Support mode selection to activate altmodes Andrei Kuchynski
2025-12-01 12:26 ` [PATCH RFC 5/8] usb: typec: ucsi: Enforce mode selection for cros_ec_ucsi Andrei Kuchynski
2025-12-01 12:26 ` [PATCH RFC 6/8] usb: typec: ucsi: Implement enter_usb_mode operation Andrei Kuchynski
2025-12-01 12:26 ` [PATCH RFC 7/8] usb: typec: ucsi: Support for Thunderbolt alt mode Andrei Kuchynski
2025-12-01 12:26 ` [PATCH RFC 8/8] platform/chrome: cros_ec_typec: Enforce priority-based mode selection Andrei Kuchynski
2025-12-11 13:40 ` [PATCH RFC 0/8] USB Type-C alternate " Heikki Krogerus
2025-12-11 14:22   ` Heikki Krogerus
2025-12-16 14:57     ` Andrei Kuchynski
2025-12-23 11:16       ` Heikki Krogerus [this message]
2026-01-07  9:02         ` Andrei Kuchynski
2026-01-09 13:16           ` Heikki Krogerus

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=aUp6FxThy1r2pNxD@kuha \
    --to=heikki.krogerus@linux.intel.com \
    --cc=abel.vesa@linaro.org \
    --cc=abhishekpandit@chromium.org \
    --cc=akuchynski@chromium.org \
    --cc=bleung@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=groeck@chromium.org \
    --cc=jthies@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=lk@c--e.de \
    --cc=madhu.m@intel.com \
    --cc=pholla@chromium.org \
    --cc=pooja.katiyar@intel.com \
    --cc=tzungbi@kernel.org \
    --cc=venkat.jayaraman@intel.com \
    /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