Skip to content

usb: typec: tipd: key the macOS sleep entry and cable steps on the controller - #2638

Merged
DjDeveloperr merged 1 commit into
integration/aurorafrom
djdev/tipd-macos-sleep-hw-keyed
Nov 21, 2026
Merged

DjDeveloperr merged 1 commit into
integration/aurorafrom
djdev/tipd-macos-sleep-hw-keyed

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Follows the project rule that behaviour is chosen by what the hardware or firmware presents, never by of_machine_is_compatible() or SoC lists. This is the audit of the J714s gates added by #2597, #2598 and #2601. Follow-ups #2639 (replug key) and #2640 (SSPS rules, probe reset) stack on it.

What changes

Effect by board (from the DTs, compiled):

  • J714s: no change, given a DTB built from this tree.
  • J716c: now gets the macOS entry and the USB-wake arm.
  • J813: now gets the macOS entry. T8142 never calls the notifier.
  • J700: no change. Its controllers have interrupts, and it has no apple,cable-change-ssps.
  • J815 and every other board: no change.

Neither J716c nor J813 has been traced or tested with the macOS entry.

Before merge

Review: done. Changes from it: the cable step moved to its own property, controllers holding a debug route are skipped, debug routes opened through debugfs are skipped too, and the "untested" note was added. A J716s entry was wrong and is gone: J716s has no apple,sleep-ssps.

🤖 Generated with Claude Code

@RyanTheTide

RyanTheTide commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for doing the audit. The three selectors now read what the controller presents, and the effect-by-board list matches the DTs I checked. Some points:

  • tipd_replug_supported(): the description says nothing the controller presents provides the DISC unlock key. The binding already has apple,debug-lock-key, though. cd321x_rearm_debug_link() (core.c:1916) reads it, and the J700's controller at 0xc carries "007J". If the replug read its key from that property instead of tipd_replug_key_j714s, with "417J" added to the J714s port nodes, the board check could go too. Any board whose DT names its key would then get the debugfs replug, which is also what the J700 row below needs to run without a hand on the cable.
  • apple,sleep-ssps now selects more than its binding says. apple,sn201202x.yaml:44 describes SSPS around a firmware-driven suspend. After this PR it also selects the running-time cable SSPS/USBw at detach and attach, and the USBw notifier registration. Either extend the description, or give the cable sequence its own property. A separate property would let the J700 keep its suspend SSPS without taking the cable step until that step has run there.
  • tipd_sleep_ssps_rules() (core.c:362) is still a board list (J714s, J716c, J813, J815). It isn't apple,sleep-ssps alone, since the J700 has the property but keeps the old command rules. polled && apple,sleep-ssps wouldn't match the list either, because the J815's controllers have no apple,sleep-ssps (only t8142-j813.dts includes the sleep dtsi). So it probably needs a property of its own. Worth noting in the description as left for later, like the replug.

For the J700, the cable step runs on every detach/attach while running. That needs a cable replug with the partner's enumeration and the SSPS/USBw lines checked, plus one s2idle, since the J700 keeps its old entry.

Assisted-by: LLM (Claude:Opus 5.5)

…ntroller

The macOS sleep entry and wake of an SN201202x, its USB-wake arm after
the PHYs' stop and the SSPS/USBw at a cable change were taken only on
the J714s (of_machine_is_compatible("apple,j714s")). Select them by
what the controller and its DT present instead:

- the sleep entry and wake: a polled controller (no interrupt in the
  DT) that follows the system's power state (apple,sleep-ssps) and arms
  no USB wake of its own (no apple,usb-remote-wake), for a firmware
  sleep, from a port last known dry or mitigated, as before;
- the USB-wake arm: every controller with apple,sleep-ssps registers
  for apple-sleep's notifier; it arms only with that macOS entry and a
  connector with a partner, as before, and only the T6050 sleep's
  .prepare_late calls the notifier;
- the cable change: an SN201202x whose DT asks for it with the new
  apple,cable-change-ssps (set on the J714s's USB-C port controllers,
  where macOS's sequence was traced), with a connector, while running,
  and not one in a debug route (from before Linux, or opened through
  debugfs). It is not
  tied to apple,sleep-ssps: the J700's controllers follow the system's
  power state, but macOS sends them only SSPS around a sleep.

On the J714s nothing changes, given a DTB built from this tree, except
that a USB-C controller in a debug route no longer gets the cable
sequence. The macOS entry now also applies to the other boards whose
DT marks polled SN201202x controllers with apple,sleep-ssps, J716c and
J813, and the USB-wake arm on the T6050 one (J716c). Neither has been
traced or tested with it.

Signed-off-by: Diljit Singh <hey@djdev.me>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DjDeveloperr
DjDeveloperr force-pushed the djdev/tipd-macos-sleep-hw-keyed branch from 116d08c to da8e8fb Compare November 21, 2026 01:11
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Thanks. All three points are in the current stack:

On the M5 (J714s), the three together run with fdc15472 plus those properties: the test boot was clean, the cable sequence ran, every S3 took 10-11 ms, and the macOS entry and the USB-wake arm happened. The gate's sleeps are still going. Their numbers will follow here.

🤖 Generated with Claude Code

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

M5 (J714s) gate for this stack (#2638 + #2639 + #2640). Kernel 7.3.0-m5-sship3 = integration/aurora 5b596e6 + the three, built on the M5. DTB fdc15472 plus the new controller properties (c0440c9e).

Test boot: clean.

  • The three controllers print "port controller ready, polled", from apple,sleep-ssps-rules.
  • The debugfs replug exists on 1-0a and 2-0c, with the key from apple,debug-lock-key.
  • None of the old A/B params remains.

Sleeps: 5 of 5 logind deep sleeps CLEAN, 30 s alarm: 4 entered 40 s after a debugfs replug of 1-0a (the Dell port), 1 plain.

  • Each one slept 27.7-28.1 s and was back 7 s after the alarm.
  • All displays, the Dell hub, the TB5 dock and every USB device came back, and the GPU was alive.
  • 0 hangs, 0 early wakes, 0 S3 refusals.

In the first sleep's log, every step these PRs key on the DT ran with result 0:

  • the cable sequence on 1-0a (register 0x50, SSPS 0x02, SSPS 0x00, USBw 0x00 after the debounce);
  • SSPS S3 in 10-11 ms on all three controllers (the rules);
  • the macOS entry on all three;
  • the USB-wake arm (USBw 0x09) on the partnered USB-C controllers, handed back at the wake.

Afterwards the M5 was restored and verified on its default.

🤖 Generated with Claude Code

@DjDeveloperr
DjDeveloperr merged commit d73563b into integration/aurora Nov 21, 2026
2 checks passed
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Merged as d73563b, after review, green CI on da8e8fb and the J714s gate (5/5 on the stack).

Untested on other boards. This turns on the macOS sleep entry for the polled apple,sleep-ssps controllers of the J716c and the J813, and the USB-wake arm on the J716c. Neither has been traced or tested with them. @erikwb (J716c) and @m0d16l14n1 (J813): please run one replug sleep and one plain deep sleep on a kernel with this merged, then report here. A failing row means this gets reverted.

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants