Repository navigation
drm: apple: #203 follow-ups: sleep drain on a dead DCP, seeded backlight level, DCP node references - #208
Merged
Conversation
Before system sleep, the H17P drain runs up to four passes to settle a pending brightness change. A crashed or stopped DCP rejects every present, and the queue drain reports it idle at once, so a level that was dirty when it stopped stays pending: all four passes run and the suspend logs "brightness change still pending at suspend", although there is nothing left that could be sent. Return from the drain as soon as the DCP has crashed or its queue has stopped. The crash itself is already reported. Fixes: 6d4dc0a ("drm: apple: settle H17P brightness retries before system sleep") Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
The H17P backlight policy re-sends a level on the firmware's request only when Linux knows what the panel shows: the loader's reported level or one that a completed present carried. dcp_bl_seed() puts a decoded powerlog sample, which is the loader's level, into the state before Linux takes control, but it does not mark the level as known. A seed over a registration default therefore leaves a real level that cannot be re-sent, and the state disagrees with its own definition. The seeding helper has no caller in the driver yet, so nothing goes wrong today, but wiring it up later, for example to let a late powerlog report correct a registration default, would hit this. Mark a seeded level as known and cover both the accepted and the refused seed in KUnit. Fixes: 73dd5de ("drm: apple: never re-send a guessed H17P backlight level") Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
for_each_matching_node() hands each node to the loop body with a reference held and drops that reference itself when it moves on to the next node. apple_drm_init_dcp() also calls of_node_put() on every node it visits, and add_dcp_components() does the same, so every probe of the display subsystem drops one reference more than it took on each DCP node, and binding it drops another. The nodes are static and their platform devices keep further references, so nothing has been freed, but the counts are wrong, and repeated probe and bind attempts walk them towards a "Bad of_node_put()" error with CONFIG_OF_DYNAMIC. Leave the references to the iterator. Fixes: f2bc92f ("drm/apple: Add DCP display driver") Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three follow-ups to #203 from its post-merge review, one commit each. Commit 3 fixes a reference-count bug that predates #203.
Commits
Fixes: 6d4dc0a94dc9 ("drm: apple: settle H17P brightness retries before system sleep")dcp_bl_seed()puts a decoded powerlog sample, which is the loader's level, into the state before Linux takes control, but did not mark the level as known.Fixes: 73dd5dedcc77 ("drm: apple: never re-send a guessed H17P backlight level")for_each_matching_node()drops each node's reference itself when it moves on.apple_drm_init_dcp()andadd_dcp_components()also calledof_node_put()on every node they visited. So every probe of the display subsystem dropped one reference more than it took on each DCP node, and every bind dropped another.CONFIG_OF_DYNAMIC, repeated probe and bind attempts walk the counts towards a "Bad of_node_put()" error.Fixes: f2bc92ff49a9 ("drm/apple: Add DCP display driver")Testing
Hardware-tested on all three machines. M2 MacBook Air (J413) and M1 Pro MacBook Pro (J316s), kernel
7.1.12-aurora-fu1-mac+(same composition), compared with the previous kernel: every DCP binds with its device-tree nodes and no refcount errors (M1 Pro: both DCPs plus DCP audio). MacBook Neo (J700), kernel7.1.12-aurora-j700-fu1+(all seven follow-ups merged ontoaurora-wip35c7d87), compared item for item with the default kernel built from that base: DCP binds on every boot, brightness 2–525 nits follows every request, 5 DPMS cycles pass, results identical to the default kernel. The sleep drain on a crashed DCP (needs a suspend) and the seeded backlight level are covered by the KUnit tests only.KUnit, the Apple DCP suites under QEMU (
kunit.py --arch=arm64 LLVM=1):aurora-wipapple-dcp-backlightgoes from 11 to 12 cases.aurora-wipwith only the test applied, and passes with the fix.Native backlight harness:
tools/testing/apple/check-backlight-retry.pydoes not compile onaurora-wipitself. Its fixture lacksmin()and trips-Wunused-functionondcp_bl_resend(). With those two compile shims passed through--cc, it passes both before and after this branch. The harness itself is not changed here.Builds, W=1 on the touched directories, then a full Image + modules + dtbs, on two configurations:
arch/arm64/configs/j700-radio.config;defconfig+asahi.configwith every Apple Silicon driver as a module (16K pages, Rust).Warnings: every commit builds with no new warnings compared with
aurora-wip(35c7d87921c0).checkpatch --strict: clean, apart from the project's
Assisted-by: LLMtrailer-format warning.Merge check: merges cleanly with
aurora-wip, with the other follow-up branches, and with open PR drm/apple: support independent dual dock DP streams on J414s #46, which also touchesapple_drv.canddcp.c.Provenance
Written for this PR from the public driver source and the review findings.
🤖 Generated with Claude Code