Skip to content

drm/apple: reinit fixed HDMI PHY and crossbar after deep sleep - #3867

Merged
RyanTheTide merged 1 commit into
aurora-silicon:mainfrom
rjianwei:fix/dcp-fixed-hdmi-s2r-reinit
Dec 2, 2026
Merged

RyanTheTide merged 1 commit into
aurora-silicon:mainfrom
rjianwei:fix/dcp-fixed-hdmi-s2r-reinit

Conversation

@rjianwei

@rjianwei rjianwei commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

What: Allow dcp_fixed_hdmi_reinit_locked() and dcp_s2r_restart_done() to re-initialize the fixed HDMI PHY (typec_mux SAFE -> DP) and crossbar (fixed_xbar) after deep sleep on non-external_native dcpext pipelines (such as T8142 J704 dcpext1).
Tested: J704 MacBook Pro 14-inch M5 at df35e00a (equivalent 2-line patch tested live in appledrm.ko on 7.3.0-j704-s2r+ with #1847 + #3782 + #3791 + #3823): PASS — HDMI 3aae00000.dcp logs HDMI: setting up the output again (after deep sleep) on wake, reconnects immediately with 0 DPTXPort link faults or -110 timeouts, and restores 3840x2160@60 alongside eDP-1; scripts/checkpatch.pl --strict 0 errors / 0 warnings / 0 checks.
Risk: two-way · affects deep-sleep restart (dcp_s2r_restart_done()) and failed-link retry (dcp_fabric_hdmi_retry()) of fixed-PHY HDMI dcpext outputs (dcp->fixed_phy && dcp->hdmi_hpd); non-S2R dcp_resume() stays gated on dcp->external_native so s2idle on other Macs is unchanged.
Not yet: HDMI post-S2R testing on other non-external_native fixed-HDMI SoCs besides T8142 J704.

Details
  • In dcp_s2r_restart_done(), dcp_fabric_hdmi_reinit() was only called when dcp->external_native (apple,t6030-dcpext) was true; other fixed-HDMI dcpext pipelines (such as apple,t8142-dcpext on J704) only re-asserted hdmi_pwren/dp2hdmi_pwren.
  • Deep sleep drops the PHY common power domain and crossbar state behind genpd's back (atcphy_resume_noirq() marks pd_was_off = true via atcphy_sleep_lost_common()), so without typec_mux_set(SAFE -> DP_STATE_C) and mux_control_deselect()/dcp_fixed_output_select(), dcp_fixed_hdmi_reconnect() timed out with DPTXPort: firmware reports link fault 22/24 on target 0:2 and HDMI DPTX connect failed: -110.
  • Drop !dcp->external_native from dcp_fixed_hdmi_reinit_locked() and invoke dcp_fabric_hdmi_reinit() in dcp_s2r_restart_done() whenever dcp->external_native || dcp->fixed_phy.
Evidence

Tested on MacBook Pro (14-inch, M5, 24 GB, apple,j704) running macOS 27.2 stub, Aura Stage 2 (1.0.0b17-g378497cf), and Arch Linux ARM (7.3.0-j704-s2r+):

  • Before patch:
    • apple-dcp 3aae00000.dcp: dcp_fixed_hdmi_reconnect: DP2HDMI HPD connected:1
    • apple-dcp 3aae00000.dcp: DPTXPort: firmware reports link fault 22 on target 0:2
    • apple-dcp 3aae00000.dcp: dcp_dptx_connect: timed out waiting for port 0 link configuration
    • apple-dcp 3aae00000.dcp: HDMI DPTX connect failed: -110
  • After patch:
    • apple-dcp 3aae00000.dcp: HDMI: setting up the output again (after deep sleep)
    • apple-dcp 3aae00000.dcp: dcp_fixed_hdmi_reconnect: DP2HDMI HPD connected:1
    • apple-dcp 3aae00000.dcp: dcp_hotplug() connected:1 valid_mode:0 nr_modes:26
    • apple-dcp 3aae00000.dcp: set_digital_out_mode(color:96 timing:58) "3840x2160": 60 ...
    • card1-HDMI-A-1: connected [enabled=enabled]

In dcp_s2r_restart_done(), dcp_fabric_hdmi_reinit() was gated on
dcp->external_native (apple,t6030-dcpext). On fixed-HDMI external
pipelines that are not external_native (such as T8142 J704 dcpext1
driving atcphy2 and dpxbar2), deep sleep drops the PHY common power
domain and crossbar state behind genpd's back, causing
atcphy_resume_noirq() to mark pd_was_off so the next mux update restores
the PHY.

Because dcp_s2r_restart_done() only re-asserted the converter power GPIOs
without calling dcp_fabric_hdmi_reinit(), atcphy2 and dpxbar2 stayed
unconfigured after deep sleep and dcp_fixed_hdmi_reconnect() timed out
with firmware link fault 22/24 (-110).

Allow dcp_fixed_hdmi_reinit_locked() whenever dcp->fixed_phy and
dcp->hdmi_hpd are present, and call dcp_fabric_hdmi_reinit() from
dcp_s2r_restart_done() for any fixed-PHY HDMI pipeline. Leave the
non-S2R dcp_resume() caller gated on dcp->external_native so s2idle
behavior on other platforms is unchanged.

Tested on MacBook Pro (14-inch, M5, 24 GB, apple,j704) running macOS 27.2
stub with aurora-silicon#1847 + aurora-silicon#3782 + aurora-silicon#3791 + aurora-silicon#3823:
- Before: HDMI (3aae00000.dcp, 3840x2160@60) worked on cold boot, but
  failed after deep sleep with DPTXPort link fault 22/24 and
  'HDMI DPTX connect failed: -110'.
- After: 'HDMI: setting up the output again (after deep sleep)' runs on
  wake; 3aae00000.dcp reconnects immediately with 0 link faults and
  restores 3840x2160@60 alongside eDP-1.

Signed-off-by: WJW <rjianwei@gmail.com>
@rjianwei
rjianwei requested review from a team as code owners December 2, 2026 03:48
@github-actions github-actions Bot added area:display Area from CODEOWNERS (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Merge readiness at df35e00a: ready to merge

Check Detail
CI at head ok 9 checks passed
Review ok approved by DjDeveloperr
Requested changes ok none
Hardware row at head ok in the PR body at df35e00a
Conflicts ok none
PR text ok Risk: two-way · affects deep-sleep restart (dcps2rrestartdone()) and failed-link retry (dcpfabrichdmiretry()) of fixed-PHY HDMI dcpext outputs (dcp->fixedphy && dcp->hdmihpd); non-S2R dcpresume() stays gated on dcp->externalnative so s2idle on other Macs is unchanged.

Areas: area:display
Merge: gh pr merge 3867 --merge (Owners and Core through the bypass: add --admin).

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

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed df35e00. Dropping the external_native gate is right: the reinit only does work when the pipe has a fixed PHY and an HDMI HPD line, and the PHY and crossbar steps are still guarded by typec_mux/phy_managed_by_typec and fixed_xbar.

Two things to fix in the text, not blockers:

  • The change also reaches dcp_fabric_hdmi_retry() (dcp-fabric.c), which runs this reinit on every fixed-PHY HDMI pipe whose link did not come up, not only after deep sleep. The Risk line should say so.
  • The comment above dcp_fixed_hdmi_reinit_locked() still starts with "T6030 HDMI output"; it now covers any fixed-PHY HDMI pipe.

Because this is shared DCP code, merge needs the exact-head J704 row plus a row on another generation with a non-native fixed HDMI port (HDMI hotplug and s2idle/deep-sleep wake).

@github-actions github-actions Bot added ready-to-merge Meets the merge policy: merge it (bot) and removed needs-review No approving review from Core or Omarchy Mac yet (bot) labels Dec 2, 2026
@DjDeveloperr

Copy link
Copy Markdown
Contributor

One scope note before merge. Removing external_native from the dcp_fixed_hdmi_reinit_locked() guard also changes dcp_fabric_hdmi_retry(). That function is called from dcp.c when the HDMI link doesn't come up, and its only gate is !dcp_is_typec_output(dcp) && dcp->hdmi_hpd. So fixed-PHY HDMI outputs that aren't external_native will now get the PHY and crossbar reinit on a failed link as well, not only on deep-sleep restart. That's probably what you want, but the Risk line should say so. We're running a J714s control row at df35e00a666d (HDMI at boot plus one S2R cycle) as the second-generation check, and this merges when it passes.

@DjDeveloperr

Copy link
Copy Markdown
Contributor

J714s (M5 Pro, T6050) exact-head row at df35e00a666dfc8ccdf1117cbdd81a96c0b4cd7a: NO-REGRESSION / UNEXERCISED (no HDMI monitor physically attached)

  • Candidate: origin/main (2225082e1d18) + exact #3867 (df35e00a666dfc8ccdf1117cbdd81a96c0b4cd7a) in consolidated 4-PR boot b0ccb5fce773 (7.3.0-m5-pr3898-b0ccb5fc), boots 63bd561e-b30d-4ad1-942c-b4205ce9f924 and 40c311c4-ea02-4fa3-97b9-9b6327464b5a, SLC on (16 planes).
  • HDMI attachment: No HDMI panel is physically connected to J714s (card2-DP-1..6 all status=disconnected enabled=disabled at boot and after S2R), so the HDMI fixed-PHY bring-up / setting up the output again (after deep sleep) path was not exercised on this host.
  • Display/DCP no-regression: Internal card2-eDP-1 (3024x1964 @ 120 Hz on crtc-1, kms-mode byte-identical pre/post, Hyprland dpmsStatus: true), all 5 DCPs, and all 10 display/DCP DARTs (0x0204) probed and resumed cleanly across 7 S2R cycles with 0 DPTXPort link faults and 0 -110 timeouts. GPUBench rt.scene medium b541b83e PASS; clean stock 7.3.0-m5-pr67 handback (hw released ok).

@RyanTheTide

Copy link
Copy Markdown
Contributor

Merging at df35e00a666d (B2 merge train, 12-01 merge bar). Approval at this head: DjDeveloperr. Row: in the PR body at df35e00. CI: linux train L24 (candidate fdfedd05e955 on main a76093e): Apple driver build pass + touched objs pass (kernel/sched/psi.o verified with CONFIG_PSI=y) + DTBs pass + 12/12 relevant KUnit suites pass (ane-boot 333, clpc 22, ane-pm 20, dcp-fabric 117, dcp-topology 235/236, dcp-display 220/221, ave 57, apple-dart 40, jpeg 15, isp 61, mt7932 98/99, asahi 567/571; avd-pm-test.c pre-existing Clang 22 warning on main) + host tests pass (apple-dcp 1/1, dcp 96/96, g17 329/329). Revert: git revert -m 1 <merge commit>.

@RyanTheTide
RyanTheTide merged commit eef7d7c into aurora-silicon:main Dec 2, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:display Area from CODEOWNERS (bot) door:two-way Revertible or not, from Merge risk (bot) ready-to-merge Meets the merge policy: merge it (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants