Repository navigation
drm: apple: let the rear Apple logo follow the built-in panel - #3638
Conversation
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>
There was a problem hiding this comment.
Verdict: HOLD at 4072c344730f
Blockers:
- Hosted CI at
4072c344730fis still running (5passed,0failed,22queued/in-progress, includingapple-build,dt-checks,host-tests, and KUnit suites). - Exact-head hardware verification on K114s booted this commit's
appledrmmodule viaM=and tested sysfs trigger binding, without booting thet6050-k114-k116.dtsilinux,default-trigger = "apple-panel"DTB hunk (or an additional lab Mac regression check for the sharedappledrmregistration 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 beforeplatform_driver_register(&apple_platform_driver), unwinds cleanly on registration failure, anddcp_panel_led_unregister()runs afterplatform_driver_unregister()on teardown. - Verified
drivers/gpu/drm/apple/dcp_backlight.canddcp_backlight.h:CONFIG_LEDS_TRIGGERS=nstubs compile cleanly with no unused symbols.dcp_panel_led_deactivate()freesled_get_trigger_data(led)safely becauseled_trigger_set()callslist_del_rcu()+synchronize_rcu()before->deactivate().- Calling
led_set_brightness()insidercu_read_lock()indcp_panel_led_update()is sleep-free (led_set_brightness_nosleep(), delegating blockingleds-pwmupdates toset_brightness_work). dcp_panel_led_update()gates ondcp_has_panel(dcp)so external DCPs cannot toggle the built-in logo trigger, andleds-pwmsetsLED_CORE_SUSPENDRESUMEfor system suspend/resume.
- Verified
arch/arm64/boot/dts/apple/t6050-k114-k116.dtsi:linux,default-trigger = "apple-panel";onled-1(apple::logo) pairs withdefault-state = "keep"and preserves the bootloader PWM level whendcp_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()): confirmedlist_del_rcu()+synchronize_rcu()precedetrig->deactivate(), anddrivers/leds/led-core.c(led_set_brightness()) dispatches non-blocking vialed_set_brightness_nosleep().drivers/gpu/drm/apple/dcp.c: verifieddcp_backlight_dpms()is invoked ondcp_poweroff()anddcp_poweron()underdcp_uses_soft_dpms(dcp)(true for K114/K116DCP_FIRMWARE_V_27_0eDP panels).- Non-blocking nit: in
dcp_panel_led_activate()anddcp_panel_led_update(),led_set_brightness()is invoked after droppingdcp_panel_led_lock. Becauseled_set_brightness()is atomic/IRQ-safe, holdingdcp_panel_led_lockacross the brightness update (or across thercu_read_lock()loop) would also close the narrow concurrentactivate()vsupdate()brightness-ordering window.
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
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>
There was a problem hiding this comment.
Verdict: HOLD at 677f75268c2c
Blockers:
- Hosted CI at
677f75268c2cis still queued (apple-build,dt-checks,host-tests,pr-text, and KUnit suites allQUEUED; priorpr-textrun was cancelled). Ready to approve once CI completes green.
Checked:
4c638663(Documentation/devicetree/bindings/leds/common.yaml): verifiedapple-panelis added to thelinux,default-triggerenum in the existing schema format with humanSigned-off-by, resolvingdt-checksfort6050-k114-k116.dtsi.677f7526(tools/asahi/backlight-coldboot-tests.py,tools/testing/selftests/drivers/gpu/apple-dcp/m4.py): verified both harnesses conditionally stubdcp_panel_led_update()when present indcp_backlight.c, matching the existing stub pattern and preserving the tests under host runs (99/99apple-dcp selftests +backlight-coldboot-testsPASS).8d22a7a0(mergemain) + unchanged driver/DT commits (4072c344): verified no driver changes relative to the K114s hardware-tested4072c344(3/3CRTC off/on cycles60 -> 0 -> 60,0DCP 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-dcpselftests99/99,backlight-coldboot-tests(+ negative controls), anddtbs_checkont6050-k114s/k114c/k116c/k116s(0default-trigger errors).
There was a problem hiding this comment.
Verdict: HOLD at b864046e
Blockers:
- Hosted CI on
b864046estill has 20 checks queued (apple-build,dt-checks,host-tests,kunit, and 16 KUnit suites;pr-textandreadinessalready passed). Ready to approve once CI finishes green.
Checked:
- Pure forward-merge of
main(45d7f828, bringing in#3672'scd321x_replug_kept_attach()host-test fix) intofeat/apple-drm-panel-led-trigger: the PR's 7 changed files (+113/-3) are unchanged from the previously reviewed677f7526head. - Preserves
common.yamlapple-panelenum (4c638663), backlight host-test stubs (677f7526),appledrmpanel LED trigger implementation (4072c344), and exact K114s/multi-board verification rows.
Evidence
- Diff audited: 7 files (
+113/-3), merge commitb864046e7479(parents677f7526+main45d7f828). - 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).
There was a problem hiding this comment.
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-paneltrigger, the register/unregister order indcp_register(), the K114/K116 dtsi and theleds/common.yamlenum. - 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 ofled_cdevs, andled_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.
deactivatefrees the per-LED level. CONFIG_LEDS_TRIGGERS=nstubs compile everything out.- The DT binds by
linux,default-trigger, and the LED core attaches it when appledrm registers the trigger (standardled_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:
activatereadsdcp_panel_lit, and a concurrent panel-off can then run before activate'sled_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_litstarts 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.
|
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 |
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. Withdefault-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
backlightLED 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 throughdefault-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 getslinux,default-trigger = "apple-panel". The LED core binds it when appledrm registers the trigger.CONFIG_LEDS_TRIGGERS=neverything 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-k114sstack8with this commit's appledrm, built with M= against that tree and signed with its key.apple::logotoapple-panelat level 60 through sysfs. The DT hunk is not in that boot's DTB.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.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-triggerboot 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.