Skip to content

soc: apple: sleep: T6050: lower the second encoder's system domain at the entry (J716c) - #3663

Merged
RyanTheTide merged 3 commits into
mainfrom
fix/t6050-sleep-venc1
Nov 30, 2026
Merged

RyanTheTide merged 3 commits into
mainfrom
fix/t6050-sleep-venc1

Conversation

@erikwb

@erikwb erikwb commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

What: The boot loader now leaves the second video encoder's system domain (VENC1_SYS) on after programming its DART filter. Nothing in Linux owns it, and the J716c deep-sleep entry only lowers VENC0_SYS, so every deep sleep ends in the 5 s WD2 reset. This adds apple,entry-off-domains, which lets the DT name the power domains the entry lowers when it finds them on, and the J716c names both encoders' system domains.
Tested: J716c M5 Max at 5b48df4 (on main with #3662, which main needs to boot this board), boot loader unchanged: the entry logs venc1-sys 0xf0003ff -> 0xf000100, and a 30 s RTC deep sleep resumes after 31.8 s (eDP, Wi-Fi, desktop back; 0 oopses). Without it, the same kernel and loader reset about 7 s into the sleep.
Risk: two-way door · J716c only (other T6050 boards have no property and keep today's behaviour; the binding gains an optional property)
Not yet: other T6050 boards; after resume btcentauri_t6050 logs Unable to change power state from unknown to D0 (also after every other deep sleep we ran today, fixed loader included), Bluetooth stays powered

Details

The boot loader's DART filter setup raises a DART's clock gates and every parent domain, but afterwards lowers only the clock gates. For the encoder DARTs that leaves the encoder's system domain up. The entry already lowered VENC0_SYS for this reason (949b24a). Since the loader started programming the second encoder's filter, VENC1_SYS reads 0x0f0003ff before the entry. Without that filter it reads 0x0f000300, and every other VENC0/VENC1 word reads the same either way. The entry's last phase waits for the encoders' power gates.

  • Binding: apple,entry-off-domains, a list of power domains (phandles).
  • Driver: at probe each phandle goes through sleep_region_domain_offset(), so it must be a T6050 PMGR power word of a mapped power region in the board's power list. Each one that reads on with no automatic mode is lowered at the entry, after AUSS, and polled off; one under automatic power is its owner's and left alone. One that stays on refuses the sleep, and a refusal puts back each word lowered as it read before. Words that read off are left alone. After a sleep, the snapshot replay raises them again. A DT without the property keeps the old VENC0_SYS-only behaviour; a malformed one fails the probe.
  • J716c DT: apple,entry-off-domains = <&ps_venc0_sys>, <&ps_venc1_sys>;.

The loader side is aurora-silicon/aura#585: with it the loader no longer programs the filter of an encoder the tree leaves off, so VENC1_SYS stays off from boot. This entry change still covers loaders without it.

Evidence

Kernel 7.3.0-ewb404+ = main 972a566 + this PR (f01a547, 57db35a, 5b48df4) + #3662, booted once through a watchdog-armed trial loader. The loader is the J716c's current one, otherwise unchanged. Command line: default plus watchdog.open_timeout=120.

VENC0_SYS +0x1c0 0x1f0003ff   (apple-ave's domain, on)
VENC1_SYS +0x1f0 0x0f0003ff   (no Linux user)
# echo deep > /sys/power/mem_sleep; rtcwake -d rtc1 -m mem -s 30
17:45:06.180 PM: suspend entry (deep)
17:45:37.940 apple-sleep 280600000.sleep-controller: entry: venc1-sys 0xf0003ff -> 0xf000100
17:45:37.941 apple-sleep 280600000.sleep-controller: wake events: NUB.SPMI0Sw3IRQ nub-spmi0.0x02 rtc
17:45:37.941 apple-sleep 280600000.sleep-controller: back from sleep, boot object resumes 0 -> 1
17:45:37.956 PM: suspend exit

After wake, VENC1_SYS reads 0x0f0003ff again, Wi-Fi is up and Hyprland is running. Failed units: aurora-peripherals.service, the same as the J716c daily, and systemd-networkd-wait-online.service, which timed out because the sleep started inside its 2-minute window. 0 oopses.

Baseline: 7.3.0-ewb401+ = main 972a566 + #3662, without this PR, same loader, same command. The journal stops at 17:24:16, when the sleep starts, and the next boot comes at 17:24:44: the WD2 reset. A console capture of the same reset on the J716c daily kernel ends at the commit stop.

VENC1_SYS before the entry 30 s deep sleep
main + #3662 0x0f0003ff reset ~7 s in
main + #3662 + this PR 0x0f0003ff resumes after 31.8 s

make dt_binding_check DT_SCHEMA_FILES=soc/apple/apple,t6050-sleep.yaml and make CHECK_DTBS=y apple/t6050-j716c.dtb are clean. checkpatch.pl on the three commits: 0 errors, 0 warnings.

The boot loader can leave power domains on with no user while the
sleep's last phase waits for their power gates: the video encoders'
system domains, which it raises to program the encoder DARTs' filters.
Let the DT name them, so that the entry lowers each one it finds on.

Signed-off-by: Erik Bourget <[email protected]>
The J716c entry lowers VENC0_SYS when the boot loader left it on with no
Linux user, because the entry's last phase waits for the encoders' power
gates. The boot loader now leaves the second encoder's system word on in
the same way, since it programs dart-ave1's filter: VENC1_SYS reads
0x0f0003ff before the entry (0x0f000300 without that filter), Linux has
no driver for it, and the 5 s WD2 safety net resets the machine a few
seconds into every deep sleep.

Take the words to lower from the DT's apple,entry-off-domains, resolved
through the power domains' PMGR nodes, and lower each one that reads on
with no automatic mode as VENC0_SYS was: after AUSS, polled off, refusing
the sleep if one stays on, and put back as it read before on a refusal. A
word under automatic power is its owner's and is left alone. A DT without
the property keeps the old VENC0_SYS-only behaviour; a malformed one
fails the probe.

Signed-off-by: Erik Bourget <[email protected]>
…t sleep

Name VENC0_SYS and VENC1_SYS in the sleep controller's
apple,entry-off-domains, so that the entry lowers the second encoder's
system domain too when the boot loader leaves it on, instead of the
deep sleep ending in the WD2 safety-net reset.

Signed-off-by: Erik Bourget <[email protected]>

@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 5b48df4f — implementation and J716c deep-sleep row are clean; waiting on hosted CI at head.

Blockers:

  • Hosted CI at 5b48df4f (apple-build, dt-checks, kunit, host-tests, source, rust-build, DWC3/ATC, readiness) is still queued (pr-text passed). Ready to approve once hosted CI completes cleanly.

Checked:

  • Audited all 3 commits (f01a5475, 57db35a4, 5b48df4f, +123/-36 across apple,t6050-sleep.yaml, drivers/soc/apple/sleep-t6050.h, arch/arm64/boot/dts/apple/t6050-j716c-sleep.dtsi, DCO Signed-off-by on all 3, MERGEABLE on main):
    • apple,t6050-sleep.yaml: adds optional apple,entry-off-domains (phandle-array, 1–4 single-cell entries).
    • t6050_entry_off_get() (sleep-t6050.h): invoked from t6050_sleep_map_ops() after power regions are mapped (line 1542); preserves exact s->soc->lower_venc0 fallback (T6050_VENC0_SYS) when the property is absent; validates 1 <= n <= T6050_ENTRY_OFF_MAX, of_property_count_u32_elems() == n, and sleep_region_domain_offset() on every phandle with __free(device_node) cleanup and -ENOMEM-checked devm_kstrdup().
    • t6050_entry_off_lower() / t6050_entry_off_restore() (sleep-t6050.h): skips already-off domains and domains under PS_AUTO_ENABLE, saves pre-lower state and sets BIT(i) in entry_off_lowered before polling off, refuses sleep on timeout, and restores lowered words in reverse order during t6050_sleep_refusal_raise().
    • t6050-j716c-sleep.dtsi: sets apple,entry-off-domains = <&ps_venc0_sys>, <&ps_venc1_sys>; (J716c only; all other T6050 boards keep existing behavior).
  • Verified exact-head 5b48df4f64cf J716c M5 Max A/B deep-sleep row PASS (with #3662: logs entry: venc1-sys 0xf0003ff -> 0xf000100, 30 s RTC deep sleep resumes cleanly in 31.8 s with eDP/Wi-Fi/desktop back and 0 oopses, vs ~7 s WD2 reset without this PR), plus local dt_binding_check, CHECK_DTBS, and checkpatch.pl clean.
Evidence
  • drivers/soc/apple/sleep-t6050.h: t6050_sleep_begin() resets r->entry_off_lowered = 0; t6050_sleep_entry_lower() invokes t6050_entry_off_lower(); t6050_sleep_refusal_raise() invokes t6050_entry_off_restore().
  • Non-blocking merge-order note: J716c requires companion #3662 to boot main, though this PR is independently buildable and safe on all other T6050 boards.

@github-actions github-actions Bot added area:bringup Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) blast:m5 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) labels Nov 29, 2026
@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Merge readiness at 5b48df4f: not ready yet

Check Detail
CI at head ok 35 checks passed
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok in the PR body at 5b48df4f
Conflicts ok none
PR text ok Risk: two-way · J716c only (other T6050 boards have no property and keep today's behaviour; the binding gains an optional property)

Areas: area:bringup, area:platform

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

@RyanTheTide

Copy link
Copy Markdown
Contributor

I checked 5b48df4f merged locally into current Linux main 37a19f92 (tree b49108b2). The targeted apple,t6050-sleep.yaml binding validation and CHECK_DTBS=y build of the J716c DTB both passed. Reading the compiled DTB back confirmed that apple,entry-off-domains resolves to both encoder system power providers. A separately compiled main control has the same sleep controller with the property absent.

This verifies the binding and compiled DT on the new base. The existing J716c hardware result and the outstanding hosted checks retain their own scope.

@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 5b48df4 (non-author, KREVIEW).

Verdict: MERGE at 5b48df4. Hosted CI is still queued on the shared runners (9 KUnit suites pending, 19 pass, 0 fail). Readiness gates on that separately; nothing in the code is waiting on it.

Checked:

  • Read all three commits (binding, sleep-t6050.h, J716c dtsi).
  • Refusal order: t6050_entry_off_lower() sets BIT(i) before it polls. A timeout on word i therefore leaves 0..i marked, and t6050_entry_off_restore() puts them back in reverse inside t6050_sleep_refusal_raise(), at the slot venc0_restore had. t6050_sleep_begin() clears the mask, so a stale bit from an earlier entry can't restore anything.
  • Probe parsing: phandles are counted with no args, and the u32 count must equal n, so a phandle with cells is refused. Every target must resolve through sleep_region_domain_offset(), so a node outside the sleep regions is a probe error, not a wild write. __free(device_node) covers every exit.
  • Default path: with no property the list is {VENC0_SYS} only where lower_venc0 is set, so other T6050 boards behave as before. One change is deliberate: a word under PS_AUTO_ENABLE is now skipped, where VENC0 used to be lowered regardless. That fits "its owner's" in the comment. VENC0 reads 0x0f0003ff (no auto) on the J716c, so the row path does not change.
  • No hard-coded hardware values: the words come from the DT ps_venc0_sys/ps_venc1_sys nodes. The J716c row log shows venc1-sys 0xf0003ff -> 0xf000100 lowered, then a 30 s deep sleep resumes; without the PR it is a WD2 reset at ~7 s.

Non-blocking:

  • The J716c needs #3662 (merged) to boot main, so nothing to order.
  • K114s/K116 and J714s are unchanged (no property; lower_venc0 as before), so no second-family row is needed for this one.

@RyanTheTide

Copy link
Copy Markdown
Contributor

code-owner ping <@422957901716652033> / @DjDeveloperr: merge train at 5b48df4f. App approved; rows J716c-exact-head, T6050-sleep-only. Merges under the 6-point rule 1 h from now once hosted CI (and the KUnit proof) is green, unless you object.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Merging under the 6-point rule (Ryan 09:29, permanent), at 5b48df4f. (1) The review App approved at this head. (2) Full CI is green. (3/4) Rows: J716c-exact-head;T6050-sleep-only. (5) There's no blocking review. (6) Dj was pinged here 62 min ago with no objection. Revert: git revert -m 1 <merge>.

@RyanTheTide
RyanTheTide merged commit e77d745 into main Nov 30, 2026
39 checks passed
@RyanTheTide
RyanTheTide deleted the fix/t6050-sleep-venc1 branch November 30, 2026 21:56
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:platform Area from CODEOWNERS (bot) blast:m5 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.

2 participants