Re: [PATCH 02/19] usb: typec: Add thunderbolt switch

From: Sven Peter

Date: Tue Sep 01 2026 - 15:02:49 EST


Hi Heikki,

On 9/1/26 13:17, Heikki Krogerus wrote:
Hi Sven,

On Sun, Aug 30, 2026 at 10:19:20PM +0200, Sven Peter wrote:
On Apple Silicon the USB4/Thunderbolt host router can only be brought
up after the Type-C PHY has been configured and requires cable details
known only to the Type-C port controller.

The existing orientation switch only forwards the cable orientation.
The mode switch also forwards most of the required details but
represents devices which configure or route the Type-C signal path. The
ACIO host router is a consumer of that path and has additional ordering
requirements: it has to be started after the PHY has been configured
and stopped again before the PHY is disabled.

The mode switch code calls all handlers in the same order both when
entering and leaving a mode and cannot express this reverse teardown
order. Treating ACIO as another mode switch could therefore leave the
NHI active after its PHY has been disabled, which can result in an
asynchronous SError or a SoC watchdog reset.

Add a separate Thunderbolt switch which Type-C port drivers can use to
forward the negotiated Thunderbolt or USB4 cable details and explicitly
order host router setup and teardown around the mode switch. This is
similar to a USB role switch: each connection has exactly one host
router and the callback controls the lifetime of that functional
controller instead of configuring a signal mux.
You are bypassing and duplicating things that are already supported in
the typec bus.

Your typec port driver probable does not register the partner altmode
that you need, so you just need to fix that. After that you should be
able to get the details you need simply by registering a typec bus
notifier in the thunderbolt driver. We can add a helper for that if
needed - the DRM subsystem will use the same notifier with the DP
altmode soon.

Thanks for the pointer, I think that can indeed work out just fine. The bus notifier isn't enough though, I need a notification specifically when typec_altmode_update_active() happens (and not when the partner is registered as a possible altmode) and that only triggers a sysfs_notify and a kobject_uevent unless I'm missing something. Adding a simple notifier call chain should be possible there though.



USB4 is meant to be handled as an altmode too, but it looks like it is
not supported yet - I need to check the status with that. This may
still need to be fixed, but that should not be a problem.

It isn't, but that indeed should not be hard to add.

Best,


Sven