Skip to content

J873g: HDMI and USB-C displays (apple_dcpib, T8152 Gen3 display DARTs, M6 Mac mini) - #1800

Open
sithglan wants to merge 95 commits into
aurora-silicon:integration/aurorafrom
sithglan:thomas/j873-dcp
Open

sithglan wants to merge 95 commits into
aurora-silicon:integration/aurorafrom
sithglan:thomas/j873-dcp

Conversation

@sithglan

@sithglan sithglan commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #1797 (aurora-wip merge for the J873g). Review the last 14 commits.

This brings the J873g (Mac mini M6, T8152) display driver to integration/aurora: HDMI, plus a USB-C display on the rear ports. It carries #1019 (draft, against aurora-wip) forward onto integration and adds what integration lacks for it.

  • J873: port DCP display support and guard AFK handoff #1019 carried:
    • The apple_dcpib port (81cba10), split into RTKit, binding and driver commits.
    • The DCPAV idle fix (re-send SET_MODE, de833a1).
    • Acelogic's fixes aedad98, 241cdf6 and 7916972, the last two split into binding and driver parts. 3b25193 and b58ef0f are folded into the driver and DART commits.
    • a3f06f7 is dropped: integration already has the T8152 mailbox and SPMI matches.
  • New: Gen3 display DARTs (apple,t8152-dart-gen3).
    • The bootloader leaves the DCP DARTs locked with live tables. On them, 0x80 answers translation queries instead of flushing, so the existing T8152/T8110 path would flush nothing.
    • The TLB is invalidated through the TLBI aperture. On VHE this happens in the EL1&0 regime, because Linux runs at EL2.
    • No fault IRQ is claimed, and an unlocked Gen3 DART is refused.
  • DT:
    • The display DARTs are described as Gen3 in t8152-peripherals.dtsi.
    • New t8152-j873-dcp.dtsi: the two DCPs (display@286e00000 with the rear USB-C ports, display@32ae00000 with the HDMI PHY), their mailboxes, the AOP GPIO for HDMI hot plug, and the SPMI USB-PD controllers.

Loader requirements

The driver adopts the DCP session the loader leaves running, so it needs:

  • the DCP handed over with RTKit on and its AFK endpoints stopped (aura's DCP_HANDOFF);
  • the DARTs locked;
  • the framebuffer in simple-framebuffer;
  • apple,afk-active-endpoints on each DCP node.

Only Acelogic's unmerged aura branch j873-afk-handoff sets the last one. The M6 boots through a self-booting aura Stage 1 whose handoff stops every endpoint, so its DTB carries apple,afk-active-endpoints = <0>, added with fdtput.

Not included

  • HDMI audio (dpaudio). It needs an unlocked Gen3 audio DART, DPAV activation and an ADMAC change, and its DMA never drained on linux-aurora j873.
  • CONFIG_TYPEC_SN201202X must stay off, because the driver commands the PD controllers directly.

Known rough edges for review

  • Endpoints are started with a hand-built RTKit management message.
  • The driver writes PMGR power, ATC PHY and PD controller ("Gaid"/"SSPS") registers directly instead of going through the power-domain, PHY and Type-C frameworks.
  • Gen3 DART faults are not handled.
  • After a failed adoption the device stays bound, and the driver has no remove.
  • The scanout cache clean (arch_wb_cache_pmem()) is a no-op without ARM64_PMEM.

Sign-off

Acelogic's three #1019 commits (aedad98, 241cdf6, 7916972) had no Signed-off-by. He has given his OK, so the five commits here that come from them now carry his sign-off ahead of mine.

Testing (M6, macOS 27.2 stub, Linux at EL2)

This series, #1797 and the other J873g PRs make up the M6's default kernel. It boots by itself from the ESP.

  • The four display DARTs probe: "Gen3 DART, version 0x300, TLBI route 0/2".
  • "HDMI from the main DCP (no USB-C display at boot)" and "HDMI: inherited source select 0, PLL locked".
  • AFK services open, including the dcpav/dcpdp controllers and dcpdptx ports. The sink reports 39 timing and 10 colour modes, and the 256-byte EDID is read.
  • The link trains on 4 lanes. The driver registers on DRM minor 1.
  • HDMI-A-1 is connected at 2560x1440@59.95 and sway runs on it.
  • Idle-off: more than three minutes after boot there is no further driver message, and the connector stays connected with DPMS on.
  • Each commit builds its objects with W=1 and adds no warnings. The two new bindings pass dt_binding_check, and the J873g DTB passes CHECK_DTBS apart from warnings already in the base. The tools/asahi/apple-dart-* tests pass.
  • scripts/dtc/apple-dt-check.sh against integration/aurora fdef45b: 0 new CHECK_DTBS warnings (8 fewer), every changed binding passes dt_binding_check.

Supersedes #1019 for integration/aurora.

cc @Acelogic @RyanTheTide @DjDeveloperr @LiamRay10

sithglan and others added 30 commits November 6, 2026 11:23
The T8152 (M6) Always-On Processor differs from the T8140 one: its setup
port is not reachable from the AP, so it has one mailbox, and its audio
service uses six serializer power domains and the jack, speaker and
speaker-sense ADMAC channels.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Add the Mac mini M6 (J873) sound card.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The J873 (Mac mini M6) AOP runs the same firmware generation as T8140
(EPIC v4, iBoot-loaded, started by the AP), but the T8140 "setup port"
is not reachable from the AP: mailbox 1 of the AOP's mailbox bank and the
ADT aop-exclave-mailbox both bus-error. The firmware boots without it:
RTKit protocol 12, then its "audio" EPIC service. Add apple,t8152-aop
with the T8140 configuration minus the setup port, starting every
advertised endpoint.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The Mac mini (M6, J873) speaker runs a 250-BCLK TDM frame, which the
SN012776's ratio auto-detection rejects. Describe the property that fixes
the ratio instead.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The J873 (Mac mini M6) AOP runs the speaker frame at 250 BCLKs of 12 MHz.
The SN012776 cannot auto-detect that ratio and mutes with "fault: bad
TDM clock". With TAS2764_CLK_CFG (register 0x60) set to 0x30 and
TDM_CFG0 bit 6 set it accepts the frame and plays. Do that when the new
ti,bclk-ratio property names the ratio; only this one ratio is supported.

Source of the value: the register write was first seen in the macOS
SN012776 driver; it is a single register value, and its effect (no fault,
correct playback) was verified on J873 hardware. No table or code was
taken from macOS.

The field is initialised in probe, so non-OF matches keep auto-detection.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The SDOUT1 mux offers the ASP receive channels as a source, but no DAPM
route connected them, so selecting "ASP RX CH1" or "ASP RX CH2" left the
capture path without an input. The J873 and J813 AOP audio services use
it to loop the playback stream back.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
On T8152 (J873, Mac mini M6) the AOP firmware owns the audio fabric, as
on T8140. Its "audio" EPIC service offers cout/cin (the CS42L84 jack,
base-ns ADMAC TX5/RX5, MCA4) and spkr (the SN012776 speaker, TX1, MCA0).

Each service is an ASoC back-end DAI: startup attaches it, requests pw0
(which raises the audio fabric) and powers the MCA leaves, all of which
are required. pwrd starts the serializer clocks at prepare, before ASoC
unmutes the codecs: the jack codec locks its PLL to the bit clock, and
the speaker amplifier reports "bad TDM clock" whenever it runs without
one. The jack restarts its clocks on every prepare so that a stream
restarted after an underrun begins on a frame boundary; the mono speaker
(one slot per frame) keeps them running. The front-ends are dmaengine
PCMs on the base-ns channels: the jack in stereo, the speaker in mono
(its serializer runs one 32-bit slot; stereo frames play at half pitch).

The firmware's serializer configuration (property 701) is byte-identical
to the one macOS publishes, so the driver leaves it alone.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The J873 (Mac mini M6) uses the T8152 AOP audio driver as its CPU
component: the CS42L84 jack on "cout" (DSP_A | IB_NF, one-BCLK sync
pulse) and one SN012776 on "spkr" (I2S, NB_IF: data sampled on the rising
edge, as macOS programs the amp).

Each AOP front-end owns the DMA channel of one serializer, so the speaker
can only be fed from the secondary front-end; the new spk_secondary_only
sets the speaker mux accordingly, and spk_dai_fmt gives the speaker link
its own format.

There is no qualified speaker protection for J873 yet (no verified sense
path, thermal model or power budget), so the speaker fails closed: it is
only enabled with please_blow_up_my_speakers. Opted in, it runs as macOS
runs it: amp gain 15 (ADT speaker-config) and no volume lock (safe_vol 0),
since there is no sense stream for a protection daemon. The jack is not
affected.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The T8142 AOP keeps its crash buffer in its own slot of its DART stream
and asks for it on endpoint 1 with that IOVA. A client without
shmem_setup refused the request, so the firmware never got its crash
buffer acknowledged.

APPLE_RTKIT_FIRMWARE_OWNED_CRASHLOG takes such a buffer as the firmware's,
without a CPU mapping, and acknowledges the request unchanged; a later
crash is reported without a log. RtKit::new_with_firmware_crashlog()
selects it at runtime, so a driver can use it for one SoC only.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The T8142 AOP (MacBook Air J813) waits for the host on a setup port, as
the T8140 one does: the ADT's aop-exclave-mailbox at 0x3d067c000 (AOP
ASC + 0x4007c000, not behind the arm-io translation). Its EPMAP announces
other service endpoints than T8140's fixed set (0x4, 0x20, 0x23 and 0x32
on J813), so take the endpoints that must get buffers from the EPMAP when
the match data says so.

The firmware places its own crash log buffer in its firmware-mapped DART
slot; accept it as the firmware's, as for G17P.

After the setup boot all AFK endpoints start, and with the audio fabric
left to the firmware (see the J813 device tree) the firmware announces
its "audio" EPIC service.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Behind an AOP the serializer feeding a capture channel is the firmware's,
and it stops in the middle of a frame whenever it likes. A capture that
stays open across such stops (the speaker V/I sense, which a protection
daemon reads for as long as it runs) then carries the partial frame
forward: every later frame is off by its words, and the samples of one
amplifier are read as another's. On the MacBook Air J813 one restart in
three slipped by one 16-bit word.

Let a client pass the frame size in bytes as a u32 in
dma_slave_config.peripheral_config. A paused cyclic capture on such a
channel resumes at the next frame boundary of its current period: the
reports completed before the pause are accounted for, the rings are
reset and the rest of the period is submitted from the aligned address,
then whole periods as before. Without a frame size nothing changes.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The J813 speaker stream (ADT iop-audio-controller/audio-speaker) differs
from J873's: four SN012776 in 32-bit playback slots 0-3, and their voltage
and current sense back on the same stream's RX side (base-ns RX0) as eight
16-bit slots. Make the speaker and sense shapes per-SoC match data:
J873 keeps one playback channel; T8142 gets four, and an 8-channel S16_LE
"Speaker Sense" front-end.

The sense capture is the speaker serializer's RX, which the firmware
stops anywhere in a frame. Before every `pwrd` of the speaker, restart a
running sense capture at a frame boundary (apple-admac realignment, the
partial frame reads as zeros), so that a protection daemon that keeps it
open attributes each amplifier's voltage and current to the right one.

The sense back-end also attaches the speaker service and requests `pw0 `
at startup: its front-end requests the ADMAC channel next, and the ADMAC
only answers while the firmware holds the audio fabric up. Opening the
sense before any other stream since the AOP started (speakersafetyd at
boot) otherwise faults the bus.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
MacBook Air 13" M5 (T8142): as on J873 the AOP firmware owns the audio
fabric and the CPU component is the T8152-style AOP audio driver. The
jack is a CS42L84 on "cout", the speakers four SN012776 (one woofer and
one tweeter per side) on "spkr", with their V/I sense on the same stream.
As on the other SN012776 laptops the speaker volume stays locked until a
protection daemon (speakersafetyd) holds it.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The MacBook Air J813's three microphones are the AOP's "hpai" service
(ADT iop-audio-controller/audio-hp-mic): the firmware runs the PDM part
and delivers 48 kHz float32 frames of three channels (the ADT's
audio-hp-mic-proxy description: 12 bytes per frame) on leap-s ADMAC RX0.
There is no codec, so it gets a card of its own with one capture PCM,
named like the other AOP microphone cards (AppleJ813HPAI, "MacBook Air
J813 High-Power Audio Interface", driver aop_audio) so that the existing
UCM and DSP configurations for those apply.

As on T8140: open attaches the service and requests pw0 (which raises
the LEAP fabric), powers the LEAP leaves (leap-s ADMAC, RX0, LEAP MCA),
and only then requests the channel, whose registers fault without them.
The trigger starts the DMA and queues pwrd behind it; started earlier,
the LEAP produces into a channel nobody services. Close releases the
channel, then pw0 and the leaves.

The card exists only where the DT gives the LEAP power domains (all
three); J873 is unchanged. The dmaengine substream setup moves into a
helper shared with the ASoC front-ends.

Tested on J813: a tone from the speakers reads -44 to -49 dBFS on all
three channels, 70 dB over the quiet floor, exactly while it plays;
PipeWire picks up the card with asahi-audio's J613 beamformer graph.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
integration/aurora added the nCal boot argument and word-wise boot-argument
access to AopHwConfig. Both machine configurations keep the firmware's own
boot arguments unchanged, so set ncal to zero and leave word access off.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Every boot on the J616s logged "spi-nor spi0.0: supply vcc not found,
using dummy regulator". The M1, M2, M3, J713 and J700 trees describe the
flash's always-on PMU rail as a fixed regulator; the M4 Pro/Max tree
came later and has none. Add the same regulator and point the flash at it.

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Assisted-by: LLM
Preserve current RTKit crashlog and GPU handling while retaining the expanded macaudio bindings and adding J813/J873 compatibles. Original audio commits and authorship are preserved.
…ation

Test whether COUT standby supplies the missing cold-boot fabric setup. A muted zero-data jack stream permitted HPAI capture and subsequent capture-only opens on J813; standby without any playback is the next hardware qualification step.

Preserve Thomas Glanzmann’s driver and adapt the T8140 DMA sync-stop pattern from Ryan Murray, also flushing queued HPAI work before DMA teardown. No LPAI buffer binding or codec unmute is performed.
…queue

Describe the T8142 microphone DMA and LEAP power domains and card names in the shared audio binding. Queue sleeping firmware power requests on system_dfl instead of the deprecated system workqueue, as directed by the runtime warning observed during hardware capture tests.
…-initialization-20261106

ASoC: apple: integrate J813 audio with first-open microphone initialization
…616-nor-vcc

arm64: dts: apple: t604x-j614-j616: Describe the boot NOR flash supply
Resolves sound/soc/apple/macaudio.c: aurora-wip added spk_dai_fmt and
spk_secondary_only (J813/J873) where integration added tweeter_hpf_granted
(speaker protection ownership); the struct keeps all three.

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Assisted-by: LLM
Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Assisted-by: LLM
…nc-20261107

Merge integration/aurora into aurora-wip (11-07)
Brings aurora-wip up to integration/aurora 068dfce: pcie-apple endpoint
reset retry (aurora-silicon#1069) and the
tools/aurora-sep PKGBUILD checksum fix
(aurora-silicon#1068).

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Assisted-by: LLM
…n/wip-sync-20261107b

aurora-wip <- integration/aurora 068dfce (aurora-silicon#1068, aurora-silicon#1069). Clean merge, W=1 pcie-apple.o 0 warnings on the merged tree, CI host-tests/rust-build/source pass. Merge train (MTR).
Brings aurora-wip up to the tested release branch: CTXR execmem
(aurora-silicon#985, aurora-silicon#1079), KFIX speaker sleep and resume fixes (aurora-silicon#1077, aurora-silicon#1080),
JPEG v2 (aurora-silicon#1072), Jonathan's G17 and USB work (aurora-silicon#1073-aurora-silicon#1076), brcmfmac
flowring count (aurora-silicon#1081), ANE H16 startup restart (aurora-silicon#1066) and the
Touch ID per-prompt match (aurora-silicon#904).

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Assisted-by: LLM
Adds the 11-07 evening batch: t8140 disabled SPI3/FPWM0/SPMI nodes
(aurora-silicon#1034), J700 CPU zones (aurora-silicon#1043), J616C fans (aurora-silicon#1092) and the thunderbolt
DP PM workqueue fix (aurora-silicon#1098).

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Assisted-by: LLM
…n/wip-sync-20261107c

Gate on the exact head tree 6c684e8 (buildbox): fleet22-config Image+modules+dtbs build rc=0, 0 errors, 0 warnings, 5890 modules (= fleet); run-host-tests 193/193; apple-dcp host selftests 86/86 (fleet baseline 86/86). CI host-tests/source/rust-build green. Brings aurora-wip up to integration/aurora 810b92c.
Brings aurora-wip up to fleet25: DT descriptions (aurora-silicon#1029, aurora-silicon#1030, aurora-silicon#1112),
the J715 board (aurora-silicon#1129), Stockholm NFC (aurora-silicon#1042, aurora-silicon#1136), the AV1 tile check
(aurora-silicon#1100), the M4 Max ANE profile and AVD quirk (aurora-silicon#1088, aurora-silicon#1091), boot-log
fixes (aurora-silicon#1103, aurora-silicon#1104) and the Neo ANE memory floor (aurora-silicon#1137).

Conflicts: macaudio.c and apple,macaudio.yaml, where aurora-wip's J813
and J873 entries and integration's J715 entries were added at the same
spot. Keep all of them.

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Assisted-by: LLM
Acelogic and others added 10 commits November 8, 2026 03:58
On T8152 (M6) the Apple dwc3 glue cannot drive the controller yet: it
needs the ATC PHY as reset provider and a Type-C role switch, and T8152
has no driver for either. The bootloader powers the controller, sets up
the USB2 side of its ATC PHY for host mode and selects the host role
before the kernel starts, which leaves only the DWC3 core to the kernel.

Match "apple,t8152-dwc3" in the dwc3 core driver. dwc3_probe() uses no
match data, so the controller probes exactly as a "snps,dwc3" node does,
and dr_mode, maximum-speed and the quirks are read from the node as
before. dwc3-apple does not match this compatible, so only the core
binds it.

This entry is to move to dwc3-apple once that driver supports the T8152
ATC PHY and Type-C role switch, so that the two never match the same
compatible.

Signed-off-by: Acelogic <miguelc4600@gmail.com>
The back-left (usb-drd1) and front (usb-drd2) USB 2 host nodes are
"snps,dwc3" with two iommus, one per DART instance. The generic dwc3
binding allows a single iommu, so dtbs_check rejects both nodes.

Use the T8152 Apple dwc3 compatible instead. It allows both DART
instances and documents the bootloader handover these nodes rely on.
Nothing else changes: the nodes keep their core region, interrupt,
DARTs, host mode, speed limit and SUSPHY quirks, and the same dwc3 core
driver binds them.

Signed-off-by: Acelogic <miguelc4600@gmail.com>
Brings aurora-silicon#1122, aurora-silicon#1123, aurora-silicon#1124 (T8142 DART/MTP/MSI), aurora-silicon#1176 (G17 fw-id fence),
aurora-silicon#1201 (J700 speaker full scale) and the rest of integration since
11943fb into aurora-wip.

Conflicts were in four device-tree binding documents only, where
aurora-wip has the T8152 versions and integration the T8142/T8152/T6050
generalisation:
- apple,admac: keep both the lone apple,t8152-admac and the
  apple,t6050-admac/apple,t8140-admac pair.
- apple,t8152-aop: take integration (it still allows a lone
  apple,t8152-aop, one or two mailboxes).
- apple,t8152-aop-audio: take integration and keep a lone
  apple,t8152-aop-audio compatible.
- apple,dwc3: keep the T8152 host-mode rules, and require resets and
  usb-role-switch on every enabled non-T8152 controller.

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Assisted-by: LLM
The integration merge brought in two rules for the required resets and
power domains. aurora-wip had "required unless T8152", and integration
had "forbidden on T6050, else required". Together they required the
properties on T6050 nodes that must not have them, and on T8152 nodes
where they are optional. dt-checks flagged that on every T6050 board and
on J873g. Keep one rule: required unless T6050 or T8152. T6050 still
forbids them.

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Assisted-by: LLM
Brings aurora-silicon#1211, the G17 QoS KUnit test fix.

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Assisted-by: LLM
Brings aurora-silicon#1215, the ADT coverage fix for boards that are new to the base.

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Assisted-by: LLM
Brings aurora-silicon#1194, which makes Touch ID wait for the first password after boot (kernel side).

Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
Assisted-by: LLM
…n/wip-sync-20261108b-mtr3

Merge train: sync aurora-wip with integration/aurora 6fee375
…silicon#1410)

The binding and the J714c device tree name the AOP audio service
"apple,t6050-aop-audio", but the driver matched only t8142 and t8152, so
that node never bound.

Add a T6050 hardware config. The J714c ADT audio-speaker stream header
(DeviceTree.j714cap) has the same layout as J813's with six amplifiers in
place of four: 6 speaker slots and 12 sense words (V, I per amplifier), at
16 bits, on slots vsense 0,4,..20 / isense 2,6,..22. J813's header has 4
slots, 8 sense words and vsense 0..12 / isense 2..14. HW_CFG_T8152 (one
amplifier, two sense words) would expose the wrong channel counts, so it is
not reused.

The sense width and the sense realignment are taken from J813's config by
analogy; they are not tested on a J714c.

Tested: builds as a module with Rust enabled (clang 19, arm64 defconfig plus
CONFIG_RUST, CONFIG_SND_SOC_APPLE_T8152_AOP_AUDIO=m); the object carries the
apple,t6050-aop-audio match string. Not tested: no J714c boot, no sound.
sithglan and others added 15 commits November 13, 2026 11:36
aurora-wip carries the J873g (Mac mini M6) hardware that integration lacks:
aurora-silicon#1197 (ANS2 NVMe, 10GbE on apcie port 2, SMC power off/restart, watchdog,
SPMI, USB2 hosts, audio DT) and the T8152 ADMAC layout.

Resolutions:
- sart: both sides added the same SART4 layout (T6050 on integration, T8152
  on aurora-wip); keep integration's sart_ops_v4 and match both.
- mailbox: keep integration's polled/rx_poll_only providers and add the
  J873 ANS post-office mailbox (rx_poll_required, j873_window) next to them.
- nvme: integration's reset_optional replaces aurora-wip's optional_reset;
  keep the T6050 and T8152 tables.
- pcie: keep power-domain attach and the T8152 MRRS limit.
- admac: keep the T6050 display ADMAC and add the T8152 layout; the
  descriptor id goes into the flags word; the resume path is integration's.
- aop.rs, macaudio.c, t8152_aop_audio.rs, tas2764.[ch], sound Kconfig:
  integration's versions, which already carry the T8152/J873 commits and
  extend them (T8142, T6050). Dropped from aurora-wip with them: aurora-silicon#1410
  (integration matches T6050 itself) and the system_dfl workqueue switch
  of ad4910c.
- bindings: list both sides' compatibles. In apple,mailbox.yaml interrupts
  are required unless the mailbox is polled: integration's
  secure-rtbuddy-proxy or aurora-wip's T8152 ANS mailbox, which describes
  none.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
A co-processor adopted from the bootloader has already sent its endpoint
map, to the bootloader, so the application endpoints a client starts on
it by hand are not in rtk->endpoints. Every message on them is then
logged as one to an undiscovered endpoint. The T8152 DCP driver would get
one per SET_SURFACE, about 60 lines a second during video.

Add apple_rtkit_adopt_ep() for a client to register an application
endpoint of such a session.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The DARTs in front of the T8152 display coprocessors (DCP, DCPEXT) and
their display pipes (ADT "dart,gen3", version 0x300) use the T8110
register layout, but they belong to the SPTM, and the bootloader hands
them over locked. Their TLB command register at 0x80 answers translation
queries instead of flushing. A stream is invalidated the way iBoot does
it: a payload naming the DART and the stream is written to the SoC's TLB
invalidation aperture, which these DARTs share, and a broadcast TLBI
follows.

Add apple,t8152-dart-gen3 for them, without the apple,t8110-dart
fallback, since a T8110 driver would flush through the wrong register,
and a "tlbi" register entry for the DART's window in the aperture.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The T8152 display DARTs (ADT "dart,gen3", version 0x300) use the T8110
register layout but belong to the SPTM: their TLB command register at 0x80
answers translation queries instead of flushing. A stream is invalidated
the way iBoot does it, by writing a 128-bit payload (valid, route, SID)
to the SoC's shared TLBI aperture and broadcasting a TLBI, which the DART
snoops. The route is the DART's 0x4604 register.

Admit a Gen3 DART only when the bootloader hands it over locked (its
streams cannot be set up cold yet), map the aperture from a second "tlbi"
reg entry without claiming it, since every Gen3 DART shares it, flush the
whole stream where a range flush would go through 0x80, and do not claim
the fault interrupt or drain stale exceptions, whose handling acknowledges
through that register as well.

The range flush test fixture gains the new hw flag.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The Gen3 DART snoops the broadcast TLBI that follows the aperture write.
iBoot and the aura bootloader issue TLBI VALE1OS at EL2 without VHE,
which targets the EL1&0 regime. On a VHE kernel the same instruction
targets EL2&0 while HCR_EL2.TGE is set, so clear TGE around it, as KVM
does to reach the EL1&0 regime.

The J873g display works with this in place; the effect of the change on
its own has not been isolated on hardware.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The display coprocessor (DCP) of the Apple T8152 runs RTKit firmware that
offers a small display service, "disp0-service", next to the full
IOMobileFramebuffer protocol; iBoot drives the displays through it. The
DCP fetches through its own DART, and the display pipe scans out through
another one that is locked with a root of its own, so the scanout stream
is a child node.

The DCP's DPTX port drives either the ATC PHY of a USB-C port, whose PD
controller reports the DisplayPort alt mode and the plug orientation, or,
on the Mac mini (J873g), the dedicated DisplayPort PHY that feeds the HDMI
port through a DisplayPort-to-HDMI converter. The sink's EDID is read
through the AP's DisplayPort AUX controller.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The T8152 DCP firmware (AppleDCP-1317) offers a small "disp0-service"
next to the full IOMobileFramebuffer protocol that drm/apple speaks.
iBoot and the aura bootloader drive the Mac mini (J873g) displays through
it. This driver uses only that service, the DPTX port service the
firmware calls back into for the PHY, and the DPAV controller services it
expects to be opened, all over AFKEPV2 rings. It is a port of aura's
afk.c, dcp_iboot.c, dcp/dptx_port_ep.c, dcp/atc_phy.c and dcp/dptx_phy.c.

The driver takes over the displays the bootloader brought up:

- The DCP does not acknowledge AP QUIESCED, and an IOP INIT while its AP
  power is still ON panics it ("Invalid AP power: 32"). The RTKit session
  is adopted as it runs, and the application endpoints are started with
  explicit START_EP messages. The bootloader stops its AFK endpoints
  first: an AFK INIT on a live endpoint asserts in the firmware.
- A new iBoot session has no surface, and a pipe still running then
  fetches from a null base (IOMFB axi_rd_err, firmware NMI). The display
  is powered off until a surface is set.
- The DCP fetches through dart-dcp, the display pipe scans out through
  dart-disp0, and both are locked with live roots of their own. The
  scanout stream is a child device with a domain of its own. Scanout
  buffers are mapped there at their DCP address, cacheable, since the
  pipe faults on entries with the DART's no-cache bit, and away from the
  firmware's own mappings.
- Changing the surface between buffers made later SET_MODEs crash the
  firmware. Three scanout buffers are allocated at probe, large enough
  for the largest mode; a frame is copied into one that is not on screen
  and swapped in with SET_SURFACE, at most once per refresh, since there
  is no vblank interrupt.
- The firmware takes only width, height and refresh rate for a mode and
  picks the timing itself. It does not hand out the EDID on this
  interface, so the EDID is read through the AP's DisplayPort AUX
  controllers.

On USB-C, the DCP drives the ATC PHY of the rear port that has a
DisplayPort sink, which the port's ACE3 PD controller reports over SPMI
together with the plug orientation. The J873g HDMI port has a dedicated
DisplayPort PHY behind a PS190 DP-to-HDMI converter. Both PHYs keep the
bootloader's setup and reprogram what a link training changes. With a
USB-C display at boot, the bootloader drives HDMI from DCPEXT0; without
one, it drives HDMI from the main DCP and never starts DCPEXT0. The driver
follows the source select it finds in the HDMI PHY.

HDMI hotplug is polled from the converter's HPD line, USB-C hotplug from
the PD controller, and display power follows the CRTC.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The DCPAV service starts its idle power off timer when its video interface
starts; a powered-on display without a following SET_MODE counts as idle
and the firmware takes the link down 30 s later. At boot the probe's
SET_MODE comes before the interface is (re)announced, so HDMI went dark
30 s after boot while sway still reported the output active.

Re-send SET_MODE for the current mode a second after a
dcpav-video-interface opens, from a delayed work on system_percpu_wq:
dcp->wq is ordered and runs the AFK receive work that completes the
SET_MODE reply.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Use the current non-devm RTKit adoption API. Gate incoming endpoint work,
drain senders, and detach RTKit while preserving live DMA buffers after a
startup failure. Keep the failed device bound to prevent a retry over
that session.

The driver has no safe firmware shutdown yet, so omit module exit and
retain the existing suppressed bind attributes. Initialize and drain the
PD reset worker together with the flip workers, and defer AV mode repair
until DRM registration.

Signed-off-by: Acelogic <miguelc4600@gmail.com>
[Thomas: on this tree the RTKit session was freed by a devm action
 rather than devm_apple_rtkit_init_adopted(); drop that action instead]
Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
A USB-C-only J873 boot leaves DPTX_PHY off, and reading the HDMI PHY
then raises an SError. Describe the read-only PMGR power states of the
HDMI PHY (DPTX_PHY) and of the DCPEXT CPU (DISPEXT0_CPU) with the HDMI
PHY's register layout, so that the driver can check them before it
touches the PHY.

Signed-off-by: Acelogic <miguelc4600@gmail.com>
[Thomas: split out of the driver change]
Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
A USB-C-only J873 boot leaves DPTX_PHY off. Reading its PLL register
while discovering the HDMI source raises an SError before the main DCP
can probe. Check the always-on PMGR requested and actual states before
touching the PHY, and only adopt DCPEXT when a powered HDMI link selects
it. Missing state resources fail closed.

Signed-off-by: Acelogic <miguelc4600@gmail.com>
[Thomas: the binding and device tree parts are separate changes]
Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
…points

The bootloader may hand the DCP over with AFK endpoints still running,
and an AFK INIT on a live endpoint asserts in the firmware. Add a
property the bootloader fills in at boot with the endpoints it left
running, so that the operating system can stop them before it starts a
session of its own.

Signed-off-by: Acelogic <miguelc4600@gmail.com>
[Thomas: split out of the driver change, added the description]
Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The bootloader may leave the DCP's AFK endpoints running with its
scanout, and an AFK INIT on a live endpoint asserts in the firmware.
Read the endpoints it left running from apple,afk-active-endpoints, and
send each of them a SHUTDOWN and wait for its acknowledgment before the
INIT; the old session's buffers stay reserved by the bootloader. Without
the property there is no telling whether an endpoint is live, so the
driver refuses to take the DCP over. The endpoint is registered with
RTKit before the SHUTDOWN, so that its reply is not reported as one to
an undiscovered endpoint.

Signed-off-by: Acelogic <miguelc4600@gmail.com>
[Thomas: the binding is a separate change, added the description]
Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The DARTs of the main DCP and of DCPEXT0, and those of their display
pipes (ADT dart-dcp, dart-disp0, dart-dcpext0 and dart-dispext0), belong
to the SPTM, and the bootloader hands them over locked. Their TLB is
invalidated through the SoC's TLB invalidation aperture
(dart-tlbi-aperture), not through the T8110 TLB command register.

Describe them as apple,t8152-dart-gen3 with their windows in the
aperture (ADT tlbi-aperture-offset 0x400 and 0x480). The second register
window of the display pipe DARTs, their SMMU instance, is not used and
is dropped. The other display DARTs keep their description until
something uses them.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
The bootloader trains the J873g displays through the DCP firmware's iBoot
interface and hands both DCPs over with their RTKit sessions running:
the main DCP drives a USB-C display on one of the rear ports, or HDMI
when no USB-C display is attached at boot, and DCPEXT0 drives the HDMI
port next to a USB-C display.

Add both DCPs with their post-office mailboxes and enable their Gen3
DARTs, with the DMA window in the upper half of the firmware's 64 GiB
window, above the firmware's and the bootloader's mappings. The main DCP
lists the three rear USB-C ports with their ATC PHY, PMGR power states,
tunables and PD controllers on nub-spmi-a0. DCPEXT0 has the HDMI PHY,
the read-only PMGR power states of the PHY and of its CPU, and the HPD
line of the DP-to-HDMI converter on the AOP's GPIO controller, which is
polled since its interrupts belong to the AOP. Each DCP has the AP
DisplayPort AUX controller that reads the sink's EDID.

Resources are from the 26A434 ADT.

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

Copy link
Copy Markdown
Contributor

Heads-up: this stack (#1798, #1799, #1800) now conflicts with integration/aurora in drivers/soc/apple/mailbox.c. The conflict comes in through #1797's merge commit a761a62, which brings aurora-wip's T8152 AOP and J873 ANS mailbox matches. It collides with 41c359d and 788441e on integration, which receive the T6050 GPU mailboxes by interrupt.

Could you refresh #1797 onto the current integration/aurora and rebase the three on it? When resolving, please keep those two commits' interrupt-driven receive path as it is. We'll review the listed commits once the stack is mergeable again.

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.

5 participants