Skip to content

J416c: dual dock DP streams, DP connector type, and PCIe-C for Thunderbolt 3 docks (stacked on #46) - #50

Merged
RyanTheTide merged 18 commits into
aurora-silicon:fix/j414s-dual-dock-dpfrom
rryan:j416c-dualdock
Oct 8, 2026
Merged

RyanTheTide merged 18 commits into
aurora-silicon:fix/j414s-dual-dock-dpfrom
rryan:j416c-dualdock

Conversation

@rryan

@rryan rryan commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

J416c (16" M2 Max): dual dock DP streams, DP connector type, and PCIe-C for Thunderbolt 3 docks

Stacked PR. This builds on #46 (fix/j414s-dual-dock-dp, head 3075f5503a), which is itself stacked on #14 (via review/pr14-base). It targets #46's branch so the diff shows only these five commits. Please review/merge after #46 (and #14), or retarget once they land.

Commits

Commit Summary
drm/apple: enable dual dock DP tunnels on J416c Adds apple,j416c to the four apple,j414s gates #46 introduced (second connector per Type-C port, DPIN0 → dcpext0 / DPIN1 → dcpext1, direct DP-alt prefers dcpext1, ATC tunnel clock). J416c shares the T602x ATC PHY, display crossbar, USB4 NHI and dcpext0/1 layout with J414s; only the board gates differ.
drm/apple: expose Type-C display connectors as DisplayPort Registers the per-port Type-C connectors as DRM_MODE_CONNECTOR_DisplayPort instead of _USB (reserved for USB display adapters). systemd-logind only counts VGA/DVI/DP/HDMI/TV connectors as external displays, so a docked lid close suspended the machine. Connectors are now DP-N.
dt-bindings: pci: apple,pcie: Add apple,pciec-kernel-init Documents a boolean for PCIe-C nodes: the OS cold-initializes the port itself. Passes dt_binding_check.
PCI: apple: Cold-init PCIe-C tunnel ports without an m1n1 handoff PCIe-C currently requires apple,pciec-preinit-status = 1 from m1n1, which no m1n1 sets, so the PCIe tunnel (and the xHCI inside Thunderbolt 3 docks) never comes up. For apple,pciec-kernel-init ports, cold-init in the kernel before populating the tunnel children (the DART never completes an invalidation while APPCLK is gated). Follows the enablePortHardware() baseline of apple_pcie_tunnel_start() and the t8103 cold init in #8. Gated behind pcie_apple.tunnel_kernel_init (default off); pcie_apple.tunnel_kernel_init_trace_ms logs each step.
arm64: dts: apple: t602x-j414-j416: Enable PCIe-C kernel init Marks apciec0..2 kernel-init and adds apple,tunable to dart-apciec0..2. iBoot only adds dart-tunables-instance-0 to the ADT at boot and m1n1 doesn't copy it for these DARTs. Values taken from the live J416c ADT (macOS ioreg -p IODeviceTree -l -w0), identical on all three ports; the same decoding reproduces entry for entry the apciec tunables m1n1 already copies.

Testing

MacBook Pro 16" M2 Max (apple,j416c), Arch Linux ARM, m1n1 1.6.1, CalDigit USB-C Pro Dock (Thunderbolt 3, Titan Ridge), 40 Gb/s cable.

Worked:

  • Two 3840x2160@60 displays through the dock (dpin0 → dcpext0, dpin1 → dcpext1) plus the internal panel at 120 Hz, with the dock hotplugged after login and with it connected at boot.
  • Lid close while docked stays awake (logind HandleLidSwitchDocked), and the dock displays come back on lid open.
  • With pcie_apple.tunnel_kernel_init=1: PCIe-C cold init, link up, DART probes with the tunables, and the dock's Titan Ridge xHCI (8086:15f0) enumerates both hub trees: keyboard, USB audio, SD reader (usb-storage), UVC webcam, and r8152 Ethernet all work.
  • Unplugging and replugging the dock: displays and all dock USB devices come back.

What failed during development, for reviewers:

  • Applying the root-complex (config space) tunables while APPCLK is still off, i.e. reusing apple_pcie_tunnel_reinitialize() for cold init, hard-reset the machine with nothing in the journal. The cold init here enables APPCLK and waits for RUN first.
  • Without the DART tunables, the DART fails to probe (failed to parse PCIe-C DART tunables) and the xHCI times out (Controller Save State failed -110).

Build: each commit builds (W=1 for the touched drivers, plus the J416c DTB); checkpatch --strict is clean.

Known limitations / review focus

  • Only J416c tested. The J414 hunks in the DT commit use the same t602x-j414-j416.dtsi, so they apply to J414s/J414c/J416s as well; untested there. The DP gates in the first commit add J416c only.
  • tunnel_kernel_init defaults to off because the sequence is new on T602x. Happy to drop the parameter if reviewers prefer the DT property alone as the opt-in.
  • On unplug, apple_pcie_tunnel_stop() logs tunnel reset acknowledgment timed out / failed to quiesce PCIe-C on tunnel teardown: -110. It is harmless in practice (the replug repopulates and cold-inits from scratch), but the teardown handshake likely needs work.
  • Suspend/resume with the PCIe tunnel active is untested.
  • The DART tunables are hardcoded in the DT from one machine's ADT. The better long-term fix is for m1n1 to copy dart-tunables-instance-0 for dart-apciec*, as it already does for the apciec tunables.
  • While both dock streams are up, HDMI can't be a third display (dcpext0 drives both HDMI and dock stream 0). Unchanged from drm/apple: support independent dual dock DP streams on J414s #46.

Every commit carries an Assisted-by: Claude trailer; the code was developed with AI assistance and tested by me on the hardware above.

J416c (16" M2 Max, T6021) shares the T602x ATC PHY, display crossbar,
USB4 NHI and the dcpext0/dcpext1 layout with J414s; only the board
gates differ. Treat J416c like J414s: two connectors per Type-C port,
DPIN0 -> dcpext0 and DPIN1 -> dcpext1, direct DP-alt displays prefer
dcpext1 so dcpext0 stays free for a dock tunnel, and allow the ATC
tunnel clock.

Tested on J416c with a CalDigit USB-C Pro Dock (Thunderbolt 3): two
3840x2160@60 displays through the dock plus the internal panel at
120 Hz, on hotplug and with the dock connected at boot.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: RJ Skerry-Ryan <[email protected]>
The per-port Type-C connectors carry DisplayPort (DP alt mode or a
Thunderbolt/USB4 DP tunnel), but were registered as
DRM_MODE_CONNECTOR_USB, which DRM reserves for USB display adapters
(gud, appletbdrm). Userspace keys on the type: systemd-logind only
counts VGA/DVI/DP/HDMI/TV connectors as external displays, so a
docked lid close suspended the machine instead of honoring
HandleLidSwitchDocked=ignore.

Register them as DisplayPort. The driver's internal "is Type-C" checks
use dcp->connector_type / fixed_connector_type and are unaffected.
Connectors are now named DP-N instead of USB-N.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: RJ Skerry-Ryan <[email protected]>
PCIe-C root ports behind a USB4 router must be cold-initialized before
use. Today the kernel only accepts ports the bootloader initialized and
reported through "apple,pciec-preinit-status", which no m1n1 does.

Add a boolean for PCIe-C nodes that tells the OS to do the cold init
itself when the USB4 PCIe tunnel comes up.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: RJ Skerry-Ryan <[email protected]>
PCIe-C tunnel support requires m1n1 to cold-initialize the port and
report "apple,pciec-preinit-status" = 1, but no m1n1 does so. On
J414/J416 the tunnel is therefore always disabled and PCIe devices
behind Thunderbolt 3 docks (whose USB is an xHCI behind the tunnel)
never appear.

m1n1 already copies the PCIe-C tunables into the DT and the driver has
the port enable sequence. For ports marked "apple,pciec-kernel-init",
let the kernel do the cold init, as aurora-silicon#8 does for
t8103:

- apple_pcie_tunnel_cold_init() follows the enablePortHardware()
  baseline of apple_pcie_tunnel_start(): debug/fabric tunables, port
  reset table and tunables, PERST off and APPCLK on, wait for RUN, and
  only then the root-complex (config space) tunables. Touching config
  space while APPCLK is still off hard-resets a J416c.
- apple_pcie_tunnel_prepare() runs it on transient mappings before the
  tunnel children are populated, since the DART never completes an
  invalidation while APPCLK is gated. A port that is already running is
  left alone.
- The Thunderbolt glue and the host bridge accept kernel-init ports in
  place of the m1n1 handoff.

As the sequence is new on T602x, it is gated behind
pcie_apple.tunnel_kernel_init (default off), checked before the first
PCIe-C MMIO access. pcie_apple.tunnel_kernel_init_trace_ms logs each
step and pauses after it, for locating failures with a persistent log.

Tested on J416c with a CalDigit USB-C Pro Dock (Thunderbolt 3, Titan
Ridge xHCI 8086:15f0): the dock's hubs, keyboard, audio, SD reader,
webcam and Ethernet work, including after unplug and replug.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: RJ Skerry-Ryan <[email protected]>
No m1n1 performs the PCIe-C preinit handoff on these machines. Mark
apciec0-2 "apple,pciec-kernel-init" so the kernel cold-initializes the
Thunderbolt PCIe tunnel ports itself.

The tunneled DART driver also requires "apple,tunable", but iBoot adds
the corresponding "dart-tunables-instance-0" to the ADT only at boot and
m1n1 does not copy it for dart-apciec*. Without it the DART fails to
probe and devices behind the tunnel time out. Add the values from the
live J416c ADT (macOS ioreg), identical for all three ports; the same
decoding reproduces entry for entry the apciec tunables m1n1 already
copies into the DT.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: RJ Skerry-Ryan <[email protected]>
A Type-C port's encoder spans every pipeline that can drive the port, and
routing narrows its possible_crtcs to the pipeline actually chosen,
relying on userspace to re-read them on the following hotplug.
Compositors that read possible_crtcs once when the connector appears
(aquamarine, used by Hyprland) never see that. With a USB4 dock carrying
two streams, whichever connector connects first takes the lowest free
CRTC. When that is the DPIN1 connector, it gets dcpext0's CRTC while the
stream is routed to dcpext1, every modeset fails the atomic check with
-EINVAL, and both dock displays stay dark until the dock is replugged
and happens to connect in the other order.

possible_crtcs is meant to be static. On the dual-stream machines
(J414s, J416c):

- Fix the DPIN1 connector to the lowest-indexed Type-C-only pipeline
  (dcpext1), where DPIN1 is always routed, and route DPIN1 only within
  the connector's possible_crtcs.
- Leave the primary connector spanning all its pipelines and stop
  narrowing or restoring possible_crtcs at runtime.
- Route direct DP-alt displays to the lowest free CRTC, which is what a
  compositor picks from the port's fixed possible_crtcs, instead of
  steering them away from dcpext0.

A direct DP-alt display now takes dcpext0 when it is free, so a
single-stream dock on another port lands on the next free pipeline.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: RJ Skerry-Ryan <[email protected]>
PCIe-C is populated from delayed work queued when the PCIe tunnel is
activated. If the cable bounces, the tunnel can be deactivated before
that work runs; pcie_tunnel_requested stays set, so the work then
cold-initializes and starts PCIe-C against a tunnel that no longer
exists. On J416c the port then never links again ("link didn't come
up") until reboot, even after replugging or power-cycling the dock.

Clear the request and cancel the pending work on tunnel deactivation.
The work already re-checks the request under pcie_tunnel_lock, so a run
that is in progress either completes before the teardown takes the
lock, and is quiesced by it, or does nothing.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: RJ Skerry-Ryan <[email protected]>
When the USB4 router disappears during suspend (e.g. a Thunderbolt 3
dock under s2idle), the NHI's resume tears the PCIe tunnel down and
quiesces this host before PCIe-C's own resume_noirq runs. That resume
then starts the ports anyway, training against a tunnel that no longer
exists; on J416c the port is afterwards unable to link on every later
connect until reboot.

Skip restarting the ports when the host has been quiesced. They are
started again by apple_pcie_tunnel_restore(), or cold-initialized by a
fresh populate, once a new tunnel is up.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: RJ Skerry-Ryan <[email protected]>
oegv and others added 10 commits September 30, 2026 22:57
DCP tears its EPIC services down when an external display disconnects
and announces them again on fresh channels when it reconnects; it never
reuses a channel. On the j416s DPAVSERV endpoint (0x28), every
compositor off/on or replug of the display tears down
dcpav-service-epic (the service EDID is read through) and
dcpdp-service-epic, and announces both again: channels 1/3 at boot, then
5/7, 9/11 and so on. afk_recv_handle_init() handed out slots append-only
(ch_idx = num_channels++), and teardown only disables a service, so its
slot was never given back. After boot plus seven reconnects all
AFK_MAX_CHANNEL (16) slots were used, and the next reconnect failed:

  AFK[ep:28]: too many enabled services!
  AFK[ep:28]: expected announce but got 0xc0 on channel 33

The re-announced dcpav-service-epic then had no slot, so dcpavserv
stayed disabled and dcp_get_modes() skipped the EDID read without
logging anything. The connector's EDID stayed empty for the rest of the
boot, and a physical replug did not bring it back, since the endpoint is
never restarted.

Reuse a slot whose service was torn down, is disabled and has no
command pending. Pending commands keep their buffers in the slot until
the firmware acks them, so such a slot is left alone. The slot lock is
initialised once, when the slot is first used. Add debug messages for
teardown and slot reuse, since a normal teardown was not logged at all.

Confirmed on hardware: M2 Pro (j416s), BenQ 1440p through a USB4 hub,
fresh boot, 10 compositor off/on toggles. Each cycle logs teardown of
dcpdp-service-epic and dcpav-service-epic, then "reusing slot 0" and
"reusing slot 1" as the two services come back, with channels reaching
43 and no "too many enabled services". The EDID read back as 256
bytes after every toggle and Hyprland kept identifying the display.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Signed-off-by: Oliver Lukschander <[email protected]>
(cherry picked from commit 6fdc8fe)
Signed-off-by: RJ Skerry-Ryan <[email protected]>
The send-empty interrupt is requested with IRQF_NO_AUTOEN.
apple_mbox_send() enables it when the A2I FIFO is full and it has to
wait, and the interrupt handler disables it again when it fires. When
the wait times out or is interrupted by a signal, apple_mbox_send()
returns with the interrupt still enabled, so the next send that has to
wait calls enable_irq() on a line that is already enabled. The IRQ core
warns about the unbalanced enable, and from then on the enable state no
longer tracks whether a sender is waiting. On T8140 this shows up as
"Unbalanced enable for IRQ" warnings from the SEP hwrng thread, whose
sends can wait longer than the 500 ms timeout.

Track whether the interrupt is unmasked in struct apple_mbox, protected
by tx_lock. The sender enables it only while it is masked, the handler
disables it only while it is unmasked, and a sender whose wait failed
disables it unless a late interrupt already has. Disabling it
unconditionally on the error path would not work: the handler may
already be waiting for tx_lock and would then disable it a second time.

Fixes: 6e1457f ("soc: apple: mailbox: Add ASC/M3 mailbox driver")
Assisted-by: LLM checkpatch sparse
Co-authored-by: Claude Fable 5.1 <[email protected]>
Signed-off-by: Ryan Murray <[email protected]>
(cherry picked from commit 7a155e3)
Signed-off-by: RJ Skerry-Ryan <[email protected]>
apple_rtkit_free() and apple_rtkit_reinit() stopped the mailbox and
destroyed or flushed the workqueue, but left the mailbox's rx callback
and cookie pointing at the instance the whole time. A message popped by
a concurrent apple_rtkit_poll() or a work item queued just before the
stop could still reach the consumer's callbacks while its state was
being torn down, and apple_rtkit_init() left a dangling receiver behind
when the workqueue allocation failed.

Make the receiver an explicit ownership: claim the mailbox rx callback
under rx_lock once the workqueue exists, detach it (with the interrupt
already disabled by apple_mbox_stop()) before draining the queue, drop
messages that arrive or were queued once teardown has started, and
release the cookie only after all host state is gone.
apple_rtkit_reinit() re-arms the receiver under the lock and detaches
again if the mailbox fails to start. A mailbox poll with no receiver
attached returns without touching the FIFO; the entries are drained
once a receiver is attached again.

Claiming a mailbox that already has a receiver keeps the previous
behaviour of taking it over, now with a warning, so existing consumers
that never free their instance can still rebind.

Assisted-by: LLM checkpatch sparse
Co-authored-by: Claude Fable 5.1 <[email protected]>
Signed-off-by: Ryan Murray <[email protected]>
(cherry picked from commit 692a3c6)
Signed-off-by: RJ Skerry-Ryan <[email protected]>
apple_dart_hw_map_locked_ttbr() maps the L1 table of a locked DART
stream with devm_memremap() and checks the result for NULL, but
devm_memremap() never returns NULL: it returns ERR_PTR(-ENOMEM) or
ERR_PTR(-ENXIO) on failure. A failed mapping was therefore stored as
the table pointer, and apple_dart_hw_sync_locked() then wrote the
page-table entries through it and apple_dart_hw_unmap_locked_ttbr()
passed it to memset().

The NULL check was added together with the locked-DART page-table code
by commit 0d4ec07 ("iommu/dart: Add iommu_ops for locked DARTs"),
and became reachable once locked DARTs were allowed to probe.

Check the result with IS_ERR() and return the error, so that no error
pointer is ever stored.

Fixes: 85322eb ("iommu/dart: Support locked DARTs")
Assisted-by: LLM checkpatch sparse
Signed-off-by: Ryan Murray <[email protected]>
(cherry picked from commit 162b646)
Signed-off-by: RJ Skerry-Ryan <[email protected]>
commit d87cb88 upstream.

apple_soc_cpufreq_init() adds OPP tables from firmware, but
some failure paths do not remove them. The driver also uses
dev_pm_opp_remove_all_dynamic(), which is not the right cleanup
helper for OPP tables loaded from firmware.

Use the cpumask OPP helper after the policy CPU mask has been
populated. Pair it with the matching cpumask remove helper on
failure paths and in apple_soc_cpufreq_exit(). This also removes
the separate dev_pm_opp_set_sharing_cpus() call, as the cpumask
helper loads the DT OPP tables for all CPUs in the policy.

Fixes: 6286bbb ("cpufreq: apple-soc: Add new driver to control Apple SoC CPU P-states")
Cc: [email protected]
Signed-off-by: Haoxiang Li <[email protected]>
Signed-off-by: Viresh Kumar <[email protected]>
Signed-off-by: Ryan Murray <[email protected]>
(cherry picked from commit eb346c1)
Signed-off-by: RJ Skerry-Ryan <[email protected]>
apple_soc_cpufreq_exit() drops the static OPP tables with
dev_pm_opp_of_cpumask_remove_table(policy->cpus), but policy->cpus is
always empty by then. __cpufreq_offline() clears the outgoing CPU from
the mask first and calls ->exit() only once the last CPU of the policy
has gone, and unbinding the driver takes the same path. The call
removes nothing, so every time a cluster goes fully offline and comes
back, or the driver is rebound, the OPP table of each of its CPUs is
left with one more reference and is never freed.

Remove the tables of policy->related_cpus instead, which still lists
every CPU the policy covered, as qcom-cpufreq-hw does. The error path
of apple_soc_cpufreq_init() keeps using policy->cpus, because the core
fills in related_cpus only after ->init() has succeeded.

Fixes: d87cb88 ("cpufreq: apple-soc: Fix OPP table cleanup")
Assisted-by: LLM checkpatch sparse
Co-authored-by: Claude Fable 5.1 <[email protected]>
Signed-off-by: Ryan Murray <[email protected]>
(cherry picked from commit 6559da7)
Signed-off-by: RJ Skerry-Ryan <[email protected]>
commit f61c934 upstream.

apple_nvme_init_queue() initializes queue state and then marks the queue
enabled. The interrupt and request paths check enabled before using that
queue state.

The old wmb() after WRITE_ONCE(enabled, true) does not publish the
earlier initialization before enabled becomes visible. Use a release store
when enabling the queue and acquire loads when testing it.

Although the shutdown-side enabled accesses are not used for publishing
queue initialization, use helpers for them as well for consistency.

Fixes: 5bd2927 ("nvme-apple: Add initial Apple SoC NVMe driver")
Signed-off-by: Gui-Dong Han <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Signed-off-by: Keith Busch <[email protected]>
Signed-off-by: Ryan Murray <[email protected]>
(cherry picked from commit 8d4657c)
Signed-off-by: RJ Skerry-Ryan <[email protected]>
apple_pmp_report_probe() allocates the report with devm_kzalloc() but
never initializes rep->lock. The first apple_pmp_report_set_state() from
a child entry's probe then takes an uninitialized spinlock; with lockdep
this is reported as a non-static key and lockdep turns itself off for the
rest of the boot:

  INFO: trying to register non-static key.
  ...
   _raw_spin_lock_irqsave
   apple_pmp_report_set_state
   apple_pmp_report_entry_probe

Initialize the lock before of_platform_populate() creates the entries.

Tested on j416s (M2 Pro) with PROVE_LOCKING: the report is gone and
lockdep stays enabled.

Fixes: e5f8c27 ("pmdomain: apple: Add PMP reporting interface")
Signed-off-by: Oliver Lukschander <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit 583b9fa)
Signed-off-by: RJ Skerry-Ryan <[email protected]>
Commit c300d1b ("soc: apple: pmgr: Add force-disable/force-reset")
changed the transition poll in apple_pmgr_ps_set() to read into cur,
but left the timeout message printing reg, which now holds the value
that was written. Since then the "now:" field shows what was requested
rather than the state the domain is stuck in.

Print both the value written and the last value read back. On T8140,
audio_leap_mca occasionally misses the 100 us poll window, and the
read-back value (0xa4f: BUSY set, ACTUAL clock-gated, TARGET active) is
what tells a slow transition from a failed one.

Fixes: c300d1b ("soc: apple: pmgr: Add force-disable/force-reset")
Assisted-by: LLM checkpatch sparse
Signed-off-by: Ryan Murray <[email protected]>
(cherry picked from commit 2768025)
Signed-off-by: RJ Skerry-Ryan <[email protected]>
apple_pmgr_ps_set() builds the words it writes from a read of the power
state register. It clears the WAS_CLKGATED and WAS_PWRGATED flags but
not BUSY (bit 11), which the hardware reports while a transition is
still in progress: on T8140 audio_leap_mca reads back 0xa4f, with BUSY
set, after missing the 100 us poll window. A value read in that state
was written back with BUSY set. Clear BUSY in the DEV_DISABLE/PS_RESET
write that precedes a power-down and in the target state write, which
the auto-enable write reuses. This changes the value written on every
SoC that uses this driver.
No failure attributable to writing BUSY back was observed; the change
is precautionary, as the bit is hardware-owned.

The error messages in apple_pmgr_ps_set() and in the reset assert and
deassert paths are printed from genpd and reset callbacks that
consumers retry, so a domain that keeps missing its poll window, as
audio_leap_mca does on T8140, repeats the same message on every
attempt. Ratelimit them; their text is unchanged.

Assisted-by: LLM checkpatch sparse
Co-authored-by: Claude Fable 5.1 <[email protected]>
Signed-off-by: Ryan Murray <[email protected]>
(cherry picked from commit afe19ef)
Signed-off-by: RJ Skerry-Ryan <[email protected]>
@chriskearney

Copy link
Copy Markdown
Contributor

@rryan I've taken two of these into #8 (947026902232): the DP-N connector type and the fixed dual-stream possible_crtcs, with you as author. dcp_typec_dual_stream() maps to #8's apple_dp_tunnel_t602x(), so j414c and j416s are dual-stream too. The j416c gates are already covered there. The PCIe-C cold init isn't in yet: #8 has its own t8103 PCIe tunnel cold-init and resume handling, so I want to merge yours with that carefully rather than stack a second path. I'll follow up here.

@chriskearney

Copy link
Copy Markdown
Contributor

A regression report on 7a6e658b76cc ("drm/apple: Keep dual-stream Type-C possible_crtcs fixed"), which we carry in #8 and in the aurora-sep test builds since 11.17.

Setup: a J416c (M2 Max 16") with two direct DP-alt monitors, one per USB-C port, both attached at boot, under Hyprland. No dock.

Symptom: both monitors light up, but every native mode fails the atomic TEST_ONLY commit with -EINVAL. Hyprland falls back to 2560x1440, the only mode the two monitors share. The same machine and monitors ran at native resolution (3440x1440@60, 5120x1440@120) on an older kernel without this change. The DCP log shows the cross-wiring: one DCP is mode-set with the other monitor's colour mode (VRR on, while the connector's EDID is VRR-incapable).

Cause: the lowest-free-CRTC rule only matches what aquamarine does on a runtime hotplug.

  • aquamarine reads possible_crtcs once, in SDRMConnector::init(), and never re-reads them on connect.
  • At session start, CDRMBackend::recheckCRTCs() walks the CRTCs in index order and gives each one to the first eligible connected connector in connector order.
  • With two primary connectors both spanning {dcpext0, dcpext1}, it therefore always pairs port 0 → dcpext0 and port 1 → dcpext1.
  • The fabric routes the two displays in Type-C event order. If port 1's DP-alt event is processed first, the routes are reversed, lookup_mode() validates each connector against the other DCP's mode list, and only shared modes pass.
  • Runtime hotplug after login still works, because then "lowest free" and aquamarine agree.

Fix we're working on for #8: while no Type-C pipeline's CRTC is active (boot or session start, before the compositor has modeset anything), keep direct DP-alt routes in port order. A display that appears on a lower-index port than one already routed swaps the two routes. Once a pipeline is in use, keep "lowest free", which already matches aquamarine. The DPIN1 connector stays fixed to dcpext1 as in your change, so the dual-stream dock case is untouched. Review welcome. If you have a J416c with two direct monitors, a boot with both attached is the test.

@chriskearney

Copy link
Copy Markdown
Contributor

Follow-up: the routing fix is now in our #8 as 581d7e3 and shipped in iconidentify/aurora-linux 11.23.

  • It keeps your fixed possible_crtcs and the DPIN1-on-dcpext1 rule.
  • Until a compositor owns the display, it routes the streams in the order the compositor will pair them, so two direct monitors at boot are no longer crossed.
  • Your dual-dock case should behave as before once Hyprland is running. If you get a chance on your J416c, the two checks that matter are your dual-dock setup and two direct monitors at boot.

11.23 also carries the J416c sensor lines you confirmed, through the shared J414/J416 include. Thank you for those.

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.

6 participants