Repository navigation
M3 Pro 1.4W sleep - #380
Closed
erykwieliczko wants to merge 8 commits into
Closed
erykwieliczko wants to merge 8 commits into
erykwieliczko wants to merge 8 commits into
Conversation
The controller sits in an always-on block and its parent interrupt is a chained handler, so it keeps running through suspend. A wake-armed peripheral interrupt therefore needs nothing more from the chip, but without irq_set_wake or IRQCHIP_SKIP_SET_WAKE enable_irq_wake() fails and no SPMI device can wake the system. Set IRQCHIP_SKIP_SET_WAKE. Signed-off-by: Eryk Wieliczko <[email protected]>
The PMU that keeps the RTC counter also has a one-shot alarm: a 32-bit compare value in whole seconds of the free-running counter (CLKM >> 15, without the wall-clock offset), a mask, and a control byte with an enable, a monitor bit and a latched event that is cleared by writing it back. It raises an SPMI peripheral interrupt. When the device tree describes the alarm registers as nvmem cells and the interrupt, implement read_alarm, set_alarm and alarm_irq_enable, report the alarm from a threaded handler, and make it a wake source if the node says so. Without them the RTC stays alarm-less as before. Signed-off-by: Eryk Wieliczko <[email protected]>
The Chapel PMIC's RTC alarm uses registers 0x2000 (control and event), 0x2008 (compare value) and 0x200e (interrupt mask) and raises peripheral interrupt 2 of nub-spmi0. Make the controller an interrupt controller, add the alarm cells to the PMIC layout and give them, the interrupt and wakeup-source to the SMC RTC, so a timer can wake the system. Signed-off-by: Eryk Wieliczko <[email protected]>
The internal panel's DPMS off and system sleep only presented zero nits, leaving the 14.7 display controller scanning out the framebuffer through suspend-to-idle. Once that blank has been presented, send A472 with its hardware-power selector (+8) and a null output word (+11), which stops scanout and the panel; power on sends the same with state 1 before the backlight is restored. The IOMFB client, the RTKit session and every DART mapping are kept. The panel now also answers the callbacks of those transitions: will_power_off (D002), powerUpDART (D574) and set_kernel_power_assert (D700) with status 0, as the host keeps the display powered; the intent-swap notification (D591) that follows power off; and enable_backlight_message_ap_gated (D593) at power on, which requests a brightness present as on older firmware. The blocking 14.7 call helper moves out of the external role so the panel can use it. On J514S this takes suspend-to-idle from 2.69 W to 1.60 W and the idle system with the panel off from about 5.9 W to 4.3 W. appledrm.panel_hw_off=0 restores the blank-only behaviour. Signed-off-by: Eryk Wieliczko <[email protected]>
…leep The DCS4/FAB2 floor the CPU clients request for memory throughput also holds the fabric and the memory controller at their top states while the machine idles: FAB 5 / DCS 8, against FAB 3 / DCS 4 without it, the states macOS idles at. Once the floor is confirmed, register a PM notifier that withdraws it before system sleep and requests it again, as a fresh transition, after resume. Signed-off-by: Eryk Wieliczko <[email protected]>
…system sleep The DISPEXT0/1 requests are retained once acknowledged, so the PMP keeps its external display state up (DISP_EXT 3) while no display is shown, which costs about 0.25 W in suspend-to-idle on J514S. The PMP releases a request when its bit is cleared in a full replacement of the entry, written through the same aperture as the assertion; macOS withdraws its display requests that way. In the noirq phase, once every display controller has suspended, withdraw the acknowledged external requests and wait for the acknowledgement to clear; request them again in resume_noirq, before the controllers resume. DISP and ANS, the PMGR chains and the coprocessors are left as they are. Signed-off-by: Eryk Wieliczko <[email protected]>
The DCPEXT coprocessors start only when a sink appears, but suspend marked every controller as a wakeup path, so the power chains of idle ones (SYS, FE, CPU, their DARTs and the LW10 fabric above them) stayed on through suspend-to-idle. A controller that was never started has no session to keep: leave its chain to the power domain core, which turns it off for system sleep and on again at resume, where the DARTs restore their translation state. A started controller still keeps its power. Signed-off-by: Eryk Wieliczko <[email protected]>
When the PMP is not serving the table, power_on bails out before reading the acknowledgement entry and the error message printed an uninitialised value. Report zero instead. Signed-off-by: Eryk Wieliczko <[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.
Suspend-to-idle on J514S (MacBook Pro M3 Pro): about 2.7 W without these patches, 1.29 W with them (68 minutes asleep, battery coulomb counter). Also adds the PMU RTC alarm, so
rtcwakeworks.Based on #358.
🤖 Generated with Claude Code