Skip to content

drm/apple, arm64: dts: apple: t8140: move the J700 surface and power-LUT data into the device tree - #2358

Closed
RyanTheTide wants to merge 3 commits into
mainfrom
hack/drm-board-gates-a
Closed

RyanTheTide wants to merge 3 commits into
mainfrom
hack/drm-board-gates-a

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Two J700 display paths were chosen by the machine compatible instead of by device tree data:

  • drivers/gpu/drm/apple/dcp.c (around line 7277, from 231a8f9): the T8140 DCP node in t8140.dtsi had apple,iomfb-surfaces = <0>. The driver and the binding read that property as per-slot enable flags, so <0> enables nothing, and dcp_platform_probe() set surface 0 anyway when the machine was apple,j700. The value comes from our own DTS; m1n1 does not write the property.
  • drivers/gpu/drm/apple/iomfb_h17p.c (around line 486, from bd59a57 and 1ff0899): when the DCP node lacked one of the five apple,power-lut-* tables the H17P firmware asks for through the D400 provider callback, the driver answered with J700 bytes built into the driver, again only when the machine was apple,j700, on the internal and the external processor. These tables are the panel's power model, which is board data.

Change

  1. arm64: dts: apple: t8140: enable surface 0 with the per-slot flag: the T8140 DCP node now says <1> (slot 0 enabled). The machine-gated special case and the binding note about a "legacy J700 encoding" are removed. The surface bitmap is the same as before: bit 0 only.
  2. drm/apple: iomfb_h17p: take the power LUT from the device tree only: the J700 tables (byte for byte what the driver carried, which matches disp0 in the ADT) move to the J700 dcp and dcpext nodes in t8140-j700.dts. The built-in copy and the machine check are gone. A table that is missing is now reported as missing and stops the transaction on every board, as a malformed one already did. The loader may still replace the internal processor's copy from the ADT (m1n1 does since its T8140 provider-table change); it writes the same bytes.

Every SoC it reaches: only T8140 uses the H17P provider callback with these tables and only T8140 had the <0> surface encoding, and the only T8140 board is J700. Other boards keep the paths they had: their surface masks do not change, and they never had a fallback table. One thing the hardware row must check: a kernel booted with an old J700 DTB (<0>, no tables) now stops at "No usable display surfaces" or a missing provider property, so the DTB has to be shipped with the kernel, as it is in our kits.

Hardware result and follow-up commit

A Neo (J700) one-shot of a combined test kernel with this branch, booted on the Neo's production device tree (which still has apple,iomfb-surfaces = <0>), lost the display: apple-drm display-subsystem: error -EINVAL: No usable display surfaces. The DTB on a lab Neo comes from the boot loader, not from the kernel being tested, so an older DTB with a newer kernel is a real case.

The third commit (6a8f1aa) reads a surface list that enables no slot as the older single-index form, meaning slot 0, on every DCP, and logs an info line. No in-tree DTB carries such a list any more, so new DTBs are unaffected. The binding documents the older form.

Testing

  • arm64 LLVM build with W=1 of dcp.o, iomfb_h17p.o (plus the other touched objects of the combined tree): no new warnings. apple/t8140-j700.dtb builds, and the decompiled DTB has apple,iomfb-surfaces = <0x01> and the five tables on both nodes with the expected bytes.
  • The host selftest tools/testing/selftests/drivers/gpu/apple-dcp (all groups, clang with ASan/UBSan): the firmware-provider case is rewritten for the new rule (no DT data: only the empty property answers; DT data of the exact length is sent on both processors; a wrong length or a present empty property fails) and passes along with the rest of the suite.
  • KUnit not run: the touched code has no KUnit cases.

Still to run

On Neo (T8140 J700), with this kernel and its DTB:

  • xxd /proc/device-tree/soc/dcp@412e00000/apple,iomfb-surfaces shows 00000001. xxd /proc/device-tree/soc/dcp@412e00000/apple,power-lut-data-x shows 0d000000.
  • dmesg | grep -iE 'provider property|usable display surfaces' is empty. Before this change a boot with a loader that lacks the tables logged missing provider property ... using the J700 defaults.
  • The internal panel comes up under appledrm. The plane count is the same as before (grep -c 'plane\[' /sys/kernel/debug/dri/0/state).
  • A USB-C monitor on the dcpext lights up and lists its modes (modetest -c), and there is no D400 failure in dmesg.
Credit and history

The surface special case came from 231a8f9 ("drm: apple: accept the legacy J700 primary surface selection"). The table fallback came from bd59a57 ("drm: apple: retain J700 provider replies with older loaders") and 1ff0899 ("drm: apple: allow the qualified J700 provider fallback on DCPEXT"). The tables themselves and the provider transfer come from 8101a4b ("drm: apple: transfer measured H17P provider power tables"). The bytes did not change; only where they live did.

Hardware rows (combined test kernel, 2026-11-20)

This change was booted in a combined test kernel: integration/aurora 0abc2f3 plus the open gate-sweep drafts plus this and the related drafts (7.3.0-aurora-hk2/pwr1/hk3). It ran once on each lab Mac (M1 Pro J316s, M2 J413, J616s, Neo J700) and was compared against the production kernel on the same Mac, using the same silent row script:

  • kernel errors, failed units and SELinux denials;
  • microphone capture byte counts;
  • camera frame counts;
  • USB speeds;
  • panel brightness steps;
  • every retry/refusal message these drafts touch;
  • 2 s2idle cycles on M1 Pro, M2 and J616s.

M1 Pro, M2 and J616s matched production on every row, apart from the new counters and lines the drafts add. The Neo row found the old-DTB display regression that #2358's follow-up commit fixes.

This PR: Neo, on the production DTB (which still has iomfb-surfaces <0>): without the third commit the display subsystem refused (-EINVAL "No usable display surfaces"). With it (hk3) the display comes up: one "apple,iomfb-surfaces enables no slot: using slot 0 (single-index form)" line, eDP-1 connected, 0 kernel errors. All other Neo rows matched production (mic 5/5, camera 60x3, USB speeds).

The T8140 DCP node gave apple,iomfb-surfaces = <0>, a single zero that
was meant to select surface 0. The binding and the driver read the
property as per-slot enable flags, so <0> enables nothing, and
dcp_platform_probe() carried a special case for exactly that encoding
on apple,j700 with an apple,t8140-dcp node.

The value comes from our device tree, not from the loader: m1n1 does not
write apple,iomfb-surfaces. Say what is meant, <1> (slot 0 enabled), and
drop the machine-gated special case and the binding note about a legacy
J700 encoding. The resulting surface mask is unchanged: bit 0 only.

A kernel booted with an older J700 DTB that still has <0> now stops
with "No usable display surfaces" instead of guessing; the DTB is
shipped with the kernel.

Fixes: 231a8f9 ("drm: apple: accept the legacy J700 primary surface selection")
Signed-off-by: Ryan Murray <[email protected]>
The H17P firmware asks for five power lookup tables through the D400
provider callback. When the DCP node lacked one, the driver answered
with J700 bytes built into the driver, selected by
of_machine_is_compatible("apple,j700") and the processor compatible,
on the internal and the external processor.

These tables describe the panel's power model: they are board data and
belong in the device tree, which the binding already describes. Put the
J700 tables (the bytes the driver carried, which match disp0 in the
ADT) on the J700 dcp and dcpext nodes, and drop the built-in copy and
the machine check. The loader still may refresh the internal
processor's copy from the ADT (m1n1 does since its T8140 provider-table
change). A missing table is now reported as missing and stops the
transaction, as a malformed one already did, on every board.

The host selftest now checks that only DT data is sent, for both
processors, and that an absent non-empty table fails.

Fixes: bd59a57 ("drm: apple: retain J700 provider replies with older loaders")
Fixes: 1ff0899 ("drm: apple: allow the qualified J700 provider fallback on DCPEXT")
Signed-off-by: Ryan Murray <[email protected]>
The previous commit dropped the J700-only reading of
"apple,iomfb-surfaces = <0>" and changed t8140.dtsi to <1>. A J700 that
boots this kernel with an older device tree, as the Neo does whenever the
boot loader keeps its DTB, then has no surface enabled and the display
subsystem refuses to probe:

  apple-drm display-subsystem: error -EINVAL: No usable display surfaces

A pipe with no surface is never a valid description, so read a list that
enables no slot as the older single-index form, slot 0, on every DCP,
with an info line. No in-tree device tree carries such a list any more
(the per-slot lists are <1>, <1 1 0 0>, <1 1 0 1> and <0 0 1 0>), so
this only changes what an old DTB gets: the display instead of -EINVAL.
Document the older form in the binding.

Signed-off-by: Ryan Murray <[email protected]>
This was referenced Nov 19, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Early note on this draft (no full review yet):

  1. arch/arm64/boot/dts/apple/t8140-j700.dts:631 and :2227: the five apple,power-lut-* tables are the panel power model copied byte for byte from the machine's ADT. Hardcoding them in the public board DT keeps a per-board copy of firmware-provided tuning data and lets it drift from the machine it boots on. Have the boot loader copy disp0's tables from the ADT into both the dcp and dcpext nodes, and drop the bytes from the DTS. The driver can stay as it is in this PR: it already reports a missing table and stops the transaction. Until loaders carry the tables, keep today's behaviour as the fallback for a missing property, and remove that fallback once a release has shipped the loader side.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Closing: the panel power tables should be copied from the ADT by the boot loader rather than carried in the board device tree.

@RyanTheTide RyanTheTide reopened this Nov 22, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Reopened and kept as a draft; the comment above lists what it still needs before review.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Closing in favour of a version where the boot loader copies the panel power tables from the ADT instead of carrying them in the board device tree.

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.

1 participant