Skip to content

drm/apple: freeze the firmware 27 sleep sequence's switches at their defaults - #2465

Open
RyanTheTide wants to merge 3 commits into
mainfrom
deadweight/dcp-v27-sleep-params
Open

RyanTheTide wants to merge 3 commits into
mainfrom
deadweight/dcp-v27-sleep-params

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

What: the firmware 27 sleep/wake sequence's bring-up switches stop being module parameters. Redone on current main (the branch's Nov 20 version could not be carried: main's dcp-v27-sleep.inc grew ~1700 lines that use these switches).

Each of the 16 parameters becomes a static const at the default it had, and its module_param()/MODULE_PARM_DESC() goes; the descriptions stay as one comment block:

  • dcp-v27-sleep.inc: v27_two_stage, v27_soft_first, v27_lit_delay_ms, v27_a115, v27_ext_a442, v27_ext_a500_again, v27_ext_cycles, v27_ext_rounds, v27_session_rounds, v27_cycle_power, v27_rtkit_cycles, v27_cycle_hold_ms, v27_cycle_pmc, v27_cycle_disp_rewrite, t6050_ext_services
  • dcp_backlight.c: v27_keep_level (review ask 2: the apple-dcp host test desktop.py now declares it static const as well)

The code that reads them is untouched, so the sequence that runs is the one main runs by default; branches only a non-default value took (the dark-wake v27_rtkit_cycles 2/3 forms, v27_lit_delay_ms, v27_ext_a500_again) are dead and folded by the compiler. Removing that dead source is a separate, larger cleanup that should come with a K114s row of its own.

Not in this PR (review ask 1): v27_cycle_hold_ms is still a fixed 12 ms minimum off time in a DCP cycle, as on main today. Replacing it with a wait for the domain (or the DCP DART) to report off needs a K114s measurement of that signal; this PR does not change the behaviour.

Tested: LLVM W=1 drivers/gpu/drm/apple/dcp.o + dcp_backlight.o (arm64 defconfig + asahi.config, CONFIG_APPLE_SOC_SLEEP=y) clean, no unused-const warnings; checkpatch --strict clean; host tests --only backlight 4/4 and --only apple-dcp 12/12 pass.

Rows: behaviour-identical by construction; the regression row is K114s (T6050, firmware 27.2): s2idle 2x + lid close/open with the internal panel (and an external display if attached): panel back lit at the same level each time. J615 (T8122 27.2) s2idle 2x as a second firmware-27 Mac.

The firmware 27 sleep and wake sequence carries 17 bring-up switches
from its development (5d46c24, 3ed9757, 69e7e75):
v27_two_stage, v27_soft_first, v27_lit_delay_ms, v27_a115,
v27_ext_a442, v27_ext_a500_again, v27_ext_cycles, v27_ext_rounds,
v27_session_rounds, v27_cycle_power, v27_rtkit_cycles,
v27_cycle_hold_ms, v27_cycle_pmc, v27_cycle_disp_rewrite,
t6050_ext_services, v27_sleep_power_oob and v27_a442. Their defaults
are the sequence that shipped; nothing we ship sets any of them.

Remove them and the branches only their non-default values took.
v27_cycle_hold_ms becomes a named constant (12 ms) with its old
description. v27_rtkit_cycles picked a mode (0-3); the default mode,
one coprocessor restart, stays and the dark-wake modes 2 and 3 go.
The fallbacks for a DART that can't be found or stopped stay.
v27_keep_level is kept: a host test builds against it.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

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

  1. drivers/gpu/drm/apple/dcp-v27-sleep.inc:15: v27_cycle_hold_ms becomes a fixed 12 ms hold on the display domain's power-off. A fixed minimum off time is a tuned delay; wait for the domain (or the DCP's DART) to report it is off, or take the time from the device tree, instead of a constant.
  2. The PR keeps v27_keep_level as a module parameter only so a host test builds. Change the host test (apple-dcp/desktop.py) to read a constant or a test hook, and drop the parameter with the others, so the sleep sequence has no parameters left.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Parked (draft stays open), checked against main @f02bd68a08cb. The branch is 6000+ commits behind and main has grown dcp-v27-sleep.inc by ~1700 lines that use these parameters (main still declares 15 of them: the dark-wake v27_rtkit_cycles >= 2/3 forms with v27_lit_delay_ms, v27_session_rounds around the display stage, the A442 tag lookup, dcp_v27_wake_expect()), so the freeze cannot be carried by resolving the two textual conflicts: it has to be redone on main's file, parameter by parameter, at main's defaults. The review asks still stand: (1) the 12 ms v27_cycle_hold_ms hold should become a wait on the domain (or the DCP DART) reporting off, or a DT value, not a constant; (2) v27_keep_level should go too, with apple-dcp/desktop.py reading a constant or test hook. A K114s (T6050, lab) s2idle + lid row on the redone head is the hardware check. Nothing pushed.

main grew the firmware 27 sleep sequence well past this branch: both
conflicted files (dcp-v27-sleep.inc, iomfb.c) are taken from main as
they are. The next commit redoes the freeze on main's code.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…defaults

The firmware 27 sleep and wake sequence still carries the bring-up
switches of its development as writable module parameters: 14 in
dcp-v27-sleep.inc (v27_two_stage, v27_soft_first, v27_lit_delay_ms,
v27_a115, v27_ext_a442, v27_ext_a500_again, v27_ext_cycles,
v27_ext_rounds, v27_session_rounds, v27_cycle_power, v27_rtkit_cycles,
v27_cycle_hold_ms, v27_cycle_pmc, v27_cycle_disp_rewrite), plus
t6050_ext_services there and v27_keep_level in dcp_backlight.c. Nothing
we ship sets any of them, and the driver may not offer tuning switches.

Make each a static const at the default it had, with the old parameter
descriptions kept as a comment, and drop the module_param()s. The code
that reads them is unchanged, so the sequence that runs is the same; the
branches only a non-default value took are now dead and are folded away
by the compiler. The apple-dcp host test declares v27_keep_level as a
const too.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide RyanTheTide changed the title drm/apple: T6050: freeze the firmware 27 sleep sequence at its defaults (-86) drm/apple: freeze the firmware 27 sleep sequence's switches at their defaults Dec 5, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Second pass 12-05 (head 47b668b): not obsolete. main still declares 15 writable v27_*/t6050_ext_services module parameters in dcp-v27-sleep.inc plus v27_keep_level in dcp_backlight.c, and no other PR removes them. Merged main (ef8a1bf; both conflicted files taken from main) and redid the freeze as the smallest correct form: each parameter becomes a static const at its default, the reading code is untouched, so the shipped sequence is unchanged. Ask 2 done (desktop.py declares a const). Ask 1 (the 12 ms hold as a wait on the domain/DART) is left as main has it and called out in the body; it needs a K114s measurement. LLVM W=1 dcp.o + dcp_backlight.o clean, checkpatch clean, host tests backlight 4/4 + apple-dcp 12/12. Rows queued: K114s s2idle 2x + lid, J615 s2idle 2x. Marking ready.

@RyanTheTide
RyanTheTide marked this pull request as ready for review December 5, 2026 02:18
@RyanTheTide
RyanTheTide requested review from a team as code owners December 5, 2026 02:18
@github-actions github-actions Bot added area:display Area from CODEOWNERS (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 Dec 5, 2026
@github-actions

github-actions Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Merge readiness at 47b668b4: not ready yet

Check Detail
CI at head ok 11 checks passed
Review no approved by aurora-silicon-review, but GitHub does not count it yet (code owner from Core, Omarchy Mac or Aurora Maintainers needed, or approval went stale)
Requested changes ok none
Hardware row at head no no line with the head SHA 47b668b4, a Mac and a result in the PR body or a comment
Conflicts ok none
PR text adopt when you next edit add a 'Risk:' line (door and Macs) (guide)

Areas: area:display

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

@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: MERGE at 47b668b

Checked: All 16 removed module parameters keep their exact default values, including the two zero-initialized values. After accounting for the declarations and module metadata, the code tokens in both driver files are identical to the base. The exact panel takeover fixture passed under GCC and Clang with address and undefined-behavior sanitizers. Hosted Apple build and Host tests are green.

The existing minimum domain-off hold is unchanged. Replacing it with a domain-state wait needs the measurement identified in the PR. The exact K114s and J615 sleep regressions and the display KUnit run remain open.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Hardware row at exact head 47b668b4316a on the K114s: PARTIAL.

  • No v27_* / t6050_ext_services parameters left under /sys/module/apple_dcp/parameters; panel up with backlight 1000/1000, external monitors lit, 0 DCP crashes.
  • Not run: s2idle x2 and lid close/open (this Mac's RTC can't wake s2idle and the lid needs hands), and the J615 row.

How: one combined test kernel, not this PR alone. Kernel 7.3.0+ = main d0684a06 + merge commits of linux#2422 d259e636, #2423 0e679b18, #3568 1aa4169b, #4059 b94d8922, #2465 47b668b4 (all merged clean, test commit 2afc7246, fleet config, cloud build https://github.com/aurora-silicon/cloud-build/actions/runs/47498815145). #4059 is in the kernel but its row is run separately. Booted as a one-shot on the lab K114s (M5 Max, T6050, 27.2 stub) with this kernel's own t6050-k114s.dtb in a trial Stage 2 (live aura 1.0.0b19 + U-Boot, only the DTB swapped), default cmdline, silent. No sleep rows on this Mac (its RTC can't wake s2idle). Health: 0 AVC, 0 failed units, no new error-level kernel lines vs the saved kernel. Saved default restored after.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:display Area from CODEOWNERS (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)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant