Skip to content

drm: apple: let the rear Apple logo follow the built-in panel - #3638

Merged
RyanTheTide merged 5 commits into
mainfrom
feat/apple-drm-panel-led-trigger
Dec 1, 2026
Merged

RyanTheTide merged 5 commits into
mainfrom
feat/apple-drm-panel-led-trigger

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The PROLED MacBook Pros (K114c/K114s/K116c/K116s) light their rear Apple logo from a PWM LED, apple::logo (#1025). Nothing ever turns it off. With default-state = "keep" it stays at the boot loader's level with the lid closed, the panel off, or the Mac asleep. On Ryan's K114s it stayed lit with the lid shut. On macOS the logo is lit only while the built-in panel is.

The kernel's backlight LED trigger does not help here. It fires only on fbdev blank, which a Wayland/KMS desktop never sends. The panel's backlight device (apple-panel-bl) does not change on DPMS either: it still reads power on and brightness 171 while the panel is off.

Change

  • dcp_backlight.c: a new LED trigger, apple-panel. dcp_backlight_dpms() reports the built-in panel's backlight power to it; DCPs without a panel (dcp_has_panel() false) are ignored. A bound LED goes to 0 when the panel goes off. It comes back on at the level it had when it was bound: the boot loader's level through default-state = "keep", or its maximum if that level was 0. Each LED keeps its own level.
  • dcp.c: the trigger is registered and unregistered with the DCP platform driver.
  • t6050-k114-k116.dtsi: the logo gets linux,default-trigger = "apple-panel". The LED core binds it when appledrm registers the trigger.
  • With CONFIG_LEDS_TRIGGERS=n everything compiles out.

Testing

Tested: K114s M5 Pro at 4072c34 (the driver commit; the head adds a binding enum entry, two host-test stubs and a merge of main, no driver change): 3/3 internal panel off/on cycles, logo 60 -> 0 -> 60 each time, 0 DCP crashes, 0 failed units. Host: apple-dcp selftests 99/99 and backlight-coldboot-tests (+ negative controls) pass at 677f752; dtbs_check on t6050-k114s/k114c/k116c/k116s has 0 default-trigger errors (a misspelt enum gives 1).

K114s (14-inch M5 Pro, T6050, 27.2), one-shot boot of Ryan's bridge kernel 7.3.0-k114sstack8 with this commit's appledrm, built with M= against that tree and signed with its key.

  • Bound apple::logo to apple-panel at level 60 through sysfs. The DT hunk is not in that boot's DTB.
  • Ran 3 internal CRTC off/on cycles (pwrcycle, VRR on, 2 s off / 2 s on) and sampled the LED every 100 ms. It changes only at the panel transitions: 60 → 0 → 60 → 0 → 60 → 0 → 60.
  • 0 DCP crashes, 0 failed units. Plain reboot back to the stock module afterwards.
  • Evidence: traces/display/20261130-k114s-logo-row/ on the store.

Not tested yet: the lid itself, which needs a person at the Mac (lid close drives the same panel-off path), and the DT default-trigger boot path.

Risk

two-way · appledrm on every Mac (one more LED trigger, registered whether or not any LED uses it). Only the four K boards bind an LED to it.

The K114/K116 MacBook Pros light their rear Apple logo from a PWM LED
(apple::logo). Nothing turns it off: with default-state "keep" it stays
at the boot loader's level with the lid closed, the panel off or the Mac
asleep. On macOS it is lit only while the built-in panel is.

Add an LED trigger, "apple-panel", that follows the built-in panel's
backlight power in dcp_backlight_dpms(): off when the panel goes off,
back on at the level the LED had when it was bound (the boot loader's
level with default-state "keep", else its maximum). Use it as the logo's
default trigger on the K boards.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide
RyanTheTide requested review from a team as code owners November 29, 2026 16:34

@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 4072c344730f

Blockers:

  • Hosted CI at 4072c344730f is still running (5 passed, 0 failed, 22 queued/in-progress, including apple-build, dt-checks, host-tests, and KUnit suites).
  • Exact-head hardware verification on K114s booted this commit's appledrm module via M= and tested sysfs trigger binding, without booting the t6050-k114-k116.dtsi linux,default-trigger = "apple-panel" DTB hunk (or an additional lab Mac regression check for the shared appledrm registration path); confirm whether a DT-booted K114s row (or second-family regression row) is needed before merge.

Checked:

  • Verified drivers/gpu/drm/apple/dcp.c (dcp_register() / dcp_unregister()): dcp_panel_led_register() runs before platform_driver_register(&apple_platform_driver), unwinds cleanly on registration failure, and dcp_panel_led_unregister() runs after platform_driver_unregister() on teardown.
  • Verified drivers/gpu/drm/apple/dcp_backlight.c and dcp_backlight.h:
    • CONFIG_LEDS_TRIGGERS=n stubs compile cleanly with no unused symbols.
    • dcp_panel_led_deactivate() frees led_get_trigger_data(led) safely because led_trigger_set() calls list_del_rcu() + synchronize_rcu() before ->deactivate().
    • Calling led_set_brightness() inside rcu_read_lock() in dcp_panel_led_update() is sleep-free (led_set_brightness_nosleep(), delegating blocking leds-pwm updates to set_brightness_work).
    • dcp_panel_led_update() gates on dcp_has_panel(dcp) so external DCPs cannot toggle the built-in logo trigger, and leds-pwm sets LED_CORE_SUSPENDRESUME for system suspend/resume.
  • Verified arch/arm64/boot/dts/apple/t6050-k114-k116.dtsi: linux,default-trigger = "apple-panel"; on led-1 (apple::logo) pairs with default-state = "keep" and preserves the bootloader PWM level when dcp_panel_led_activate() binds the trigger.
  • Verified DCO sign-off and K114s hardware test evidence (3 internal CRTC off/on cycles 60 -> 0 -> 60, 0 DCP crashes, 0 failed units).
Evidence
  • drivers/leds/led-triggers.c (led_trigger_set()): confirmed list_del_rcu() + synchronize_rcu() precede trig->deactivate(), and drivers/leds/led-core.c (led_set_brightness()) dispatches non-blocking via led_set_brightness_nosleep().
  • drivers/gpu/drm/apple/dcp.c: verified dcp_backlight_dpms() is invoked on dcp_poweroff() and dcp_poweron() under dcp_uses_soft_dpms(dcp) (true for K114/K116 DCP_FIRMWARE_V_27_0 eDP panels).
  • Non-blocking nit: in dcp_panel_led_activate() and dcp_panel_led_update(), led_set_brightness() is invoked after dropping dcp_panel_led_lock. Because led_set_brightness() is atomic/IRQ-safe, holding dcp_panel_led_lock across the brightness update (or across the rcu_read_lock() loop) would also close the narrow concurrent activate() vs update() brightness-ordering window.

@github-actions github-actions Bot added area:bringup Area from CODEOWNERS (bot) area:display Area from CODEOWNERS (bot) blast:all 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) 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 b864046e: not ready yet

Check Detail
CI at head running running: KUnit asahi, KUnit spi-hid-apple, KUnit avd, KUnit ave, KUnit isp, KUnit jpeg
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok comment at b864046e
Conflicts ok none
PR text ok Risk: two-way · appledrm on every Mac (one more LED trigger, registered whether or not any LED uses it). Only the four K boards bind an LED to it.

Areas: area:bringup, area:display, area:gpu

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

@github-actions github-actions Bot added the ci-failing A check failed at the PR head (bot) label Nov 29, 2026
The apple-panel LED trigger (drivers/gpu/drm/apple) lights an LED while
the built-in panel of an Apple Silicon Mac is lit. The K114/K116 device
trees use it as the rear Apple logo's default trigger. List it so those
trees validate.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The apple-dcp M4 blank harness and the backlight cold-boot harness copy
dcp_backlight_dpms() out of dcp_backlight.c. It now also calls
dcp_panel_led_update(), which neither path under test needs. Stub it
when the source has it, so both harnesses build again.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (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 30, 2026

@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 677f75268c2c

Blockers:

  • Hosted CI at 677f75268c2c is still queued (apple-build, dt-checks, host-tests, pr-text, and KUnit suites all QUEUED; prior pr-text run was cancelled). Ready to approve once CI completes green.

Checked:

  • 4c638663 (Documentation/devicetree/bindings/leds/common.yaml): verified apple-panel is added to the linux,default-trigger enum in the existing schema format with human Signed-off-by, resolving dt-checks for t6050-k114-k116.dtsi.
  • 677f7526 (tools/asahi/backlight-coldboot-tests.py, tools/testing/selftests/drivers/gpu/apple-dcp/m4.py): verified both harnesses conditionally stub dcp_panel_led_update() when present in dcp_backlight.c, matching the existing stub pattern and preserving the tests under host runs (99/99 apple-dcp selftests + backlight-coldboot-tests PASS).
  • 8d22a7a0 (merge main) + unchanged driver/DT commits (4072c344): verified no driver changes relative to the K114s hardware-tested 4072c344 (3/3 CRTC off/on cycles 60 -> 0 -> 60, 0 DCP crashes), clean mergeability, DCO sign-off on all non-merge commits, and no Apple material or AI attribution.
Evidence
  • Head: 677f75268c2c84bbd51516ec272d7ff799346533 (base: main, MERGEABLE, +113/-3, 7 files, 4 commits).
  • Local verification reported at 677f7526: apple-dcp selftests 99/99, backlight-coldboot-tests (+ negative controls), and dtbs_check on t6050-k114s/k114c/k116c/k116s (0 default-trigger errors).

@github-actions github-actions Bot removed the ci-failing A check failed at the PR head (bot) label Nov 30, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Merged main again at b864046. The CI host-tests failure at 677f752 (apple-dcp probe-transaction-rollback: implicit cd321x_replug_kept_attach) came from main's #3587 and is fixed on main by #3672. No change to this PR's own commits. Locally: apple-dcp 99/99 and backlight-coldboot-tests 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 b864046e

Blockers:

  • Hosted CI on b864046e still has 20 checks queued (apple-build, dt-checks, host-tests, kunit, and 16 KUnit suites; pr-text and readiness already passed). Ready to approve once CI finishes green.

Checked:

  • Pure forward-merge of main (45d7f828, bringing in #3672's cd321x_replug_kept_attach() host-test fix) into feat/apple-drm-panel-led-trigger: the PR's 7 changed files (+113/-3) are unchanged from the previously reviewed 677f7526 head.
  • Preserves common.yaml apple-panel enum (4c638663), backlight host-test stubs (677f7526), appledrm panel LED trigger implementation (4072c344), and exact K114s/multi-board verification rows.
Evidence
  • Diff audited: 7 files (+113/-3), merge commit b864046e7479 (parents 677f7526 + main 45d7f828).
  • Status checks at review time: 2 passed (pr-text / pr-text, readiness / readiness), 20 queued (apple-build, dt-checks, host-tests, kunit, 16 KUnit suites).

@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.

Adversarial review at b864046 (non-author, KREVIEW, K-board split).

Verdict: MERGE at b864046. Hosted CI is still queued (shared-runner backlog). Readiness gates on it.

Checked:

  • Read the whole diff: the apple-panel trigger, the register/unregister order in dcp_register(), the K114/K116 dtsi and the leds/common.yaml enum.
  • Context: dcp_panel_led_update() can be called with the DCP backlight path's locks held. It only touches a spinlock-guarded bool plus an RCU walk of led_cdevs, and led_set_brightness() defers a sleeping PWM setter to the LED core's work item, so this is safe from atomic context.
  • Non-panel DCPs (dcp_has_panel() false, external/dcpext) never touch the global state, so an external monitor's DPMS can't dark the logo.
  • Lifetime: the trigger is registered before the platform driver and unregistered after it. On a registration error it is unwound. deactivate frees the per-LED level.
  • CONFIG_LEDS_TRIGGERS=n stubs compile everything out.
  • The DT binds by linux,default-trigger, and the LED core attaches it when appledrm registers the trigger (standard led_trigger_register() scan). Only the four K boards name it.
  • Row (K114s at 4072c34, unchanged driver since): 60 -> 0 -> 60 on three CRTC off/on cycles.

Non-blocking:

  • The DT default-trigger boot path and a real lid close aren't rowed yet (the sysfs bind was). Please note the first K114s boot with this DTB on the PR. Two-way risk, so a follow-up is fine.
  • Bind race, cosmetic: activate reads dcp_panel_lit, and a concurrent panel-off can then run before activate's led_set_brightness(). The logo then stays lit until the next DPMS edge. Only reachable while an LED is bound during a DPMS transition.
  • dcp_panel_lit starts true. If the module loads with the panel already off (lid shut at boot), the logo is lit until the first DPMS-on/off edge.
  • A user write of a non-zero brightness while bound isn't remembered as the new level.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Tested: K114s M5 Pro, DT-booted at b864046's code. Kernel 7.3.0-k114sstack9 = main 42169a0 + this PR (+ #3356, #3677); DTB built from the same tree, so the logo's linux,default-trigger = "apple-panel" comes from the booted DTB, no sysfs binding. Stage 2 aura main 7dbbeb1a. At boot apple::logo trigger is [apple-panel], brightness 92 (the boot loader's level). Mutter PowerSaveMode 3 -> eDP dpms Off, logo 0; PowerSaveMode 0 -> eDP On, logo 92. 0 DCP crashes, 0 failed units, Enforcing.

@RyanTheTide
RyanTheTide merged commit 9fa215b into main Dec 1, 2026
35 of 51 checks passed
@RyanTheTide
RyanTheTide deleted the feat/apple-drm-panel-led-trigger branch December 1, 2026 06:38
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:gpu Area from CODEOWNERS (bot) blast:all Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (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.

1 participant