From 8db52753fe3ca4d4b66aad9dd918711eebc47883 Mon Sep 17 00:00:00 2001 From: Erik Bourget Date: Sun, 15 Nov 2026 23:52:42 -0500 Subject: [PATCH 1/2] thunderbolt: apple: T6050: J716c: the USB4 router sleeps in place, as on the J714s The J716c has the J714s's T6050 USB4 router, NHI and tunnelled PCIe, and its right port is acio2 as on the J714s. Apply the J714s's rules for a router that sleeps in place with a dock attached to the J716c too: the USB host's binding to the router, the router's CIO frames and power roles in the suspend, the tunnel's domain after a refused sleep, the retimer scan that the dock's link does not take, and the router's sleep teardown. The left ports are powered off for the sleep. The J714s-only diagnostics stay J714s only. Developed with Claude Code. Signed-off-by: Erik Bourget --- drivers/thunderbolt/apple-cio-sleep.c | 10 ++++++---- drivers/thunderbolt/apple.c | 3 ++- drivers/thunderbolt/retimer.c | 2 +- drivers/thunderbolt/switch.c | 9 ++++++--- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/thunderbolt/apple-cio-sleep.c b/drivers/thunderbolt/apple-cio-sleep.c index ba4d01e7f0732..d852e65f3d1a9 100644 --- a/drivers/thunderbolt/apple-cio-sleep.c +++ b/drivers/thunderbolt/apple-cio-sleep.c @@ -323,7 +323,8 @@ static void apple_nhi_cio_phy_put(struct apple_nhi *anhi) static void apple_nhi_cio_usb_bind(struct apple_nhi *anhi, bool bind) { if (bind) { - if (!of_machine_is_compatible("apple,j714s")) + if (!(of_machine_is_compatible("apple,j714s") || + of_machine_is_compatible("apple,j716c"))) return; anhi->cio_phy_usb = symbol_get(apple_t6050_phy_cio_usb); if (anhi->cio_phy_usb) @@ -448,7 +449,7 @@ static int apple_nhi_cio_bind(struct apple_nhi *anhi) if (!cio_s2r) return 0; if (anhi->acio->hw == &apple_cio_t6050_hw && - of_machine_is_compatible("apple,j714s")) { + (of_machine_is_compatible("apple,j714s") || of_machine_is_compatible("apple,j716c"))) { ret = apple_nhi_cio_bind_owner_t6050(anhi); if (ret == -EPROBE_DEFER) return ret; @@ -950,7 +951,7 @@ static int apple_nhi_cio_suspend_t6050(struct apple_nhi *anhi) * its DART's clock protection by now, as macOS does before this gate. A sleep refused * below powers it again here, before the PCIe-C port's resume starts the port from cold. */ - if (of_machine_is_compatible("apple,j714s")) { + if ((of_machine_is_compatible("apple,j714s") || of_machine_is_compatible("apple,j716c"))) { struct device *pd = anhi->acio->pd_list->pd_devs[apple_nhi_cio_tunnel_pd[0]]; int held, on, ps; /* TEST */ @@ -967,7 +968,8 @@ static int apple_nhi_cio_suspend_t6050(struct apple_nhi *anhi) if (ret) { /* TEST (J714s): the router is awake again: its tunnel's USB host comes off it first. */ apple_nhi_cio_usb_park(anhi, "after the refused sleep"); - if (of_machine_is_compatible("apple,j714s") && + if ((of_machine_is_compatible("apple,j714s") || + of_machine_is_compatible("apple,j716c")) && apple_nhi_cio_domains_t6050(anhi, apple_nhi_cio_tunnel_pd, ARRAY_SIZE(apple_nhi_cio_tunnel_pd), true) < 0) dev_err(anhi->dev, "T6050 sleep: the tunnelled PCIe's domain not back after the refused sleep: the PCIe-C port's resume follows all the same\n"); diff --git a/drivers/thunderbolt/apple.c b/drivers/thunderbolt/apple.c index be0c647b30de4..ac8e1a4205098 100644 --- a/drivers/thunderbolt/apple.c +++ b/drivers/thunderbolt/apple.c @@ -3988,7 +3988,8 @@ static int apple_cio_tbt_switch_set(struct typec_thunderbolt_switch_dev *sw, /* The T6050 firmware sleep, selected by the sleep driver's profile and mem_sleep. */ static bool apple_cio_t6050_sleep(struct apple_cio *acio) { - return of_machine_is_compatible("apple,j714s") && + return (of_machine_is_compatible("apple,j714s") || + of_machine_is_compatible("apple,j716c")) && READ_ONCE(t6050_sleep_teardown) && acio->hw == &apple_cio_t6050_hw && apple_sleep_v27_late() && !pm_suspend_default_s2idle(); } diff --git a/drivers/thunderbolt/retimer.c b/drivers/thunderbolt/retimer.c index a93ae6a33bc37..39045b44a4a5a 100644 --- a/drivers/thunderbolt/retimer.c +++ b/drivers/thunderbolt/retimer.c @@ -507,7 +507,7 @@ static struct tb_retimer *tb_port_find_retimer(struct tb_port *port, u8 index) static bool tb_retimer_scan_skip(struct tb_port *port) { if (!(port->sw->tb->nhi->quirks & QUIRK_CIO_MACOS_FRAMES) || - !of_machine_is_compatible("apple,j714s")) + !(of_machine_is_compatible("apple,j714s") || of_machine_is_compatible("apple,j716c"))) return false; tb_port_info(port, "TEST sv6u5: no retimer scan on this link (macOS sends no retimer sideband operation)\n"); return true; diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c index 0aaec06be281e..99c28d6634a5d 100644 --- a/drivers/thunderbolt/switch.c +++ b/drivers/thunderbolt/switch.c @@ -3819,7 +3819,8 @@ static int tb_switch_sleep_cio_frames(struct tb_switch *sw) ret = usb4_switch_set_sleep(sw); tb_cio_test_dock.ready = ktime_get(); tb_cio_test_dock.ret = ret; - if (!ret && of_machine_is_compatible("apple,j714s")) + if (!ret && (of_machine_is_compatible("apple,j714s") || + of_machine_is_compatible("apple,j716c"))) msleep(TB_CIO_MACOS_HOST_AFTER_DOCK_MS); return ret; } @@ -4101,7 +4102,8 @@ int tb_switch_cio_pm_roles(struct tb_switch *sw) if (!parent || tb_route(parent) || !(parent->quirks & QUIRK_NO_CLX) || !(sw->tb->nhi->quirks & QUIRK_CIO_MACOS_FRAMES) || !tb_switch_is_usb4(parent) || - !tb_switch_is_usb4(sw) || !of_machine_is_compatible("apple,j714s")) + !tb_switch_is_usb4(sw) || !(of_machine_is_compatible("apple,j714s") || + of_machine_is_compatible("apple,j716c"))) return 0; /* TEST (sv6u3) */ tb_cio_test_roles_words(sw, &tb_cio_test_roles.down_was, &tb_cio_test_roles.up_was); @@ -4139,7 +4141,8 @@ int tb_switch_suspend_cio(struct tb_switch *sw) if (ret) return ret; if ((sw->tb->nhi->quirks & QUIRK_CIO_MACOS_FRAMES) && tb_switch_is_usb4(sw) && - !tb_route(sw) && of_machine_is_compatible("apple,j714s")) { + !tb_route(sw) && (of_machine_is_compatible("apple,j714s") || + of_machine_is_compatible("apple,j716c"))) { ret = tb_switch_cio_macos_host_state(sw); tb_cio_test_host.ret = ret; /* TEST */ if (ret) From 1d2639d281891cf6471f0cb70316d87d9861a46b Mon Sep 17 00:00:00 2001 From: Erik Bourget Date: Tue, 17 Nov 2026 00:00:18 -0500 Subject: [PATCH 2/2] thunderbolt: apple: T6050: J716c: the router's domain step and LSTX hold as on the J714s The J716c's USB4 router sleeps in place the way the J714s's does, and needs the same two rules at its power-off: - the router's own domain (ATC2_CIO), held on by its DART, is taken down at the entry and raised again only after the PHY at the wake, so that a dock's link trains in place; - LSTX is held high through the sleep, so that an attached dock's CIO wake source does not assert right after the commit. Apply both on the J716c too. Developed with Claude Code. Signed-off-by: Erik Bourget --- drivers/thunderbolt/apple-cio-sleep.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/thunderbolt/apple-cio-sleep.c b/drivers/thunderbolt/apple-cio-sleep.c index d852e65f3d1a9..d6ce8599a1ff5 100644 --- a/drivers/thunderbolt/apple-cio-sleep.c +++ b/drivers/thunderbolt/apple-cio-sleep.c @@ -896,8 +896,9 @@ static int apple_nhi_cio_power_off_t6050(struct apple_nhi *anhi) apple_cio_cpu_halt(acio); if (ret) return ret; - /* J714s holds LSTX high through sleep; do not read the halted rc block. */ - ret = apple_cio_lstx_hold(acio, of_machine_is_compatible("apple,j714s")); + /* J714s and J716c hold LSTX high through sleep; do not read the halted rc block. */ + ret = apple_cio_lstx_hold(acio, of_machine_is_compatible("apple,j714s") || + of_machine_is_compatible("apple,j716c")); if (ret) return ret; } @@ -905,7 +906,8 @@ static int apple_nhi_cio_power_off_t6050(struct apple_nhi *anhi) if (ret < 0) return ret; /* Held on by its DART: taken down here, before the PHY's shutdown, as macOS does. */ - if (ret && of_machine_is_compatible("apple,j714s")) { + if (ret && (of_machine_is_compatible("apple,j714s") || + of_machine_is_compatible("apple,j716c"))) { int down = apple_nhi_cio_router_pd_set(anhi, false); if (!down) {