Skip to content

drm/apple: dcp: power the HDMI converter only with a display - #2837

Draft
Ante042 wants to merge 1 commit into
aurora-silicon:mainfrom
Ante042:j314s-hdmi-converter-on-demand
Draft

Ante042 wants to merge 1 commit into
aurora-silicon:mainfrom
Ante042:j314s-hdmi-converter-on-demand

Conversation

@Ante042

@Ante042 Ante042 commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

What: The DP-to-HDMI converter behind the HDMI port is powered from probe on and draws about 0.6 W with nothing plugged in: the J314s idles at 2.71 W instead of 2.09 W with the screen off. This powers it down 10 s after HPD goes low and up again at the next connect, which is sent at once. This is the second version, reworked after the review below: no board check, no module parameter, no boot delay, no retry and no wait under the fabric lock.
Tested: J314s M1 Pro at 49702d5 (candidate 2596602bfaf6 on main 972a566, plus a test-only commit for the HDMI rows): boots, the same failed units as plain main. The HDMI display stayed cabled; a test-only switch forced its HPD line low and released it, so the converter really went down and came back up: cold plug 2 of 2 (converter powered down 10.1 s after the unplug, powered up 0.51 s after the plug, firmware HPD at 3.11 s, first mode set at 3.42 to 3.43 s), warm plug with a 3 s gap 1 of 1 (converter kept on, port connected again 0.5 s after the plug), and one s2idle with the display attached (converter on and display connected after the wake; with #3639's device tree property).
Risk: two-way door · every Mac whose DT gives a DCP dp2hdmi-pwren-gpios and an HDMI HPD line and is not external-native (16 board files on main, M1 Pro/Max through M5 Max laptops, minis and Studios); only the J314s has run it.
Not yet: any Mac but the J314s: it is the only one I have, and I'm glad to help anyone who wants to try it on theirs. A real cable plugged in during s2idle: the test switch makes no HPD edge at resume, and the connect comes from that edge with or without this change, so only a real cable can show it. An HDMI plug while a USB-C display holds the HDMI pipeline.

Details

On the review points:

  • Board check and parameter: gone. A DCP is managed when its DT gives it a converter power GPIO and an HDMI HPD interrupt and it is not external-native (those set the converter up themselves), as you suggested.
  • Boot delay and retry: gone too. On this connector a connect sent while the converter is still booting is not an error. The connect's wait for the link configuration runs out (no link configuration on port 0, HPD is the converter's), the port stays connected, and the firmware raises HPD itself when the converter answers, 2.1 to 2.2 s after power-up. So the connect goes out at once, nothing waits for the converter, and callers of dcp_dptx_connect() see no new return value.
  • Sleeping under dcp_typec_fabric_lock: nothing does now. The reclaim is left as main has it; v1's inline connect with its waits is gone with the retry work.
  • The 10 s before power-down is an idle debounce, not a wait for hardware. A monitor going to standby, or a cable being re-seated, drops HPD for a moment, and switching the converter off in that gap would turn a warm reconnect (about 1.9 s to the first mode set) into a cold one (about 3.4 s). It never delays a connect. If you'd rather it went down at once, or the debounce lived somewhere else, say so.
  • Across s2idle the converter is left as it is, on with a display attached and off without one. The power-down work also releases a DPTX port that nothing released, which happens when the cable is pulled while the CRTC is off.
Evidence

Kernel lines from the first cold plug (2596602bfaf6 with a test-only switch that forces the HDMI HPD line low; the cable stayed in):

22:38:45.081 TEST: HDMI HPD forced low
22:38:55.184 HDMI: no display, converter powered down
22:38:59.270 TEST: HDMI HPD released
22:38:59.776 HDMI: display attached, converter powered up
22:39:01.823 dcp_dptx_connect: no link configuration on port 0, HPD is the converter's
22:39:02.375 [firmware] display HPD asserted
22:39:02.695 set_digital_out_mode finished

The second cold plug gave the same figures to the hundredth of a second. In both, the firmware raised HPD a second time about 9.1 s after the plug, followed by a second mode set; the display stayed up.

Earlier, on main 3a6d154 with this version and my other drafts: cold plug 3 of 3 (converter powered up 0.50 to 0.51 s after the plug, firmware HPD at 3.10 to 3.11 s, first mode set at 3.42 to 3.43 s), powered down 10.0 to 10.4 s after the unplug, warm plug (3 s gap) 2 of 2 with the converter kept on, and the HDMI and a USB-C display arriving within seconds of each other 6 of 6 with the same Hyprland process. Idle figure: 2.71 W with the converter on, 2.09 W with dp2hdmi-pwren low, screen off, nothing plugged in.

Thanks for the review, and sorry it took a while!

@RyanTheTide

Copy link
Copy Markdown
Contributor

Review at feacb48 (non-author, draft). The power saving is worth having; the shape needs changes before it can land.

What holds:

  • The converter's power is serialised by hdmi_converter_lock, the power-down work re-checks HPD under the fabric lock before switching off, and an HPD read error keeps the converter on ("a failed GPIO read cannot establish absence").
  • The reclaim case is handled: connecting inline instead of leaving it to hdmi_wake_wq (which needs the fabric lock the reclaim holds) is the right fix for the ordering you found.
  • Merges cleanly on the current integration/aurora tip.

Changes needed:

  • of_machine_is_compatible("apple,j314s"): the condition already requires what the hardware describes (dp2hdmi_pwren, an HDMI HPD interrupt, not an external-native DCP). Every Mac whose DT gives the DCP a converter power GPIO and an HPD line has the same converter arrangement, so the board check should go; prove it on the other Macs with that DT shape (M1 Pro/Max 14"/16", M2 Pro/Max laptops, the desktops with HDMI) instead of limiting it to the measured one.
  • appledrm.hdmi_converter_idle_off: with the board check gone and rows on the Macs that have the block, the parameter is not needed; a feature that ships should not need a switch to be safe.
  • DCP_HDMI_CONVERTER_BOOT_MS (1.5 s) and the 2 s retry are fixed delays measured on one machine. If the converter signals readiness in any way (HPD/AUX answering, the DPTX connect returning a distinguishable "not ready"), wait on that instead; otherwise the retry loop alone (connect, back off on timeout) covers a converter that boots faster or slower without a guessed constant.

Points to consider:

  • dcp_reclaim_wake_hdmi() sleeps up to 1.5 + 2 + 2 s with dcp_typec_fabric_lock held. That lock is shared by every DCP, so a cold-converter reclaim stalls all other Type-C/HDMI hotplug handling for up to 5.5 s.
  • Converter state across s2idle is untested; a resume with the converter off and a display plugged in during sleep should get its own row.

Assisted-by: LLM (Claude:Opus 5.5)

@Ante042

Ante042 commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

The board check and the parameter are there because the J314s is the only machine I have measured and tried, not because I think the others differ. It is also the only one I have, so I can't produce the rows for the 16", the M2 Pro/Max laptops or the desktops myself. If the check goes, those rows have to come from people who have the machines, and I'm glad to help anyone who wants to try it.

On the delays: I have not found any sign of readiness from the converter. HPD reaches the SoC with it off, and a connect sent too early simply times out. So the retry loop alone is what is left: connect, back off on a timeout, no boot constant. I'll measure what that costs from plug to picture. The reclaim should not sleep with the fabric lock held either, and I'll change that together with it.

So the next version drops the board check and the parameter, has no fixed boot delay and no long wait under the fabric lock, and comes with an s2idle row with a display plugged in during the sleep. I need the laptop at the desk with the HDMI display for that, so it will take me a little while.

@Ante042
Ante042 force-pushed the j314s-hdmi-converter-on-demand branch 2 times, most recently from 25ab7d7 to 069c36f Compare November 28, 2026 09:13
The DP-to-HDMI converter behind the HDMI port is powered from probe on
and draws about 0.6 W with nothing plugged in: on the 14" M1 Pro MacBook
Pro (J314s) the machine idles at 2.09 W instead of 2.71 W with the
screen off once dp2hdmi-pwren is low.  The connector's HPD reaches the
SoC without the converter, so it does not have to be on to see a display
arrive, and macOS keeps it off until then.

Power the converter down 10 s after HPD goes low, and up again at the
next connect.  The connect is sent at once.  The converter needs a
little over two seconds to boot, which is longer than the connect waits
for the link configuration, but on this connector a wait that runs out
leaves the port connected, and the firmware raises HPD itself when the
converter answers.  So a cold converter needs no delay and no retry,
and the callers of dcp_dptx_connect() see no new return value.  The
power-down work also releases a DPTX port that nothing released, which
happens when the cable is pulled while the CRTC is off.

Every DCP with a converter power GPIO and an HDMI HPD interrupt is
managed.  The external-native ones are left as they are: their output
setup switches the converter itself.

Signed-off-by: Andreas Fernandez <[email protected]>
@Ante042
Ante042 force-pushed the j314s-hdmi-converter-on-demand branch from 069c36f to 49702d5 Compare November 29, 2026 21:56
@Ante042 Ante042 changed the title drm/apple: dcp: power the J314s HDMI converter only with a display drm/apple: dcp: power the HDMI converter only with a display Nov 29, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants