Skip to content

J873g: rear USB-C PD controllers through tipd, DisplayPort alt mode from Type-C (M6 Mac mini) - #2486

Draft
sithglan wants to merge 9 commits into
aurora-silicon:mainfrom
sithglan:thomas/j873-typec-tipd
Draft

sithglan wants to merge 9 commits into
aurora-silicon:mainfrom
sithglan:thomas/j873-typec-tipd

Conversation

@sithglan

@sithglan sithglan commented Nov 19, 2026 •

Copy link
Copy Markdown

What: The J873g's (M6 Mac mini) rear USB-C PD controllers move to tipd, and drm/apple takes the T8152 USB-C display state from the Type-C ports, so DisplayPort alt mode runs through their mode switches. Carries #1743's gen4 SPMI interrupt commits.
Tested: J873g M6 Mac mini at f9ad98d1d5d6, before main was merged in: tipd binds the three rear PD controllers; a USB-C monitor in DisplayPort alt mode on back-left and back-right, unplugged, replugged and flipped, at 2560x1440@60 each time; 0 failed units, 0 tipd errors, 0 DART faults (issuecomment-7138244428). The current head, main merged in, is built (Details), not booted yet.
Risk: one-way door (new DT bindings) · J873g (T8152 drm/apple and device tree); the SPMI commits are #1743's and reach its gen4 Macs.
Not yet: a J873g boot of the merge, HDMI included (main now carries #2873, which the earlier head lacked); #1743 leaving draft.

Details

Merge of main (11-24). 4f09b09b0a06 merges main 595384b. The only conflict is in drivers/spmi/spmi-apple-controller.c, between #1743's generation 4 commits (mask and ack banks from the match data, unmask on legacy controllers only) and main's ec141ba (a per-instance vector count, spmi->num_irqs, that T8103 nodes can override from the DT). The merge keeps the match-data banks and the legacy-only paths and counts vectors with spmi->num_irqs everywhere; on generation 4 that equals the match value, as before. The merge builds for the J873g (Image, modules, DTB), and the SPMI driver is clean with W=1.

#1800 (J873g displays in drm/apple) has merged. Still stacked on #1743 (generation-4 SPMI interrupts; its four commits are included unchanged). Review the last four commits. It stays a draft until #1743 leaves draft.

The second PR of the J873g Type-C stack: #1743, this PR, then #2178. The J873g's (Mac mini M6, T8152) three rear USB-C PD controllers (ACE3, sn201202x) now have a single owner, tipd, which runs on their interrupts. drm/apple's T8152 DCPs take DisplayPort alt mode from Type-C instead of polling the controllers over SPMI.

  1. dt-bindings: usb: apple,sn201202x: add the T8152 controllers. apple,t8152-sn201202x with the apple,t8132-sn201202x fallback. Like T8132, the J873g's controllers have no select notification and report the payload length in register 0x1f. tipd's T8132 path needs no change.
  2. dt-bindings: display: apple,t8152-dcp-iboot: describe the USB-C ports as Type-C mode switches. Each port's usb-c node in the shared ports node becomes the port's one display mode switch, with an endpoint at the connector's port@3. It replaces apple,usb-pd.
  3. drm/apple: take the T8152 USB-C display state from the Type-C ports.
    • One Type-C mode switch per rear port, shared by the three DCPs. One switch per DCP would fill the three mode switches a connector's port driver takes (TYPEC_MUX_MAX_DEVS), and leave out the ATC PHY's switch that USB4 needs (J873g: USB4 on the rear USB-C ports through tipd and atc.c (T8152 routers, PCIe-C, M6 Mac mini) #2178).
    • tipd sets the port's state on that switch. It records three things: DP alt mode with HPD high, the pin assignment's lanes, and the plug orientation. Every DCP that drives USB-C is told and looks at the ports 100 ms later.
    • Port claiming, the PHY, the crossbar and the DPTX handling are unchanged.
    • t8152_pd.c is deleted, along with the PD reset ("Gaid", "SSPS") that came with it. A sink that stops answering AUX gets its DisplayPort link released and reconnected instead, at most once a minute.
    • The 250 ms poll remains only for the shared HDMI port's HPD line, which has no interrupt.
  4. arm64: dts: apple: t8152-j873g: hand the rear USB-C PD controllers to tipd.
    • The SPMI controller becomes an interrupt controller (AIC 682).
    • The three controllers get the compatible list, their irq/sleep/wake interrupts (hpm0 11/17/19, hpm1 37/43/45, hpm3 63/69/71) and usb-c-connector children, with graph links to every DCP's route for that port.

Things to know

  • A HPD pulse is not a re-plug. Without a video stream, an EIZO EV2780 drops HPD for about 160 ms every 4.7 s. tipd learns of each pulse afterwards and passes it on as low then high. Treating each pulse as a new sink kept the link from training: link faults, one lane, then a standby link at RBR whose mode list lacked 2560x1440@60, so the next DPMS on failed the atomic check. Now only a changed plug (orientation or lanes), or a sink that leaves DP alt mode with its partner, counts as a new connection.
  • The first DCP to probe registers the three switches, before anything else in its probe. tipd therefore never waits on a DCP that fails to start.
  • The rear ports' USB data path is unchanged (no role-switch links). USB4 through tipd is the next step, reworking J873g: USB4 on the rear USB-C ports through tipd and atc.c (T8152 routers, PCIe-C, M6 Mac mini) #2178.
Evidence

Testing (M6)

The first version, with a switch per DCP, was tested as below. This head was booted with #2178 on top: all three displays, 6/6 DPMS cycles.

Not tested: a physical replug, a flipped plug and a pin D dock. Nobody is at the machine.

cc @Acelogic @RyanTheTide @DjDeveloperr @LiamRay10

@sithglan

Copy link
Copy Markdown
Author

Restacked on #1743 instead of #2466, because Ryan asked to land the generation-4 SPMI interrupts once, in #1743. The head is now bd141acf3f1f (was aedc7af5eb3e). This PR's four commits are unchanged (git range-diff). This exact head is booted on the J873g: tipd binds the three controllers with interrupts, all three displays come back on 6/6 DPMS cycles, and source 63 fires on the S2431W's IRQ_HPD. The full row is on #1743.

@sithglan

Copy link
Copy Markdown
Author

Updated to 182211d0a048 (was bd141acf3f1f): one display switch per rear USB-C port, shared by the three DCPs, instead of a Type-C route per DCP. A connector's port driver takes at most three mode switches (TYPEC_MUX_MAX_DEVS; fwnode_connection_find_matches() stops at the third endpoint without an error). Three DCP routes per connector filled that limit, which would have left out the ATC PHY's switch that USB4 needs (#2178). The switch is the port's usb-c node in the shared ports node, with its endpoint at the connector's port@3. The first DCP to probe registers the switches, and every DCP that drives USB-C is told about each change. The three commits and their messages are updated in place. This tree, with #2178 on top, booted on the J873g: all three displays, 6/6 DPMS cycles.

@sithglan
sithglan force-pushed the thomas/j873-typec-tipd branch from 182211d to 28447d8 Compare November 20, 2026 00:43
@sithglan

Copy link
Copy Markdown
Author

Restacked on #1743's new head 42f3e094cd39, which drops the unreachable stray-loop drain (8 lines removed, nothing else). The head is now 28447d8189f2, with this PR's four commits unchanged. #2178 is restacked on it as 477250a3fb6c.

@sithglan

Copy link
Copy Markdown
Author

Restacked on #1800's new head 41e4cb30ada4, which adds an AFK wait queue for the iBoot DCPs' service waits (details on #1800). The head is now 4e0bf8f084d0 (was 28447d8189f2). This PR's own commits are unchanged: git range-diff shows = for all eight.

@RyanTheTide

Copy link
Copy Markdown

hdmi_pcon_power() in drivers/gpu/drm/apple/t8152_hdmi.c ends with an unconditional msleep(25) after the PS190 power writes, with no reason given for 25 ms. If the converter needs a power-on settle time, cite where the value comes from; better, wait for the thing that actually matters (the PS190 asserting HPD or answering AUX) with a bounded poll. Separately, the iboot_buffered module parameter is harmless with its default but should not be runtime-writable. Until then this should stay a draft.

@RyanTheTide
RyanTheTide marked this pull request as draft November 20, 2026 23:53
@sithglan
sithglan force-pushed the thomas/j873-typec-tipd branch from 4e0bf8f to e65af2d Compare November 21, 2026 01:31
@sithglan

Copy link
Copy Markdown
Author

@RyanTheTide both points are in #1800 (3306da7c8297): the msleep(25) after the PS190 power writes is gone, with the reasoning on #1800, and iboot_buffered is 0444. This PR is restacked on it unchanged (e65af2dabb0e).

@sithglan

Copy link
Copy Markdown
Author

Rebased onto integration/aurora d1b022dc34fb (Ryan's tidy-up on #1799). The new head is 2880a16f6e74. It's on #1800's new head, with #1743's current four commits. The conflicts, the two host-test fixtures that needed the new fields, and the checks (461/461 host tests, W=1 builds) are listed there: #1799 (comment)

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown

Re-checked at 2880a16. The four commits this PR adds range-diff as = against e65af2d, so this is a rebase only. Both of my earlier points are fixed in #1800, which this stacks on: the PS190 settle sleep is gone and iboot_buffered is 0444. Nothing else from me here. This PR now just waits on #1800 and #1743.

Assisted-by: LLM (Claude:Opus 5.5)

@sithglan
sithglan force-pushed the thomas/j873-typec-tipd branch 2 times, most recently from 4aebfd7 to 5fbdac0 Compare November 22, 2026 14:35
@sithglan

Copy link
Copy Markdown
Author

Restacked onto #1800 6f250c0, which adds the display DARTs' power domains (see #1800). This PR's own commits are unchanged.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown

Re-checked at 5fbdac0: a rebase onto #1800 6f250c0; the only difference is the deleted t8152_pd.c now carrying #1800's new comment. Our view stands.

Assisted-by: LLM (Claude:Opus 5.5)

Generation 4 (t8142, t6050) had its interrupt refused at probe. macOS's
trace (reported by Dj on the Aurora M5 Pro thread) acks peripheral sources
0..255 per bit in words from +0x600, with the controller fault source 263
at +0x620 bit 7. On K114c the PMIC RTC alarm sets +0x600 bit 2 (read-only
probe, alarm armed 20 s out).

Take the mask and ack bank offsets from the hw table (gen1 unchanged,
shared with a host check in spmi-apple-irq.h). Generation 4 has no mask
bank we could find (no word in 0x20..0x7f or 0x500..0x6ff toggles), so
sources are masked in the cache only. Commands stay polled: the RX
notification is not wired for gen 4.

Tested: host check of the register math; compile only, not booted.
Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
Probe on K114c: +0x400..0x41c toggle and restore (8 words), +0x420 does not,
matching the +0x600 ack bank 0x200 above (Dj, seq 713, from write offsets in a
macOS trace). The alarm latches +0x600 bit 2 once the PMIC alarm mask byte
0x200e is 0 (as rtc-macsmc writes it) and a write of 4 to +0x600 clears it
(measured). Whether the +0x400 bit gates the AIC line is not measured.

Drop the cache-only masking for gen 4. On a firmware resume re-apply the runtime
mask, since a firmware sleep entry writes the mask bank itself.
Host check extended; compile only, not booted.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
…ask writes

Both open code points from review:

The controller's fault source (263, word 0x620 bit 7 on gen4) shares its
ack word with the notification word the handler reads first, and the
stray-source path acked it directly: queued fault records were lost.
Drain the queue before the bit is acked, in both the notification-word
path and the readq stray path.

gen4 has no notification source, and the word at +0x420 does not behave
as a mask bank, so the init and teardown loops now write only the
num_irqs / 32 mask words on gen4 (the legacy controllers keep the
extra notification word).

The host-test file is dropped: kbuild never built it and it checked
constants against themselves.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
The stray-queue loop visits ack words 0 to 3 (bytes 0 to 24), while the gen4 fault source lives in word 8 (0x620), which the chained handler already reads and drains before acking. The hunk also compared a word index against byte offsets. It could never fire; remove it.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
The USB-C PD controllers behind the J873g's (T8152) SPMI controller at
0x308908000 answer as the T8132 ones do: no register-selection
interrupt, so a selection is polled, and the payload length of the
selected register is read from register 0x1f. Their event, sleep and
wake sources are interrupts 11/17/19, 37/43/45 and 63/69/71 of that
controller.

Add apple,t8152-sn201202x with apple,t8132-sn201202x as fallback, so
that the T8132 interrupt layout (irq, sleep, wake) applies.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
… as Type-C mode switches

A T8152 DCP drives the rear USB-C port whose PD controller reports a
DisplayPort sink. So far the DCP read the controllers itself, through
apple,usb-pd. The controllers belong to the USB Type-C port driver
instead, which passes the DisplayPort alt mode state of a port to the
Type-C mode switches its connector's graph leads to.

Describe one display switch per port, shared by the DCPs: the port's
usb-c node in the shared ports node (the one apple,usb-c-ports refers
to) is the mode switch, with an endpoint at the display port (port@3)
of the port's usb-c-connector. The DCPs already share these nodes for
the port's PHY registers and tunables, and each port has one owner at
a time. One switch per DCP instead would fill the three mode switches
a connector's port driver looks at (fwnode_typec_mux_get() collects
the matches into a three-entry array and stops at the third endpoint
without an error), and leave out the port's ATC PHY, which needs one
for USB4. Drop apple,usb-pd, which nothing reads any more.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@sithglan

Copy link
Copy Markdown
Author

#1797 has merged with its trailer-free head a7907d9. This branch still carried #1797's earlier commits, including 17cb996 with the Co-Authored-By: trailer Ryan asked to drop. I replaced them with the merged ones.

  • This is a message-only remap: f53d6de → 377db77, and the tree is identical (60331d7efe84).
  • This PR's own 36 commits keep the same patches, authors, dates and messages. GitHub now lists only those commits.
  • It merges cleanly into integration/aurora daa9e2d.

Assisted-by: LLM (Claude:Opus 5.5)

@sithglan
sithglan force-pushed the thomas/j873-typec-tipd branch from 377db77 to fcbdb7f Compare November 24, 2026 06:10
@sithglan

Copy link
Copy Markdown
Author

Message-only remap, 377db7710d52 → fcbdb7fadd6d:

#1800 has merged, so of the two prerequisites only #1743 is left.

Assisted-by: LLM (Claude:Opus 5.5)

The T8152 DCPs found a USB-C display by reading the rear ports' PD
controllers over SPMI every 250 ms (t8152_pd.c): plug and orientation
from STATUS (0x1a), DisplayPort connection, pin assignment and HPD
from DATA_STATUS (0x5f), through the controllers' register window
(select at 0x00, length at 0x1f, data from 0x20). With tipd bound to
the same controllers, tipd failed to read its events while the
display path polled. The controllers belong to tipd now.

Take the state from the Type-C class instead: one Type-C mode switch
per rear port, the port's usb-c node in the shared ports node, with an
endpoint at the display port of the port's connector. tipd sets the
port's mode on it. The switch records whether the port is in
DisplayPort alt mode with HPD high, the lanes of the pin assignment
(two for B, D and F, which share the cable with USB 3) and the plug
orientation of the Type-C port, once, next to the port claims of
t8152_atc.c, and tells every DCP that drives USB-C to look at the
ports. The port claim and the PHY, crossbar and DPTX handling of
t8152_atc.c and iboot_drm.c stay as they were.

One switch per port, not one per DCP: a connector's port driver takes
three mode switches at most (TYPEC_MUX_MAX_DEVS;
fwnode_connection_find_matches() stops at the third endpoint and
returns success). A switch per DCP would fill all three on every J873g
rear connector, and the port's ATC PHY, which needs one for USB4,
would never be called.

A HPD pulse is not a new sink. Without a video stream, an EV2780 drops
HPD for about 160 ms every 4.7 s; the PD controller reports it after
the fact, and tipd passes it on as HPD low and then high. Connecting
the sink anew on each pulse kept its link from coming up (link faults,
one lane, then a standby link trained at RBR whose mode list lacked
the enabled mode, so the next DPMS on failed atomic check). The 250 ms
poll never saw these pulses. A switch event is looked at 100 ms later,
which takes such a low and high together, and only a changed plug
(orientation, lanes) or a sink that leaves DP alt mode with its
partner is a new connection.

dcp-fabric.c's route layer itself does not fit these DCPs: it switches
a DP PHY and the display crossbar through their drivers and connects
the sink through the DCP's IOMFB DPTX service, while the iBoot
interface DCPs program the ATC PHY and the crossbar themselves and
connect through their own DPTX port service. Their switches only
record the state, in t8152_typec.c.

The 250 ms work now only re-arms while a DCP can take the shared HDMI
port, whose HPD line has no interrupt.

The PD controller reset that made a sink which stopped answering AUX
enter DP alt mode again (a cold reset, "Gaid", then system power state
S0, "SSPS") is gone: the controller is tipd's, and tipd puts it into
S0 whenever it sets the controller up. What remains is the DisplayPort
side, at most once a minute: release the link and connect the port's
sink again. HPD changes now reach the display path as they happen.

The first DCP that probes registers the switches, ahead of everything
else in its probe, and they stay until the driver is unloaded: tipd
keeps the switch it found, and must not wait for a DCP that cannot
start. Their parent is a faux device of their own ("t8152-typec"), not
that DCP, so unbinding a DCP leaves no switch under an unbound device.
A switch that cannot be registered is disabled in the live tree, so
that tipd goes on without it; the driver keeps that changeset and
reverts it at unload.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
… tipd

The PD controllers of the three rear USB-C ports were described for the
display path alone, which read them over SPMI itself. Describe them
for tipd, which owns them from now on, and the display path takes their
DisplayPort alt mode state from the Type-C class:

- the controllers as apple,t8152-sn201202x, with the T8132 fallback:
  tipd's SPMI transport then polls the register selection and reads
  the payload length from register 0x1f, as these controllers need;
- the SPMI controller (AIC 682) as the interrupt controller of their
  event, sleep and wake sources: 11/17/19 (back-middle), 37/43/45
  (back-left) and 63/69/71 (back-right), rising edge, as in the ADT.
  In a test with the compatibles and interrupts alone, tipd bound all
  three, took its events by interrupt, and both display partners showed
  DisplayPort alt mode active;
- a usb-c-connector per controller, whose display port (port@3) leads
  to the port's usb-c node in the main DCP's shared ports node, the
  port's one display switch for all three DCPs. The USB port (port@0)
  stays unlinked: the USB data path is not changed here.

The DCP's usb-c nodes lose apple,usb-pd, which nothing reads any more.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@sithglan
sithglan force-pushed the thomas/j873-typec-tipd branch from fcbdb7f to f9ad98d Compare November 24, 2026 09:25
@sithglan

Copy link
Copy Markdown
Author

fcbdb7fadd6d → f9ad98d1d5d6: Dj's two t8152_typec.c points from his #2178 review are fixed in "drm/apple: take the T8152 USB-C display state from the Type-C ports" (6cf0ccf5aab2), the commit that adds the file:

  • The USB-C display switches get a parent of their own, a faux device (t8152-typec), instead of the first DCP that probes. It is destroyed at unload after the switches.
  • The status changeset of a port whose switch can't be registered is kept and reverted at unload instead of leaked.

The other seven commits are unchanged (git range-diff =). drivers/gpu/drm/apple/ builds with W=1 and no warnings with CONFIG_DRM_APPLE_DCP_T8152=y, checkpatch --strict adds nothing, and the apple-dcp host tests pass. Not booted on the M6 yet. #2178 is restacked on it. Details: #2178

Assisted-by: LLM (Claude:Opus 5.5)

@sithglan

Copy link
Copy Markdown
Author

J873g boot row on the exact head f9ad98d1d5d6, with the t8152_typec.c owner and changeset fix.

  • Kernel 7.3.0-aurora-j873-r2486+, built from this head, on the M6's default command line. SELinux is disabled on this install.
  • tipd: sn201202x binds the three rear PD controllers (1-0c, 1-08, 1-0a) as Type-C ports 0-2, with no tipd error lines. Port 0's partner is the mini's tether (Apple, product 0x74082164); ports 1 and 2 had nothing plugged in.
  • Switches: the faux device t8152-typec exists, and the three switches dcp-usb-c0-mux, dcp-usb-c1-mux and dcp-usb-c3-mux are registered. Port 0 links to dcp-usb-c0-mux.
  • Display: the HDMI monitor runs as DP-1 through apple-dcpib, with sway on it. The DCP logs "waiting for a USB-C display".
  • Counts: 0 failed units, 0 AVC denials (SELinux disabled), 0 DART faults. The kernel error lines are the base's: compared with integration/aurora b10280c04c2d booted the same way, there are no new ones.

Not in this row: DisplayPort alt mode with a USB-C display, because none was plugged in on this boot. That row follows with a monitor on a rear port.

Assisted-by: LLM (Claude:Opus 5.5)

@sithglan

Copy link
Copy Markdown
Author

J873g DisplayPort alt-mode row on the exact head f9ad98d1d5d6. The monitor (EIZO EV2780, USB-C) was hotplugged by the owner.

  • Kernel 7.3.0-aurora-j873-r2486+, built from this head, on the M6's default command line, enrolled aura 1.0.0b14-gd7f5a487. SELinux is disabled on this install.
  • tipd binds the three rear PD controllers. Back-left is 1-0a (ATC1) and back-right is 1-08 (ATC3); the third has the mini's tether.
step Type-C partner display
plug into back-left DP alt mode ff01 active on 1-0a DCPEXT1: "USB-C display on ATC1 now, was ATC0", common PHY and AUX up from cold, 2-lane DPTX (pin assignment with USB: the monitor's USB hub, HID and billboard enumerated), 2560x1440@60
unplug gone "sink unplugged", ATC1 powered down, the monitor's USB devices gone
replug ff01 active 4-lane setup, link at rate 0x14, 2560x1440@60
unplug, plug flipped into back-left ff01 active the same, 2560x1440@60
move to back-right ff01 active on 1-08 "USB-C display on ATC3 now, was ATC1", from cold, 2560x1440@60

Assisted-by: LLM (Claude:Opus 5.5)

Conflict in drivers/spmi/spmi-apple-controller.c between aurora-silicon#1743's
generation 4 interrupt commits (mask/ack banks from the match data,
legacy-only unmask) and main's ec141ba (per-instance vector count,
spmi->num_irqs): keep the match-data banks and the legacy-only paths,
and count vectors with spmi->num_irqs everywhere, the gen4 resume path
included (it equals the match value there).

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
sithglan added a commit to sithglan/aurora-linux that referenced this pull request Nov 24, 2026
main now carries aurora-silicon#1799 (06bbe5b, f349ba7, cc82020),
whose patches this branch already has as b620188, 2273dcf and
cc129b6 (same patch-ids). The seven files where this branch edits
aurora-silicon#1799's lines afterwards are merged against cc129b6 (the old base
plus aurora-silicon#1799; the integration merge below it touches none of them): six
keep this branch's version, since aurora-silicon#1799 is main's only change to them,
and drivers/phy/apple/atc.c also takes aurora-silicon#2868's two changes (a CIO link
survives the USB host stopping on every generation, T8152 included; a
drive-only DP request succeeds on PHYs without drive control).

The SPMI conflict is resolved in the aurora-silicon#2486 merge.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
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.

3 participants