Repository navigation
mfd: macsmc: write WKTP full-wake state on probe and full resume - #2782
Open
DjDeveloperr wants to merge 1 commit into
Open
DjDeveloperr wants to merge 1 commit into
DjDeveloperr wants to merge 1 commit into
Conversation
On Apple Silicon machines whose SMC exposes the 1-byte writable WKTP (Wake Type / Silent Running) key (such as T8132 J773g), waking from firmware deep sleep on a non-HID source leaves the SMC in Silent Running (Power Nap) mode until the OS writes WKTP = 0 to signal a full wake. While stuck in Silent Running, the SMC holds the fan at 0 RPM, clamps thermal/power budgets under load, and emits thermal-pressure sleep requests until the next cold reboot. Probe SMC_KEY(WKTP) dynamically via apple_smc_get_key_info() during apple_smc_probe() (requiring a 1-byte key with APPLE_SMC_WRITABLE) with no board allowlists, device-tree properties, or module knobs: - Record smc->has_wktp and write WKTP = 0 once at probe so warm-boot or kexec paths start out of Silent Running. - In apple_smc_complete(), after the quarantine check and any sleep_warned rollback, write WKTP = 0 when smc->has_wktp and !pm_dark_wake(), logging a warning on failure. - Add KUnit coverage in drivers/mfd/macsmc-test.c for WKTP probing, full-wake completion, dark-wake skipping, and quarantined skipping. Signed-off-by: Diljit Singh <hey@djdev.me>
Contributor
|
Read at ae55086. Selecting on the key itself (present, 1 byte, writable) rather than on a board is the right shape, and writing the full-wake value at probe and after a full resume (not on dark wakes) matches what the description says the SMC waits for. Because the selection is by key, this now runs on every Mac whose SMC exposes
Assisted-by: LLM (Claude:Opus 5.5) |
Contributor
Author
|
@RyanTheTide Thanks for the review!
Assisted-by: LLM (Gemini:4 Neon) |
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.
Summary
On Apple Silicon machines whose SMC exposes the 1-byte writable
WKTP(Wake Type / Silent Running) key (such as T8132 M4 Mac miniJ773g), waking from firmware deep sleep on a non-HID wake source (such as RTC /NUB.SPMI0.SW3) leaves the SMC in Silent Running (Power Nap) mode until the OS writesWKTP = 0to signal a full wake. While stuck in Silent Running, the SMC holds the fan at 0 RPM, clamps thermal/power budgets under load, and emits thermal-pressure sleep requests until the next cold reboot.This patch probes
SMC_KEY(WKTP)dynamically duringapple_smc_probe()viaapple_smc_get_key_info()(requiring a 1-byte key withAPPLE_SMC_WRITABLE) — with no board allowlists, device-tree properties, or module knobs:smc->has_wktpand writesWKTP = 0(SMC_WAKE_TYPE_FULL) once at probe so warm-boot / kexec paths start out of Silent Running.apple_smc_complete(), after the quarantine check and anysleep_warnedrollback, writesWKTP = 0whensmc->has_wktp && !pm_dark_wake(), logging a warning on failure.drivers/mfd/macsmc-test.c(macsmc_wktp_probe_test,macsmc_wktp_full_wake_test,macsmc_wktp_dark_wake_test,macsmc_wktp_quarantined_test).Verification
scripts/checkpatch.pl --strict --ignore FILE_PATH_CHANGES:0 errors, 0 warnings, 0 checks.J773g/T8132, macOS 27.226B123,7.3.0-ARCH-m4prod11, rundcp72-m4prod11-wave5-v7tc-s2r):rtcwake -d /dev/rtc1 -m mem -s 15,boot object resumes 0 -> 1 -> 2, wake sourceNUB.SPMI0.SW3, zero SErrors/BUGs/WARNs).fan=0 RPMand Power Nap throttling: pre-sleepfan=1000 RPM-> post-Deep1fan=1798 RPM-> post-Deep2fan=999–1000 RPM.render.heavy fill d=4: 250.00 us / 132.71 Gpix/s,compute.heavy alu d=4: 556.79 us / 3856.88 GF/s).Assisted-by: LLM (Gemini:4 Neon)