From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Benson Leung <bleung@google.com>
Cc: Jameson Thies <jthies@google.com>,
Prashant Malani <pmalani@google.com>,
Won Chung <wonchung@google.com>,
linux-usb@vger.kernel.org
Subject: Re: [RFC PATCH 0/2] usb: Link USB devices with their USB Type-C partner counterparts
Date: Wed, 23 Aug 2023 13:01:13 +0300 [thread overview]
Message-ID: <ZOXY6U4RRmmmkmLJ@kuha.fi.intel.com> (raw)
In-Reply-To: <CANLzEkvrg3F=T4jxqcNTMLNgwr8JoN1jCf05P--8oNbN3+56PA@mail.gmail.com>
On Tue, Aug 22, 2023 at 05:24:44PM -0700, Benson Leung wrote:
> Hi Heikki,
>
> On Tue, Aug 22, 2023 at 6:32 AM Heikki Krogerus
> <heikki.krogerus@linux.intel.com> wrote:
> >
> > Hi Benson,
> >
> > RFC for now. I can't test these properly. If you guys could take over
> > this, I would much appreciated. I hope this is at least close to your
> > proposal.
> >
> > With this (or something like it) you should be able to get
> > notification about USB connections and disconnections to your port
> > driver by implementing the new "attach" and "deattach" callbacks in
> > struct typec_partner_desc. The typec partner devices will also have
> > symlinks to the enumerated USB devices and vise versa.
> >
> > I took a little shortcut and did not implement a proper device list.
> > Instead there is now only a member for the USB2 device and a member
> > for the USB3 device in struct typec_port, so with this only USB is
> > supported. But the API does not deal with struct usb_device, so
> > extending this to support other devices (TBT, Displayport, etc.) by
> > adding the actual device list should be fairly easy.
> >
> > thanks,
> >
> > Heikki Krogerus (2):
> > usb: typec: Link enumerated USB devices with Type-C partner
> > usb: Inform the USB Type-C class about enumerated devices
> >
> > drivers/usb/core/hub.c | 4 ++
> > drivers/usb/core/hub.h | 3 +
> > drivers/usb/core/port.c | 19 +++++-
> > drivers/usb/typec/class.c | 108 +++++++++++++++++++++++++++++---
> > drivers/usb/typec/class.h | 16 +++++
> > drivers/usb/typec/port-mapper.c | 9 ++-
> > include/linux/usb/typec.h | 37 +++++++++++
> > 7 files changed, 184 insertions(+), 12 deletions(-)
> >
> > --
> > 2.40.1
> >
>
> Tested-by: Benson Leung <bleung@chromium.org>
>
>
> I picked these two changes back to my Brya/Redrix Chromebook which has
> the PLD changes to link subsystems.
>
> First I plugged in a USB-C to USB-A receptacle adapter with a USB3
> thumbdrive into port0, and went to the port0-partner path.
>
> redrix-rev3 /sys/class/typec/port0-partner # ls -lh
> total 0
> lrwxrwxrwx. 1 root root 0 Aug 22 17:16 2-1 ->
> ../../../../../../../0000:00:0d.0/usb2/2-1
> -r--r--r--. 1 root root 4.0K Aug 22 17:14 accessory_mode
> lrwxrwxrwx. 1 root root 0 Aug 22 17:14 device -> ../../port0
> drwxr-xr-x. 2 root root 0 Aug 22 17:14 identity
> drwxr-xr-x. 2 root root 0 Aug 22 17:14 power
> lrwxrwxrwx. 1 root root 0 Aug 22 17:14 subsystem ->
> ../../../../../../../../../class/typec
> -r--r--r--. 1 root root 4.0K Aug 22 17:14 supports_usb_power_delivery
> -r--r--r--. 1 root root 4.0K Aug 22 17:14 type
> -rw-r--r--. 1 root root 4.0K Aug 22 17:14 uevent
> -r--r--r--. 1 root root 4.0K Aug 22 17:14 usb_power_delivery_revision
>
> 2-1 symlink appears, which is the SuperSpeed usb device associated
> with the thumbdrive.
> Unplugging the USB3 thumbdrive without unplugging the C-to-A adapter,
> and then plugging in a USB2.0 security key:
>
> redrix-rev3 /sys/class/typec/port0-partner # ls -lh
> total 0
> lrwxrwxrwx. 1 root root 0 Aug 22 17:19 3-1 ->
> ../../../../../../../0000:00:14.0/usb3/3-1
> -r--r--r--. 1 root root 4.0K Aug 22 17:14 accessory_mode
> lrwxrwxrwx. 1 root root 0 Aug 22 17:14 device -> ../../port0
> drwxr-xr-x. 2 root root 0 Aug 22 17:14 identity
> drwxr-xr-x. 2 root root 0 Aug 22 17:14 power
> lrwxrwxrwx. 1 root root 0 Aug 22 17:14 subsystem ->
> ../../../../../../../../../class/typec
> -r--r--r--. 1 root root 4.0K Aug 22 17:14 supports_usb_power_delivery
> -r--r--r--. 1 root root 4.0K Aug 22 17:14 type
> -rw-r--r--. 1 root root 4.0K Aug 22 17:14 uevent
> -r--r--r--. 1 root root 4.0K Aug 22 17:14 usb_power_delivery_revision
>
> 2-1 node disappears. 3-1 appears
>
> Unplugging the adapter, plugging in a USB4 hub:
> redrix-rev3 /sys/class/typec/port0-partner # ls -lh
> total 0
> lrwxrwxrwx. 1 root root 0 Aug 22 17:21 2-1 ->
> ../../../../../../../0000:00:0d.0/usb2/2-1
> lrwxrwxrwx. 1 root root 0 Aug 22 17:21 3-1 ->
> ../../../../../../../0000:00:14.0/usb3/3-1
> -r--r--r--. 1 root root 4.0K Aug 22 17:21 accessory_mode
> lrwxrwxrwx. 1 root root 0 Aug 22 17:21 device -> ../../port0
> drwxr-xr-x. 2 root root 0 Aug 22 17:21 identity
> -r--r--r--. 1 root root 4.0K Aug 22 17:21 number_of_alternate_modes
> drwxr-xr-x. 5 root root 0 Aug 22 17:21 pd0
> drwxr-xr-x. 4 root root 0 Aug 22 17:21 port0-partner.0
> drwxr-xr-x. 2 root root 0 Aug 22 17:21 power
> lrwxrwxrwx. 1 root root 0 Aug 22 17:21 subsystem ->
> ../../../../../../../../../class/typec
> -r--r--r--. 1 root root 4.0K Aug 22 17:21 supports_usb_power_delivery
> -r--r--r--. 1 root root 4.0K Aug 22 17:21 type
> -rw-r--r--. 1 root root 4.0K Aug 22 17:21 uevent
> lrwxrwxrwx. 1 root root 0 Aug 22 17:21 usb_power_delivery -> pd0
> -r--r--r--. 1 root root 4.0K Aug 22 17:21 usb_power_delivery_revision
>
> Both 2-1 and 3-1 are linked.
>
> Thanks so much for this, Heikki! I can look a little closer at the
> attach and deattach callbacks in our typec port driver in a little
> while.
Cool! Thank you!
--
heikki
prev parent reply other threads:[~2023-08-23 10:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-22 13:32 [RFC PATCH 0/2] usb: Link USB devices with their USB Type-C partner counterparts Heikki Krogerus
2023-08-22 13:32 ` [RFC PATCH 1/2] usb: typec: Link enumerated USB devices with Type-C partner Heikki Krogerus
2023-08-22 13:32 ` [RFC PATCH 2/2] usb: Inform the USB Type-C class about enumerated devices Heikki Krogerus
2023-08-22 13:58 ` [RFC PATCH 0/2] usb: Link USB devices with their USB Type-C partner counterparts Benson Leung
2023-08-22 14:52 ` Douglas Gilbert
2023-08-23 8:56 ` Heikki Krogerus
2023-08-24 16:51 ` Douglas Gilbert
2023-08-28 9:21 ` Heikki Krogerus
2023-08-29 18:42 ` Douglas Gilbert
2023-08-31 12:25 ` Heikki Krogerus
2023-08-23 0:24 ` Benson Leung
2023-08-23 10:01 ` 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=ZOXY6U4RRmmmkmLJ@kuha.fi.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=bleung@google.com \
--cc=jthies@google.com \
--cc=linux-usb@vger.kernel.org \
--cc=pmalani@google.com \
--cc=wonchung@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.