Skip to content

T8152 / J873g DisplayPort and HDMI audio support - #3613

Merged
RyanTheTide merged 16 commits into
mainfrom
feat/t8152-j873-dpaudio
Nov 30, 2026
Merged

RyanTheTide merged 16 commits into
mainfrom
feat/t8152-j873-dpaudio

Conversation

@sithglan

@sithglan sithglan commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

What:
Enable DisplayPort and HDMI audio on Mac mini M6 (J873g, T8152, macOS 27.2 firmware):

  • Add T8152 display ADMAC support (apple,t8152-display-admac, apple,t8152-admac-control) and apple,t8152-disp-isoc-dart cold Gen3 SID 30 admission.
  • Wire T8152 dpaudio nodes (apple,t8152-dpaudio) and standalone dcpaud_probe() with a managed consumer link to dcp_pdev (deferred until dcp_pdev is bound, exiting -ENODEV when hdmi_audio=0 or a bound iBoot DCP has no AV audio service), serialized AV callback detach (audio_cb_rwsem), open-PCM/DMA-channel teardown quiescing on remove/shutdown, and ordered avep/audiosrv publication.
  • Handle firmware 27 DPTX_APCALL_GET_DRIVE_SETTINGS layout and DCP_FIRMWARE_IBOOT AV service routing (av.c, iomfb_iboot.c, t8152_dptx.c, t8152_atc.c).

Tested:

  • Local automated checks at head 3ff2527c14fa:
    • Kconfig matrix builds: T6030_AUDIO=y,T8152=n, T6030_AUDIO=n,T8152=y, and DRM_APPLE_AUDIO=n,T8152=y all build clean.
    • Apple DRM KUnit (drivers/gpu/drm/apple/tests/display.kunitconfig): 174 passed, 1 skipped, 0 failed.
    • tools/asahi/dcpaud-sleep-hold-tests.py: 128/128 passed; tools/testing/selftests/drivers/gpu/apple-dcp/audio.py PASS.
    • dt_binding_check (apple,admac.yaml, apple,admac-control.yaml, apple,t6030-dpaudio.yaml, apple,dart.yaml), CHECK_DTBS=y apple/t8152-j873g.dtb, and scripts/checkpatch.pl --strict: 0 errors, 0 warnings.
  • Live hardware verification on Mac mini M6 (J873g, T8152, firmware 27.2, default cmdline, 0 failed units, 0 WARNING:/Call trace/DART faults) at exact head 3ff2527c14fa:
    • card0-DP-1 HDMI 2560x1440 + DisplayPort (32a140000.dma-controller): pre-unbind playback (IRQ 99: 0 -> 20), live unbind of audio-controller-1 while an aplay stream was open (aplay exited cleanly on disconnect, 0 warnings/errors), live rebind, and post-rebind playback (IRQ 99: 20 -> 49, DMA channel cleanly re-acquired).
    • Simultaneous HDMI (DisplayPort, 32a140000) + USB-C DP (DisplayPort_1, 502140000) 48 kHz streaming and EV2780 ELD verified on J873g at e4f3bebf7735.

Risk: two-way · T8152 (J873g) DisplayPort/HDMI audio, display ADMAC, and drm/apple iBoot AV endpoint startup.

Not yet:

  • None.

Document the apple,t8152-disp-isoc-dart compatible for T8152 display
isochronous DARTs, which handle display ADMAC audio DMA on SID 30.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Add support for apple,t8152-disp-isoc-dart as a cold Gen3 DART covering
stream ID 30 (the display ADMAC audio stream) with optional tunables.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Document apple,t8152-display-admac and apple,t8152-admac-control for the
T8152 display audio DMA controllers and their CED/SSW control blocks.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Add the apple,t8152-display-admac match entry using T8152's 0x40000
channel layout with the display ADMAC profile.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Add the apple,t8152-dpaudio compatible to the Apple DisplayPort audio
controller binding.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Allow an optional ports/port@0 audio graph endpoint on T8152 iBoot DCP
nodes so display audio controllers can link to their owning DCP.

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

On T8152 Firmware 27, DPTX_APCALL_GET_DRIVE_SETTINGS places the lane
count at offset +0 and the IOReturn status at offset +16 (swapped
relative to SET), with lane entries starting at +32. Fix the reply
marshalling and buffer-size check accordingly.

Additionally, when atc_read_edid() borrows the crossbar for AUX0 on an
active link, mark the port as needing a retrain and return
KIO_RETURN_NOT_READY from GetDriveSettings until the firmware retrains
and issues a fresh SET_DRIVE_SETTINGS (or deactivates the port).

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Wire up the AV EPIC endpoint and audio server ops for DCP_FIRMWARE_IBOOT
so T8152 iBoot DCP instances expose DisplayPort and HDMI audio through
the existing dcp-dp-audio ASoC driver.

- Bring up avep_init() and av_iboot_ops for DCP_FIRMWARE_IBOOT.
- Check the Firmware 27 IOReturn status at reply + 48 in
  dcp_audiosrv_link().
- Support standalone dcp-dp-audio probing/binding via av_audiosrv_ready(),
  av_attach_audio_dev(), and av_detach_audio_dev() when the audio
  controller is described as a separate device tree node linked through
  the OF graph.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Switch the T8152 display isochronous DARTs to apple,t8152-disp-isoc-dart
with their TLBI register windows, and add t8152-j873-dpaudio.dtsi (and
include it from t8152-j873g.dts) enabling the display ADMACs, ADMAC
control blocks, PMGR power states, isochronous DARTs, and DisplayPort
audio controllers for disp0, dispext0, and dispext1.

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

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FIX, then re-review at 65f2b05a
Blockers:

  1. Non-T8152 build failure (drivers/gpu/drm/apple/av.c L1159, iomfb_iboot.h L137–144): av_iboot_init() calls dcp_iboot_av_started(ib) inside #if IS_ENABLED(CONFIG_DRM_APPLE_DCP_T6030_AUDIO) without guarding for IS_ENABLED(CONFIG_DRM_APPLE_DCP_T8152). iomfb_iboot.h only declares dcp_iboot_av_started() when CONFIG_DRM_APPLE_DCP_T8152 is enabled and provides no #else stub, so any kernel built with CONFIG_DRM_APPLE_DCP_T6030_AUDIO=y (default y) and CONFIG_DRM_APPLE_DCP_T8152=n fails to compile. Either guard av_iboot_ops / DCP_FIRMWARE_IBOOT in av.c with IS_ENABLED(CONFIG_DRM_APPLE_DCP_T6030_AUDIO) && IS_ENABLED(CONFIG_DRM_APPLE_DCP_T8152) or add a static inline stub for dcp_iboot_av_started() in iomfb_iboot.h.
  2. Standalone dpaudio unbind lifetime & race issues (drivers/gpu/drm/apple/audio.c, drivers/gpu/drm/apple/av.c):
    • Unbind UAF (audio.c L2229–2246, av.c L1763–1764): Standalone T8152 dpaudio has no component master, and avep_init() only adds a DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME device link. Unbinding dcp_iboot (dcp_iboot_remove() -> dcp_iboot_detach() -> devres frees dcp, audiosrv_data, and dcp_iboot) does not unbind dpaudio, leaving a live ALSA card whose dcp_audio_sink_eld(), dcp_audiosrv_link(), or later dcpaud_unbind() (av_detach_audio_dev() / dcp_audiosrv_close()) can dereference freed dcp / dcp->iboot state. Create a managed consumer link (DL_FLAG_AUTOREMOVE_CONSUMER | DL_FLAG_PM_RUNTIME, without DL_FLAG_STATELESS) from audio_pdev to dcp_pdev in standalone dcpaud_probe() (and skip the stateless link in avep_init() for DCP_FIRMWARE_IBOOT) so dpaudio always unbinds before dcp_iboot.
    • Premature publication in avep_init() (av.c L1748, L1774–1793): (a) dcp->audiosrv = audiosrv_data is stored before afk_init(), cleanup registration, and afk_start(), so av_audiosrv_ready() (READ_ONCE(dcp->audiosrv)) can return true to a concurrent dcpaud_probe() before avep is started or if avep_init() fails. (b) dcp->avep = afk_init(...) stores dcp->avep before dcp->avep->unmatched_ops = &av_iboot_ops (L1783) and debugfs_entry (L1789), so dcp_iboot_rtk_recv() (READ_ONCE(dcp->avep)) can observe dcp->avep with unmatched_ops == NULL (the self-store WRITE_ONCE(dcp->avep, dcp->avep) at L1793 does not prevent the earlier store). Hold avep in a local until fully initialized, publish WRITE_ONCE(dcp->avep, avep) right before afk_start(), and expose readiness (av_audiosrv_ready()) only after afk_start() succeeds.
    • Swallowed deferral in standalone dcpaud_probe() (audio.c L2075–2120, L2234–2244): dcpaud_bind() inherits dcpaud_comp_bind()'s return 0; on missing DMA device / dcpaud_init_snd_card() failure. In standalone mode, if admac_disp* has not probed yet, dcpaud_bind() returns 0 with dcpaud->card == NULL, skipping -EPROBE_DEFER and still calling av_attach_audio_dev() on an uninitialized audio device. Propagate deferral / bind errors in standalone mode instead of attaching a half-bound device.
  3. Merge conflicts and skipped CI: Branch is CONFLICTING against main (overlapping apple,admac*.yaml, apple,t6030-dpaudio.yaml, drivers/iommu/apple-dart.c), and apple-build, dt-checks, host-tests, and kunit were all skipped. Merge main into the branch (no force push) so hosted CI runs and passes at the new head, and include the exact new head SHA in the J873g verification row.
    Checked: All 18 modified/added files across DT bindings, J873g/T8152 DTS, apple-dart.c, apple-admac.c, audio.c, av.c, av.h, iboot_drm.c, iomfb_iboot.c, iomfb_iboot.h, t8152_atc.c, t8152_display.h, and t8152_dptx.c at 65f2b05a.
Evidence
  • Verified clean parts:
    • drivers/iommu/apple-dart.c: apple_dart_apply_own_tunables() NULL guard for dart->tunables, apple,t8152-disp-isoc-dart cold Gen3 SID 30 admission (num_streams 31..32, !dev->pm_domain), and apple,dart.yaml schema additions are clean.
    • drivers/dma/apple-admac.c & apple,admac*.yaml: admac_t8152_display_hw (t8152_layout = true, display = true) and if: not: schema extension for apple,t8152-display-admac are clean.
    • drivers/gpu/drm/apple/t8152_dptx.c & t8152_atc.c: Firmware 27 DPTX_APCALL_GET_DRIVE_SETTINGS layout (count at +0, IOReturn at +16, entries at +32, room >= 20 check, memset zero-fill before min(count, port->drive_count) copy) and needs_retrain (KIO_RETURN_NOT_READY) handoff are clean.
    • drivers/gpu/drm/apple/av.c dcp_audiosrv_link(): zeroing reply before av_audiosrv_call() and checking iBoot IOReturn at reply + 48 are clean.
  • Nits (non-blocking):
    • arch/arm64/boot/dts/apple/t8152-j873-dpaudio.dtsi L236–301: the admac_disp* / admac_disp*_ced_ssw nodes inside / { soc { ... }; }; are indented one tab less than their parent soc block.
    • drivers/gpu/drm/apple/t8152_atc.c L644: WRITE_ONCE(disp->port[0].needs_retrain, true) hardcodes port[0]; worth a brief comment or helper if t8152_display ever routes AUX0 on a non-zero port[] entry.

…aces

Address review blockers on the T8152 iBoot DP/HDMI audio path:

- Add a static inline dcp_iboot_av_started() stub in iomfb_iboot.h and
  guard av_iboot_ops / DCP_FIRMWARE_IBOOT in av.c on both
  CONFIG_DRM_APPLE_DCP_T6030_AUDIO and CONFIG_DRM_APPLE_DCP_T8152 so
  non-T8152 builds compile cleanly.
- In standalone dcpaud_probe(), add a managed consumer link
  (DL_FLAG_AUTOREMOVE_CONSUMER | DL_FLAG_PM_RUNTIME) to dcp_pdev and
  skip the stateless link in avep_init() for DCP_FIRMWARE_IBOOT so
  dpaudio always unbinds before dcp_iboot.
- Keep avep local in avep_init() until unmatched_ops, debugfs_entry,
  and cleanup registration complete, publish dcp->avep with release
  semantics before afk_start(), and expose av_audiosrv_ready() only
  after afk_start() succeeds.
- Propagate bind/deferral errors (e.g. -EPROBE_DEFER when admac_disp*
  has not probed yet) from dcpaud_bind() in standalone mode and release
  dma_link on failure instead of attaching a cardless audio device.

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

sithglan commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor Author

Addressed all blockers in 4b986e3c20f3 + merge commit b119fa9cecaa:

  1. Build guards (iomfb_iboot.h, av.c): Added static inline dcp_iboot_av_started() stub and guarded av_iboot_ops / DCP_FIRMWARE_IBOOT on IS_ENABLED(CONFIG_DRM_APPLE_DCP_T6030_AUDIO) && IS_ENABLED(CONFIG_DRM_APPLE_DCP_T8152). Verified both matrix configs: T6030_AUDIO=y, T8152=n and T6030_AUDIO=n, T8152=y.
  2. Standalone dpaudio unbind/publish/deferral races (audio.c, av.c, iomfb_iboot.c):
    • Standalone dcpaud_probe() now creates a managed consumer link (DL_FLAG_AUTOREMOVE_CONSUMER | DL_FLAG_PM_RUNTIME) to dcp_pdev and avep_init() skips the stateless link for DCP_FIRMWARE_IBOOT, guaranteeing dpaudio unbinds before dcp_iboot.
    • avep_init() keeps avep local until unmatched_ops, debugfs_entry, and cleanup registration finish, publishes dcp->avep with smp_store_release() before afk_start(), and sets audiosrv_data->ready (read by av_audiosrv_ready()) only after afk_start() succeeds.
    • dcpaud_bind() propagates bind/deferral errors (including -EPROBE_DEFER) in standalone mode and tears down dma_link on error instead of attaching a cardless device.
  3. Merge & validation: Merged origin/main at b119fa9cecaa (no force push). checkpatch.pl --strict 0/0/0, dt_binding_check + CHECK_DTBS=y apple/t8152-j873g.dtb clean, Apple DRM KUnit 174/174 PASS, dcpaud-sleep-hold-tests.py 128/128 PASS.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: HOLD at b119fa9c — all three code/merge blockers from 65f2b05a are cleanly resolved in 4b986e3c + b119fa9c; awaiting queued hosted CI completion and an exact-head J873g hardware row at b119fa9c.
Blockers:

  1. Wait for queued hosted CI checks (apple-build, dt-checks, host-tests, kunit, pr-text) at b119fa9c to pass.
  2. Post a J873g verification row referencing exact head b119fa9c confirming DP/HDMI audio playback after the 4b986e3c standalone-probe/unbind changes.
    Checked: Commit 4b986e3c (drivers/gpu/drm/apple/audio.c, av.c, iomfb_iboot.c, iomfb_iboot.h) and merge commit b119fa9c (MERGEABLE on main, DCO Signed-off-by: present).
Evidence
  • Blocker 1 resolved (iomfb_iboot.h, av.c): Added static inline void dcp_iboot_av_started(struct dcp_iboot *ib) {} stub and guarded av_iboot_ops / DCP_FIRMWARE_IBOOT in av.c with IS_ENABLED(CONFIG_DRM_APPLE_DCP_T6030_AUDIO) && IS_ENABLED(CONFIG_DRM_APPLE_DCP_T8152) (both matrix configs verified).
  • Blocker 2 resolved (audio.c, av.c, iomfb_iboot.c):
    • Standalone dcpaud_probe() adds a managed consumer link (DL_FLAG_AUTOREMOVE_CONSUMER | DL_FLAG_PM_RUNTIME) to dcp_pdev and avep_init() skips the stateless link for DCP_FIRMWARE_IBOOT (putting its audio_pdev reference cleanly), ensuring dpaudio always unbinds before dcp_iboot.
    • avep_init() keeps avep local until unmatched_ops, debugfs_entry, and cleanup registration finish, publishes dcp->audiosrv and dcp->avep via smp_store_release() (paired with smp_load_acquire() in av_audiosrv_ready() and dcp_iboot_rtk_recv()), and sets audiosrv_data->ready via smp_store_release() only after afk_start() succeeds.
    • dcpaud_bind() propagates bind/deferral errors (-EPROBE_DEFER, -ENODEV, etc.) in standalone mode, fixes of_node_put() leaks on early exits, tears down dma_link on failure, and resets dcpaud->standalone = false without attaching a cardless device.
  • Blocker 3 resolved (b119fa9c): Cleanly merged main with DCO sign-off; local checkpatch.pl, dt_binding_check, CHECK_DTBS=y, Apple DRM KUnit (174/174), and dcpaud-sleep-hold-tests.py (128/128) pass.

@github-actions github-actions Bot added area:bringup Area from CODEOWNERS (bot) area:display Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 29, 2026
@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Merge readiness at 0773d03b: not ready yet

Check Detail
CI at head running running: KUnit isp, KUnit jpeg, KUnit prores, KUnit scaler, KUnit macsmc, KUnit clpc
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head no no line with the head SHA 0773d03b, a Mac and a result in the PR body or a comment
Conflicts ok none
PR text ok Risk: two-way · T8152 (J873g) DisplayPort/HDMI audio, display ADMAC, and drm/apple iBoot AV endpoint startup.

Areas: area:bringup, area:display, area:platform

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

…date selftest

Address follow-up review and host-tests blockers on T8152 DP/HDMI audio:

- Guard avep_init() in dcp_iboot_probe() on IS_ENABLED(CONFIG_DRM_APPLE_AUDIO)
  and hdmi_audio so audio-disabled T8152 builds link cleanly and
  appledrm.hdmi_audio=0 suppresses AV endpoint startup as on other DCPs.
- Put the dcp_pdev (and dma_pdev) device references acquired by
  of_find_device_by_node() on deferred DMA lookup, standalone bind
  failure, and standalone unbind in audio.c.
- Add the dcp_is_iboot_audio() stub in apple-dcp's cec-only-av-endpoint
  host selftest (tools/testing/selftests/drivers/gpu/apple-dcp/audio.py).

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

Copy link
Copy Markdown
Contributor Author

Addressed follow-up blockers + host-tests + pr-text in ed0fdb178ef5:

  • Guarded avep_init() in iomfb_iboot.c on IS_ENABLED(CONFIG_DRM_APPLE_AUDIO) and hdmi_audio (verified DRM_APPLE_AUDIO=n, T8152=y build clean).
  • Fixed dcp_pdev/dma_pdev refcount release on deferred DMA lookup, standalone bind error, and standalone unbind in audio.c.
  • Added dcp_is_iboot_audio() stub to tools/testing/selftests/drivers/gpu/apple-dcp/audio.py (cec-only-av-endpoint PASS).
  • Updated PR description with What: / Tested: / Risk: two-way · ... / Not yet:.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: HOLD at ed0fdb17 — the audio config/module-param guard, dcpaud_bind()/dcpaud_unbind() device refcount fixes, and audio.py selftest stub are clean and code-ready; awaiting hosted CI completion and exact-head J873g hardware confirmation.

Blockers:

  1. Wait for queued CI checks at ed0fdb17 (apple-build, dt-checks, host-tests, kunit, pr-text, readiness) to complete green.
  2. Post the exact-head ed0fdb17 J873g hardware row verifying DP/HDMI audio playback and clean probe/unbind.

Checked:

  • Audited commit ed0fdb17 (DCO Signed-off-by: present, MERGEABLE):
    • drivers/gpu/drm/apple/iomfb_iboot.c (L720–726): gates avep_init(dcp) behind #if IS_ENABLED(CONFIG_DRM_APPLE_AUDIO) and if (hdmi_audio), keeping DRM_APPLE_AUDIO=n, T8152=y builds link-clean and honoring appledrm.hdmi_audio=0.
    • drivers/gpu/drm/apple/audio.c (L2096–2138, L2193–2206): balances of_find_device_by_node() references for both dcp_pdev and dma_pdev across deferred DMA lookup (put_device(&dcp_pdev->dev)), standalone dcpaud_init_snd_card() failure (deletes dma_link, puts dma_pdev and dcp_pdev, nulls both), and standalone dcpaud_unbind() (deletes dma_link, puts dma_dev and dcp_dev, nulls both).
    • tools/testing/selftests/drivers/gpu/apple-dcp/audio.py: adds dcp_is_iboot_audio() stub for cec-only-av-endpoint (PASS reported).
Evidence
  • drivers/gpu/drm/apple/audio.c: traced all 4 paths through dcpaud_bind() / dcpaud_unbind() for standalone T8152 audio (!dcp_pdev, !dma_pdev, dcpaud_init_snd_card() != 0, and normal bind -> unbind); zero refcount leaks and zero double-puts.
  • drivers/gpu/drm/apple/iomfb_iboot.c: avep_init(dcp) guarded on IS_ENABLED(CONFIG_DRM_APPLE_AUDIO) and hdmi_audio (verified DRM_APPLE_AUDIO=n, T8152=y clean build reported).
  • tools/testing/selftests/drivers/gpu/apple-dcp/audio.py: dcp_is_iboot_audio() stub added alongside dcp_is_v27_external().

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: HOLD at ed0fdb17 pending hosted checks and J873g validation.

Blockers: Repeat simultaneous DP and HDMI audio on J873g at this head, including open/close and a rebind or deferred-probe retry.

Checked: The delta balances the standalone DCP and DMA references on the updated defer, failed-card and unbind paths. AV endpoint startup now respects the audio build and runtime switches. The reported config matrix covers audio-disabled and non-T8152 builds.

…inds

On T8152/J873g, of_fwnode_add_links() creates a pair of SYNC_STATE_ONLY
cycle links between each apple,dpaudio node and its apple,t8152-dcp-iboot
peer over the OF graph endpoints. Because dcp_audio_register() runs before
dcp_register() (and unused main DCP nodes stay unbound), calling
device_link_add() in dcpaud_probe() while the DCP device is still unbound
clears DL_FLAG_SYNC_STATE_ONLY on the persistent fw_devlink without
turning it into an autoremove link. When dcpaud_probe() then defers on
!av_audiosrv_ready(), __device_links_no_driver() triggers a WARN_ON for
each dpaudio instance.

Check device_is_bound() and av_audiosrv_ready() before adding the managed
device link, and re-check av_audiosrv_ready() after adding it.

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

Copy link
Copy Markdown
Contributor Author

Exact-head hardware verification on Mac mini M6 (J873g, T8152, FW 27.2) at e4f3bebf7735 (which also fixes a live-caught __device_links_no_driver() WARN_ON when dcpaud_probe() ran before apple,t8152-dcp-iboot bound):

  • Kernel: Linux mini6 7.3.0-aurora-j873-main-1127+ #1 SMP PREEMPT Sun Nov 29 15:03:02 CET 2026 aarch64 (built from e4f3bebf7735 + t8152-j873g.dtb)
  • dmesg errors/warnings: 0 WARNING:, 0 Call trace, 0 BUG:, 0 DART/IOMMU faults; systemctl --failed: 0 failed units
  • Devlinks:
    • platform:286e00000.display--platform:audio-controller-0: status=dormant sync_state_only=1 rpm=0 (unused main DCP stays untouched)
    • platform:32ae00000.display--platform:audio-controller-1: status=active sync_state_only=0 rpm=1
    • platform:502e00000.display--platform:audio-controller-2: status=active sync_state_only=0 rpm=1
  • Displays & ALSA cards:
    • card0-DP-1 (HDMI, 2560x1440) -> card 1: DisplayPort [Apple DisplayPort], HDMI/DP Jack=on, EV2780 ELD populated
    • card1-DP-2 (USB-C DP, 2560x1440) -> card 2: DisplayPort_1 [Apple DisplayPort], HDMI/DP Jack=on, EV2780 ELD populated
  • Audio DMA streaming (1 s silent 48 kHz S16_LE stereo zero-buffer via aplay):
    • plughw:CARD=DisplayPort,DEV=0: OK (32a140000.dma-controller IRQ 102 incremented 20 -> 40)
    • plughw:CARD=DisplayPort_1,DEV=0: OK (502140000.dma-controller IRQ 107 incremented 20 -> 40)
  • Host/KUnit checks on e4f3bebf7735: checkpatch.pl --strict 0/0/0, tools/testing/selftests/drivers/gpu/apple-dcp/audio.py PASS, display.kunitconfig arm64 KUnit 174 passed / 1 skipped / 0 failed.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: HOLD at e4f3bebf — e4f3bebf cleanly resolves the fw_devlink WARN_ON in __device_links_no_driver() when standalone dcpaud_probe() defers before apple,t8152-dcp-iboot binds or starts AV audio; awaiting hosted CI and exact-head J873g hardware confirmation.

Blockers:

  1. Wait for queued hosted CI checks at e4f3bebf (apple-build, dt-checks, host-tests, kunit, pr-text, readiness, KUnit suites) to pass.
  2. Post an exact-head e4f3bebf J873g hardware row confirming DP and HDMI audio playback (including open/close and deferred-probe/rebind with no __device_links_no_driver() warning in dmesg).

Checked:

  • Verified commit e4f3bebf (+13/-5 in drivers/gpu/drm/apple/audio.c, DCO Signed-off-by: present, MERGEABLE on main) against drivers/base/core.c (__device_links_no_driver() L1491–1518) and drivers/gpu/drm/apple/av.c (av_audiosrv_ready() L1616–1626).
  • Checking !device_is_bound(&dcp_pdev->dev) || !av_audiosrv_ready(&dcp_pdev->dev) before device_link_add() ensures dcpaud_probe() does not strip DL_FLAG_SYNC_STATE_ONLY from the persistent OF-graph fw_devlink while the iBoot DCP is unbound or running without audio (appledrm.hdmi_audio=0), and re-checking !av_audiosrv_ready(&dcp_pdev->dev) after device_link_add() closes any concurrent teardown race while keeping put_device(&dcp_pdev->dev) balanced on every exit path.
Evidence
  • drivers/gpu/drm/apple/audio.c L2279–2290: pre-check gates device_link_add(..., DL_FLAG_AUTOREMOVE_CONSUMER | DL_FLAG_PM_RUNTIME) on device_is_bound(&dcp_pdev->dev) && av_audiosrv_ready(&dcp_pdev->dev); post-check catches !link || !av_audiosrv_ready(&dcp_pdev->dev) with put_device(&dcp_pdev->dev).
  • drivers/base/core.c L1508–1514: once link->supplier->links.status == DL_DEV_DRIVER_BOUND, later consumer deferral (e.g., DMA lookup) transitions the persistent link cleanly to DL_STATE_AVAILABLE without tripping the WARN_ON.

@github-actions github-actions Bot added blast:m5 Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot) and removed needs-hw-row No hardware row at the PR head (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 29, 2026
…udio

Address follow-up review findings on standalone T8152 DP/HDMI audio:

- Serialize outside-plug_lock AV audio callbacks (av_audio_before_modeset()
  and __av_service_disconnect()'s dcpaud_release_link()) with an rwsem in
  audiosrv_data so av_detach_audio_dev() drains both plug_lock and
  outside-plug_lock callbacks before standalone audio teardown proceeds.
- Quiesce standalone dpaudio before dropping dma_link and supplier device
  references: dcpaud_remove() disconnects and waits for open PCM users via
  snd_card_free() and cancels void_work before releasing dma_link/dma_dev/
  dcp_dev; dcpaud_shutdown() quiesces AV callbacks, disconnects the card,
  and stops void/native-link work without blocking on frozen userspace.
- Exit dcpaud_probe() with -ENODEV instead of deferring indefinitely when
  appledrm.hdmi_audio=0 or when the bound iBoot DCP has no live AV audio
  service.

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

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: HOLD at d3b3ade5 pending current-head lifecycle validation.

Blockers: Run hosted checks and a J873g rebind or disconnect while a PCM is open, then verify both display audio outputs recover. The published simultaneous-output row predates the new callback drain and card teardown.

Checked: The delta detaches the audio device before teardown and drains readers that already obtained the callback pointer. The probe path distinguishes an unbound supplier from a bound supplier with no audio service.

When standalone T8152 dpaudio unbinds, dcpaud_remove() quiesced the sound
card and dropped dma_link/dma_dev without calling dma_release_channel() on
dcpaud->chan. Rebinding dcp-dp-audio then failed with -ENODEV (-19) when
of_dma_request_slave_channel() tried to claim the already-held ADMAC TX
channel.

Release dcpaud->chan in dcpaud_remove() after quiescing the card and
silence link (unless idle_set remained stuck on a non-stopped channel).

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

Copy link
Copy Markdown
Contributor Author

Addressed follow-up standalone teardown, disabled-audio exit, and live rebind DMA channel release findings in d3b3ade5d6ec..3ff2527c14fa:

  • In-flight AV callback & open PCM quiescing (av.c, audio.c):
    • Added audio_cb_rwsem in struct audiosrv_data around outside-plug_lock callbacks (av_audio_before_modeset() and dcpaud_release_link() in __av_service_disconnect()) so av_detach_audio_dev() drains both plug_lock and outside-plug_lock callbacks before teardown proceeds.
    • dcpaud_remove() now disconnects and waits for open PCM users via snd_card_free(), cancels void_work, tears down native_link, and releases dcpaud->chan via dma_release_channel() before dropping dma_link, dma_dev, and dcp_dev. dcpaud_shutdown() quiesces AV callbacks, disconnects the card (snd_card_disconnect()), and stops void_work/native_link without blocking on frozen userspace.
  • Disabled-audio exit (audio.c):
    • dcpaud_probe() returns -ENODEV immediately when appledrm.hdmi_audio=0 or when an already-bound iBoot DCP has no live AV audio service, instead of remaining on the deferred-probe list indefinitely.
  • Local automated checks at 3ff2527c14fa: checkpatch.pl --strict 0/0/0, tools/testing/selftests/drivers/gpu/apple-dcp/audio.py PASS, tools/asahi/dcpaud-sleep-hold-tests.py 128/128 PASS, arm64 display.kunitconfig KUnit 174 passed, 1 skipped, 0 failed.
  • Exact-head J873g hardware verification at 3ff2527c14fa (Linux mini6 7.3.0-aurora-j873-main-1127+ #1 SMP PREEMPT Sun Nov 29 16:57:49 CET 2026 aarch64):
    • 0 WARNING:/Call trace/BUG:, 0 DART/IOMMU faults, 0 failed systemd units, card0-DP-1 HDMI 2560x1440 connected.
    • Pre-unbind 48 kHz silent zero-buffer playback on DisplayPort: OK (32a140000.dma-controller IRQ 99 0 -> 20).
    • Live unbind of audio-controller-1 while an active aplay stream was open: aplay disconnected cleanly (write error: No such device), unbind completed with 0 warnings/errors, bind succeeded, and post-rebind playback succeeded (32a140000 IRQ 99 20 -> 49, 0 DMA channel request failed errors). (Simultaneous HDMI + USB-C DP audio on both DisplayPort & DisplayPort_1 verified at e4f3bebf7735.)

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MERGE at 3ff2527c after tracked validation.

Blockers: Complete hosted checks.

Checked: The new standalone remove path releases the requested DMA channel after card teardown when idle DMA has stopped. The exact J873g row exercised unbind with active PCM, rebind, and playback with channel reacquisition. The earlier dual-output result covers the unchanged streaming setup.

Commit d3b3ade ("drm/apple: quiesce standalone dpaudio teardown and
exit on disabled audio") added audio_cb_rwsem to struct audiosrv_data in
drivers/gpu/drm/apple/av.c. Add the matching struct lock field to the
host-test stub in tools/testing/selftests/drivers/gpu/apple-dcp/audio.py
so cec-only-av-endpoint builds and passes again.

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

Copy link
Copy Markdown
Contributor Author

Fixed the apple-dcp cec-only-av-endpoint host selftest failure in 0773d03b9b5d by adding audio_cb_rwsem to the struct audiosrv_data stub in tools/testing/selftests/drivers/gpu/apple-dcp/audio.py (no kernel/driver code changed since 3ff2527c14fa). Verified --group audio (2/2) and host suite (98/98) locally, checkpatch.pl --strict 0/0/0.

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MERGE at 0773d03b

Blockers: None (wait for the queued hosted CI checks at 0773d03b to turn green before merging).

Checked:

  • Verified the single-commit delta 3ff2527c..0773d03b (+1/-1 in tools/testing/selftests/drivers/gpu/apple-dcp/audio.py, DCO present): adds audio_cb_rwsem to the struct audiosrv_data host-test stub in cec_only_endpoint(), matching the scoped_guard(rwsem_read, &asrv->audio_cb_rwsem) added to __av_service_disconnect() in drivers/gpu/drm/apple/av.c by d3b3ade5d6ec.
  • Confirmed zero kernel or driver code changed since the previously approved head 3ff2527c, so the J873g DP/HDMI audio hardware verification (dual-output streaming, active-PCM unbind, rebind, and DMA channel reacquisition) carries over unchanged.
  • Author verified --group audio (2/2), full apple-dcp host suite (98/98), and checkpatch.pl --strict (0/0/0).
Evidence
  • tools/testing/selftests/drivers/gpu/apple-dcp/audio.py:156-165: stub struct audiosrv_data now declares struct lock srv_rwsem, plug_lock, audio_cb_rwsem; for scoped_guard(rwsem_read, &asrv->audio_cb_rwsem) in drivers/gpu/drm/apple/av.c:1364.
  • git diff 3ff2527c..0773d03b: exclusively tools/testing/selftests/drivers/gpu/apple-dcp/audio.py (+1/-1).
  • PR body includes **Risk:** two-way; hosted CI currently 0 failures with checks queued (22 pending).

@aurora-silicon-review aurora-silicon-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MERGE at 0773d03b after hosted and integration checks.

Checked: The only change since the reviewed 3ff2527c adds the missing audio_cb_rwsem member to the CEC-only host fixture. It matches the field used by the extracted callback code. The test assertions and runtime sources are unchanged, so the previous J873g open-PCM unbind/rebind evidence still applies to the changed driver. The author reports 2/2 focused and 98/98 host cases locally. Verify the hosted result and outstanding train gates.

@RyanTheTide

Copy link
Copy Markdown
Contributor

code-owner ping <@422957901716652033> / @DjDeveloperr: merge train at 0773d03b. App approved (NEON-PR-REVIEW2); 1-line host-test stub fix, so no hardware row applies. Merges 1 h from now once CI is green, unless you object.

@github-actions github-actions Bot added needs-hw-row No hardware row at the PR head (bot) and removed ci-failing A check failed at the PR head (bot) labels Nov 29, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

Second-generation peer row on the M2 Mac mini (J473, T8112, macOS 27.2 firmware), as Dj asked.

Kernel: 7.3.0-aurora-dsc6, source 8c0ab41 = linux main a03face (which already has #3405: HDMI on dcp, USB-C on dcpext) + no-ff merge of #3613 at 3ff2527, then #3617 at 1e8cadc. Both heads are unchanged: git range-diff a03face5..1e8cadcc a03face5..<merged #3617 parent> shows all 28 commits =. Config = signed m2combo32 config. Stage 2 = signed m2combo32 7574320e (its J473 DTB is byte-identical to this build's). Default cmdline, guarded one-shot, saved default restored and verified after each boot.

  • J473 at 8c0ab41 (T8152 / J873g DisplayPort and HDMI audio support #3613 3ff2527 + arm64: apple: t8152-j873g: rear USB-C ports USB2/USB3/USB4/TBT/DP-altmode boot & hotplug #3617 1e8cadc on main a03face), row dsc6-peer, 2026-11-30: pass for display audio. Boot Enforcing, 0 failed units, 0 DCP crashes or oopses or WARNs. A -30 dBFS 440 Hz tone went through PipeWire to each monitor (internal speakers untouched), opened, played 6 s and closed 3 times per route; hw_ptr advanced every time:
    • Acer QG270 S3 on HDMI: DCP dcp (231c00000), ALSA card 8 "HDMI", 238330000.audio-controller (dpaudio0).
    • MSI MPG 325CQRXF on USB-C: DCP dcpext (271c00000), ALSA card 9 "USBC", 238334000.audio-controller (dpaudio1).
      This matches macOS 27.2's routing on this mini.
  • J473 at 8c0ab41, row dsc6-usb, 2026-11-30: pass, no regression. The ATC/dwc3 port behind the MSI (502280000.usb, dwc3-apple) was unbound and rebound 3 times: no oops/WARN, and the MSI's DP alt-mode picture stayed up. Its xHCI root hubs (480M + 10000M) do not come back after the rebind until the next Type-C event. The identical row on signed m2combo32 (main a03face without these PRs, row combo32-usb) behaves the same, so that's pre-existing, not from these PRs.

Not covered (needs hands): SuperSpeed enumeration on an ATC port. The J473's only 5000M devices sit on the PCIe xHCI (front USB-A); the MSI refuses a USB data-role swap, so a logical unplug/replug through the Type-C port isn't possible; and port 0 carries the USB4 link to the lab's J616s, which I left alone. A USB3 stick in the J473's USB-C port plus one physical unplug/replug is queued for Ryan.

Evidence (lab store): traces/display/20261129-j473-dsc/{dsc6-peer,dsc6-usb,combo32-usb}.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Merging under the 6-point rule (Ryan 09:29, permanent), at 0773d03b. (1) The review App approved at this head. (2) Full CI is green. (3/4) Rows: test-only. (5) There's no blocking review. (6) Dj was pinged here 904 min ago with no objection. Revert: git revert -m 1 <merge>.

@RyanTheTide
RyanTheTide merged commit e6c7b03 into main Nov 30, 2026
27 of 29 checks passed
@RyanTheTide
RyanTheTide deleted the feat/t8152-j873-dpaudio branch November 30, 2026 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:bringup Area from CODEOWNERS (bot) area:display Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) blast:m5 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants