Repository navigation
drm/apple: answer the DCP PMU temperature query with the battery temperature - #1249
Merged
Merged
Conversation
…erature DCP asks the AP for "PMUS"/"Temperature" once while it starts and, when no 2D panel temperature has been set, takes the answer as the initial panel temperature for its compensation. Linux answered with a constant 3029 on every machine. Our own macOS observation on the J700 (macOS 26.6.2) shows what macOS sends: the system battery's gas gauge temperature in 0.1 K, the same value the SMC reports in B0AT. At one boot the battery read 2997, the DCP logged "using PMU temperature as initial guess: 29.969985961" and published InitialPanelTemperature 26.5 C in Q16.16, which is (2997 - 2732) / 10, the battery temperature. An earlier boot matched in the same way (29.78 logged, 24.59 C published). Read the temperature from the system battery power supply at the time of the query and convert it back to 0.1 K. Without a battery (desktops, or no battery driver bound) keep the old reply. Load macsmc-power before the DCP so the battery exists when DCP starts. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
Contributor
Author
|
Hardware proof, test kernel
macOS side (own observation, J700 macOS 26.6.2, 04:32 boot): |
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.
DCP asks the AP for
PMUS/Temperatureonce while it starts. When no 2D panel temperature has been set it uses the answer as the initial panel temperature for its compensation (initial_guess: ... using PMU temperature as initial guess). Linux answered a constant 3029 on every machine, so the DCP always started from 30.29 (really 29.7 C, see below).What macOS sends (our own observation, J700 Neo, macOS 26.6.2)
initial_guessTemperature(= SMCB0AT)InitialPanelTemperature(Q16.16)TB0T26.5So macOS answers with the battery gas gauge temperature in 0.1 K; the firmware prints it /100 but converts it as Kelvin. The Neo's macOS also logs the "2D temperature from SMC not set" line (it never sets a 2D field on that machine), so on the Neo this reply is the whole input.
Change
dcp_pmu_temperature(): first system-scope battery power supply,POWER_SUPPLY_PROP_TEMP(0.1 C) + 2732 = 0.1 K, read at the time of the query. No battery (desktops, or the battery driver not bound) keeps the old 3029.MODULE_SOFTDEP("pre: ... macsmc-power")so the SMC battery exists when DCP starts.No constants from Apple; the 2732 is the inverse of the 0.1 K -> 0.1 C conversion macsmc-power already does on
B0AT.Not in this PR
The J616s still logs "temperature from SMC not set": its macOS installs a four-corner field at boot (thermalmonitord), which needs its own trace (lane GAPS8-PANELT, spec in the lane note).
🤖 Generated with Claude Code