Repository navigation
soc: apple: sleep: T6050: lower the second encoder's system domain at the entry (J716c) - #3663
Conversation
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]>
There was a problem hiding this comment.
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-textpassed). Ready to approve once hosted CI completes cleanly.
Checked:
- Audited all 3 commits (
f01a5475,57db35a4,5b48df4f,+123/-36acrossapple,t6050-sleep.yaml,drivers/soc/apple/sleep-t6050.h,arch/arm64/boot/dts/apple/t6050-j716c-sleep.dtsi, DCOSigned-off-byon all 3,MERGEABLEonmain):apple,t6050-sleep.yaml: adds optionalapple,entry-off-domains(phandle-array, 1–4 single-cell entries).t6050_entry_off_get()(sleep-t6050.h): invoked fromt6050_sleep_map_ops()after power regions are mapped (line 1542); preserves exacts->soc->lower_venc0fallback (T6050_VENC0_SYS) when the property is absent; validates1 <= n <= T6050_ENTRY_OFF_MAX,of_property_count_u32_elems() == n, andsleep_region_domain_offset()on every phandle with__free(device_node)cleanup and-ENOMEM-checkeddevm_kstrdup().t6050_entry_off_lower()/t6050_entry_off_restore()(sleep-t6050.h): skips already-off domains and domains underPS_AUTO_ENABLE, saves pre-lower state and setsBIT(i)inentry_off_loweredbefore polling off, refuses sleep on timeout, and restores lowered words in reverse order duringt6050_sleep_refusal_raise().t6050-j716c-sleep.dtsi: setsapple,entry-off-domains = <&ps_venc0_sys>, <&ps_venc1_sys>;(J716c only; all other T6050 boards keep existing behavior).
- Verified exact-head
5b48df4f64cfJ716c M5 Max A/B deep-sleep row PASS (with#3662: logsentry: 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 localdt_binding_check,CHECK_DTBS, andcheckpatch.plclean.
Evidence
drivers/soc/apple/sleep-t6050.h:t6050_sleep_begin()resetsr->entry_off_lowered = 0;t6050_sleep_entry_lower()invokest6050_entry_off_lower();t6050_sleep_refusal_raise()invokest6050_entry_off_restore().- Non-blocking merge-order note: J716c requires companion
#3662to bootmain, though this PR is independently buildable and safe on all other T6050 boards.
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
I checked 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. |
There was a problem hiding this comment.
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()setsBIT(i)before it polls. A timeout on word i therefore leaves 0..i marked, andt6050_entry_off_restore()puts them back in reverse insidet6050_sleep_refusal_raise(), at the slotvenc0_restorehad.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 wherelower_venc0is set, so other T6050 boards behave as before. One change is deliberate: a word underPS_AUTO_ENABLEis 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_sysnodes. The J716c row log showsvenc1-sys 0xf0003ff -> 0xf000100lowered, 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_venc0as before), so no second-family row is needed for this one.
|
code-owner ping <@422957901716652033> / @DjDeveloperr: merge train at |
|
Merging under the 6-point rule (Ryan 09:29, permanent), at |
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_t6050logsUnable to change power state from unknown to D0(also after every other deep sleep we ran today, fixed loader included), Bluetooth stays poweredDetails
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
0x0f0003ffbefore the entry. Without that filter it reads0x0f000300, and every other VENC0/VENC1 word reads the same either way. The entry's last phase waits for the encoders' power gates.apple,entry-off-domains, a list of power domains (phandles).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.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.After wake, VENC1_SYS reads
0x0f0003ffagain, Wi-Fi is up and Hyprland is running. Failed units:aurora-peripherals.service, the same as the J716c daily, andsystemd-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.
0x0f0003ff0x0f0003ffmake dt_binding_check DT_SCHEMA_FILES=soc/apple/apple,t6050-sleep.yamlandmake CHECK_DTBS=y apple/t6050-j716c.dtbare clean.checkpatch.plon the three commits: 0 errors, 0 warnings.