Repository navigation
soc: samsung: gs201: battery current limiter for the Pixel 7 - #274
Open
angelrenefm wants to merge 3 commits into
Open
angelrenefm wants to merge 3 commits into
angelrenefm wants to merge 3 commits into
Conversation
On Google Tensor G2 phones the MAX77759 raises vdroop1 (SYS_UVLO1) and vdroop2 (SYS_UVLO2 or BAT_OILO) on two GPIOs, and the S2MPG12 lowers SMPL_WARN on a third, when the battery voltage droops or its current goes over the limit. Describe the three lines and the GPU whose frequency is capped with the CPUs' while one is asserted. The pins are those of Google's gs201-cloudripper-bcl.dtsi. Assisted-by: LLM Signed-off-by: Ángel René <17342133+angelrenefm@users.noreply.github.com>
Stock Android on the Pixel 7 and 7 Pro runs the CPU clusters up to 1803/2348/2850 MHz and the GPU up to 848 MHz because its battery current limiter pulls them back when the battery can't keep up. Without one, the mid and big clusters stop at 1999/2252 MHz and the GPU at 572 MHz, the levels stock falls back to on a droop. Take the three lines (vdroop1, vdroop2, SMPL_WARN) and, while one is asserted, cap the clusters through cpufreq QoS and the GPU through devfreq QoS at stock's values (freq_qos in gs201-cloudripper-bcl.dtsi). vdroop2 shares its pin with BAT_OILO and can't be told apart without the MAX77759's interrupt register, so it takes the stricter of the two rows. Each line is taken on its asserting edge, read again every 5 ms, and released once it has been clear for 20 ms. debugfs shows each line's state and counts, and can force a line asserted to test the caps. It writes nothing to either PMIC, and it doesn't program the clusters' hardware clock dividers, so it covers droops that last milliseconds, not microsecond transients. Tested on a Pixel 7 as a module, with a test-only shim for the GPIOs: the three lines bind as edge interrupts on gpa5, idle; forcing each line applies its caps to the three policies and the GPU's devfreq and lifts them on release, and two lines at once take the stricter caps. Assisted-by: LLM Signed-off-by: Ángel René <17342133+angelrenefm@users.noreply.github.com>
…miter The MAX77759's vdroop1 and vdroop2 on gpa5-5/6 and the S2MPG12's SMPL_WARN on gpa5-0, as Google's gs201-cloudripper-bcl.dtsi, with the GPU to cap. Assisted-by: LLM Signed-off-by: Ángel René <17342133+angelrenefm@users.noreply.github.com>
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.
Stock Android lets the Pixel 7 run its big cluster at 2850 MHz and the GPU at 848 MHz. It can do that because the battery current limiter (BCL) pulls the clocks back when the battery droops. Without a BCL,
omamobilestops at 2252 MHz and 572 MHz, the levels stock falls back to during a droop. This series adds the listener half of that limiter, so those caps can be lifted later.What it does:
gs201-cloudripper-bcl.dtsiuses: vdroop1 and vdroop2 from the MAX77759 on gpa5-5/6, and SMPL_WARN from the S2MPG12 on gpa5-0.freq_qostable.Tested on a Pixel 7 (panther):
tools/kernel-pr-check --buildpasses onomamobile: sign-offs, checkpatch--strict, the W=1 build,dtbs_checkanddt_binding_check.Not in this PR:
CONFIG_GS201_BCL=min omarchy-mobile'somamobile.config.gs201_gpu_max_khz=572000and droppingturbo-modefrom the OPPs for panther. Those are your call once this is in, and I'd send them separately.Not tested:
I used AI help (Claude) to work on this.