Repository navigation
drm: apple: answer eDP for the J313 backlight and cap it at 394 nits - #225
Conversation
529d348 to
a7b3793
Compare
|
Tested on a J313 (M1 Air), automated and by eye: the 394-nit cap works. The
How this was tested
|
c230f92 to
aee94f0
Compare
Firmware older than 26 answers create_backlight_service with dcp_has_panel() only. That stays false until the panel dimensions have been parsed, which is after 13.5 firmware asks during start_ios_gated. The firmware then reports that it could not find the Backlight service, and later backlight writes are ignored until a modeset power cycle. connector_type is already eDP when the panel node has been read. Answer an eDP connector on that path the same way firmware 26 and newer does. External displays are not eDP and still answer false. J313 BrightnessLCD rejects 395 nits and above: iDAC 1956 is accepted and 1957 is not. apple,max-brightness is 420, so 100% asks for a level the firmware drops. Cap apple,panel-j313, and a panel id of J313, at 394 nits. Other panels keep the device-tree maximum, and 100% on this panel lands on 394. Measured on a MacBook Air (M1, 2020, J313, DCP firmware 13.5) running linux-aurora 7.2.11. This commit has not been booted as a new kernel. Signed-off-by: Lucas Goossen <lucas.goossen@hey.com>
DCP 13.5 reports brightness on the old 420-nit scale after the panel is capped at 394, so actual_brightness read back as 420 and a write of 393 came back as 419. Clamp the stored nits, and the sysfs readback, to the panel maximum. On this machine the panel node is read before firmware starts, so dcp_has_panel() is already true when the backlight service is created and answering eDP as well does not change that return. The missing service log and the need for a modeset before writes apply are unchanged. Not hardware-tested. Signed-off-by: Lucas Goossen <lucas.goossen@hey.com>
aee94f0 to
86a999a
Compare
chriskearney
left a comment
There was a problem hiding this comment.
Reviewed exact head 86a999abd1c9f430658d8882f0b13be82b43e7ae: all four files, current bind/identity/report/getter paths and effective merge. Source/host PASS for the bounded J313 cap and legacy readback clamps, subject to required CI and full MQ. #224 is separate overlapping work, not an included dependency.
Exact-function/block ASan+UBSan controls pass 248 assertions for the 13.5 template and 249 for the 26 template, with intended baseline failures and six compiled semantic mutants caught. J313 identity and cap code are byte-identical to the older physical cap test; the new readback clamps are not physically tested. In-range/zero behavior and the active modern-policy bypass are preserved in the source and controls.
This is not a boot-time backlight-service fix. DCP 13.5 still needs the existing modeset behavior before brightness writes apply. Old 420-scale feedback is bounded, not rescaled: actual_brightness is not proof of luminance or an exact inverse of the requested level. These limits remain explicit. No additional physical boot is needed solely for this cap/clamp delta; CI/QEMU is not backlight, lid-resume or exact-head hardware qualification.
e78287f
J313
BrightnessLCD::nitsToDBVrejects 395 nits and above (iDAC 1956 is accepted, 1957 is not).apple,max-brightnessis 420, so 100% asked for a level the firmware drops.apple,panel-j313, and a panel id of J313, is capped at 394 nits. Other panels keep the device-tree maximum, and 100% on this panel lands on 394.dcpep_cb_create_backlight_servicestill answers true for an eDP connector as well as fordcp_has_panel(). On this J313 the panel node is read before firmware start, sowidth_mmis already set anddcp_has_panel()is already true when firmware asks duringstart_ios_gated. Answering eDP does not change that return value. DCP 13.5 still logs that it could not find the backlight service, and brightness writes still apply only after a modeset. This change does not fix that. External displays are not eDP and still answer false.Measured on a MacBook Air (M1, 2020, J313, DCP firmware 13.5) running linux-aurora 7.2.11: with the cap, setting 394 read back as 420 and setting 393 read back as 419 (393×420/394). The firmware was still reporting on the old 420 scale.
Session build, Monday 26 Oct 2026 05:02 PM -03: linux-aurora 7.2.11-6-2-ARCH (package 7.2.11.aurora6-2), branch local/j313-test at 7638df0. makepkg exited 0. rustc 1.85.0, LLVM/clang 18.1.8. This machine is running that kernel. This pull request's earlier head was a7b3793, which is not the commit that was built.
The v14 backlight KUnit tests were not run.
A separate perceptual-scale draft may touch the same backlight file and should be rebased rather than merged on top. That draft remaps the range; this one uses levels the firmware already accepts.
Follow-up, not hardware-tested
c230f92268abclampsactual_brightness, thepr_publishnits store, and the powerlog nits store to the panel maximum. A read of 420 withmax_brightness394 comes back as 394. The 420-scale proportion is not remapped, so the 419 that followed a write of 393 also clamps to 394. The eDP answer is unchanged. This clamp is not hardware-tested.