Skip to content

usb: typec: tipd: the sleep's SSPS rules and the probe reset from the DT - #2640

Merged
DjDeveloperr merged 3 commits into
integration/aurorafrom
djdev/tipd-sleep-rules-from-dt
Nov 21, 2026
Merged

DjDeveloperr merged 3 commits into
integration/aurorafrom
djdev/tipd-sleep-rules-from-dt

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #2638 and #2639, whose commits this branch includes. Review only the last commit, the sleep's SSPS rules and the probe reset from the DT. Part of the no-board-gates rule: board facts go in the DT as properties on the controller nodes, and the per-board lists in tipd go away.

@erikwb and @m0d16l14n1: this changes code from your commits 302cc4e (J716c on the T6050 sleep rules) and f2bdd2e (the M5 Airs on the SSPS rules). Please review it.

What changes

  • tipd_sleep_ssps_rules(), the J714s/J716c/J813/J815 list, becomes a per-controller DT property, apple,sleep-ssps-rules. It sets the same behaviour as before: the controller is woken first, the command's end is read at intervals, a read past the limit that finds it done counts as done, and a failed S3 refuses the sleep.
  • sn201202x_sleep_board() (J714s, J716c; log lines only) keys on the same property. The probe and SLEEP lines therefore now also print on the J813/J815. That is the only behaviour change.
  • The J714s-only probe reset-and-retry (sn201202x_j714s() in sn201202x_init()) becomes apple,reset-on-failed-probe. sn201202x_j714s() goes.
  • The binding documents both properties. Each board's own DTS sets them: J714s (rules + reset, all four controllers), J716c (rules, all four), J813 and J815 (rules, both).

Behaviour: unchanged on every board with a DTB built from this tree, apart from the extra log lines on the J813/J815.

Review: an independent review found nothing blocking. Fixed from it: the binding wording (the past-limit rule applies to every command; the probe retry's real shape), a blank line, a long comment, and the message.

Merge prerequisite (rig): the M5 rig's lab-built DTB (fdc15472) has none of these properties. Without them it would lose the SSPS rules (gapped reads, a wake before SSPS), the replug (#2639) and the cable step (#2638). So these three PRs merge together, after a rig DTB refresh (fdc15472 plus the new properties) has been gated and switched on the M5.

🤖 Generated with Claude Code

@RyanTheTide

Copy link
Copy Markdown
Contributor

Reviewed f2c8080. The controller lists match the old board lists: the J714s and J716c have four port controllers each (hpm0/1/2/5 across the board and SoC dtsi files) and all four get apple,sleep-ssps-rules, the J813 and J815 have hpm0/1 and both get it, and only the J714s gets apple,reset-on-failed-probe. Every former tipd_sleep_ssps_rules() caller already has a tps, so moving from a machine-wide test to a per-controller one changes nothing where the properties are set. Boards without them (J700, T6040/T6041, M1/M2) keep the old command rules, as before.

Assisted-by: LLM (Claude:Opus 5.5)

DjDeveloperr and others added 3 commits November 20, 2026 20:09
…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>
A partner replug ("DISC") was offered only on the J714s, with the
J714s's unlock key built into the driver: "417J", the board number
reversed. The key is a board fact, the same kind of key the
controller's LOCK takes for its debug mode, which the DT already gives
as apple,debug-lock-key (J700: "007J").

Read the key from apple,debug-lock-key. tipd_replug_supported() is
true for an SN201202x whose DT gives a four-character key, and the
replug unlocks with it. The binding's description says the key is the
board number reversed, four characters, and serves both commands. The
J714s's three USB-C port controllers get "417J".

On the J714s the replug behaves as before, given a DTB built from this
tree; with an older DTB it is refused (-EOPNOTSUPP). The J700's debug
port controller already has its key, but its connector has no USB role
switch, so neither debugfs nor dwc3-apple can ask it for a replug. The
debug link rearm needs the key and a sleep that cut that controller's
link (apple,debug-port, the J700's only), so it doesn't start on the
J714s.

Signed-off-by: Diljit Singh <hey@djdev.me>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Three board lists in tipd chose port-controller behaviour by machine:

- tipd_sleep_ssps_rules() (J714s, J716c, J813, J815): the sleep's rules
  for the system power state command (woken first, its end read at
  intervals, a done read past the limit counts, a failed S3 refuses
  the sleep);
- sn201202x_sleep_board() (J714s, J716c): a line at the probe and at
  the sleep's SLEEP;
- sn201202x_j714s() in sn201202x_init() (J714s): a failed probe is
  reset and tried again.

These are board facts, so they move to the controllers' DT nodes:
apple,sleep-ssps-rules (the rules and the lines) on the J714s's,
J716c's, J813's and J815's controllers, and
apple,reset-on-failed-probe on the J714s's. The binding documents
both. tipd_sleep_ssps_rules() and sn201202x_sleep_board() take the
controller (tps, sn) and read the property; sn201202x_j714s() goes.

The same boards get the same behaviour, given a DTB built from this
tree, apart from the probe's and SLEEP's lines, which now also print on
the J813 and J815. The J815 gets the property in its own DTS: it had
the rules from the list without including the J813/J815 sleep dtsi. A
J714s booted with an older DTB loses the rules, the probe reset, the
cable sequence and the replug, so the DTB ships with the kernel.

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-sleep-rules-from-dt branch from f2c8080 to 6465f0a Compare November 21, 2026 01:11
@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 fd2587c into integration/aurora Nov 21, 2026
2 checks passed
@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Merged as fd2587c, after Ryan's review, an independent re-check, green CI on 6465f0a and the J714s gate (5/5 on the stack).

@erikwb and @m0d16l14n1: this changes code from your commits 302cc4e and f2bdd2e. The J716c/J813/J815 board lists became the per-controller apple,sleep-ssps-rules. Please review it after the merge. Behaviour is unchanged with an in-tree DTB, except that the probe and SLEEP lines now also print on the J813/J815.

🤖 Generated with Claude Code

RyanTheTide added a commit that referenced this pull request Nov 22, 2026
Conflicts: tipd core.c/tps6598x.h (integration's #2640 SSPS rules from apple,sleep-ssps-rules replace this branch's apple,sleep-ssps commit 9fc5296, which is dropped; tipd_shutdown()/CMD1 idle wait kept), spmi.c (integration's DT-keyed probe/SLEEP lines and USBw kept; probe waits for CMD1 idle, cold reset only with apple,reset-on-failed-probe, otherwise deferred; the retry loop goes).

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
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