Repository navigation
Conversation
ABL can leave LDO4M at another voltage than the touch controller needs:
on a Pixel 8a it leaves 3.3 V, read back through the driver's own
get_voltage_sel, while the stock phone runs the Goodix GT9895 there at
3.0 V (its live device tree). With voltage selectors firmware-owned, a
board that fixes 3.0 V fails to probe ("failed to apply
3000000-3000000uV constraint: -EINVAL"), and one without a constraint
would power the controller at ABL's 3.3 V.
Give LDO4M and LDO25M a set_voltage_sel through the regmap, which goes
to the PMIC through ACPM as enable does. The selector tables are
Google's: s2mpg14-regulator.c puts LDO4M in voltage group 5 (1.8 V
minimum) and LDO25M in group 4 (0.7 V), each with 64 steps of 25 mV
(s2mpg14-register.h), and writes the selector into the low six bits of
the control register (0x2e and 0x43), as the descriptors here already
read it. The other S2MPG14 outputs keep firmware-owned selectors.
The core calls the setter only to bring a voltage into the board's
constraints, so a board without voltage constraints (zumapro-tegu), or
whose constraint already matches what ABL left (zuma-husky's fixed
3.3 V, which probes today without a setter), sees no write.
Tested on a Pixel 8a from slot B (7.3.0-rc6), with LDO4M fixed at
3.0 V and LDO25M at 1.8 V in the board file and nothing consuming them:
the core logs "touch-avdd: Bringing 3300000uV into 3000000-3000000uV";
both rails then read back 3000000 and 1800000 uV (the PMIC regmap has
no cache, so that is the register through ACPM), disabled, with no
users, and stay so past the unused-regulator cleanup. Nothing enabled
them in that boot.
Link: https://android.googlesource.com/kernel/google-modules/soc/gs/+/204078758737776959ecc85c527a00fd2cabb62f/drivers/regulator/s2mpg14-regulator.c
Link: https://android.googlesource.com/kernel/google-modules/soc/gs/+/204078758737776959ecc85c527a00fd2cabb62f/include/linux/mfd/samsung/s2mpg14-register.h
Assisted-by: Claude Opus 5.5
Signed-off-by: DarekM <149845949+aninmucek@users.noreply.github.com>
Owner
|
Thank you, @aninmucek. This is exactly the shape I asked for on #238: its own PR, two outputs only, the selector tables cited from Google's files at a fixed commit, and a boot with no consumer that shows the core moving LDO4M from 3.3 V to 3.0 V before anything is powered. What I checked:
Nothing to change. I'll land it together with #241, which carries this commit as its first. |
Owner
|
Landed with #241, which carried this commit first. Thank you, @aninmucek. |
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.
The voltage setter for the S2MPG14 touch supplies, as you asked on #238. It's its own PR, with one commit on today's
omamobile(fc7086a68). It only covers LDO4M and LDO25M: every other S2MPG14 output keeps its firmware-owned selector, as5e4cda3a7left it. Nothing in this PR powers anything. akita's supplies and touch node follow in a later PR, from a later boot.1. The selector table, from Google's source and proven on an 8a.
Google's
s2mpg14-regulator.c(the commit5e4cda3a7links) puts LDO4M in voltage group 5 and LDO25M in group 4.Its
s2mpg14-register.hgives:S2MPG14_REG_MIN5 1800000,S2MPG14_REG_STEP5 25000;MIN4 700000,STEP4 25000;N_VOLTAGES_64, withvsel_mask = n - 1;S2MPG14_PM_L4M_CTRL = 0x2EandS2MPG14_PM_L25M_CTRL = 0x43.That's exactly what our descriptors already have (
min_uV,uV_step,n_voltages,vsel_mask = GENMASK(5, 0),vsel_reg). Google'ss2m_set_voltage_selwrites the selector under that mask, asregulator_set_voltage_sel_regmapdoes here.One boot on a Pixel 8a with this commit, the board file fixing LDO4M at 3.0 V and LDO25M at 1.8 V, no consumer, and no
regulator_ignore_unused:touch-avdd: Bringing 3300000uV into 3000000-3000000uV;/sys/class/regulatorthen readstouch-avdd: 3000000 uV, disabled, 0 usersandtouch-vdd: 1800000 uV, disabled, 0 users;s2mpg14_regmap_config_pmichas no cache, soget_voltage_selreads the register through ACPM.2. The other two boards are unchanged. From the DTBs this tree builds:
ldo4mandldo25mhave noregulator-min/max-microvolt, soapply_uVstays false andmachine_constraints_voltagenever calls_regulator_do_set_voltage.0x325aa0= 3.3 V,0x1b7740= 1.8 V). Withapply_uV, the core calls the setter only when the current voltage is outside the constraint (target_min != current_uV || target_max != current_uV,drivers/regulator/core.c). Without a setter today, any mismatch fails the probe with-EINVAL, as it did on the 8a. So husky's touch working on today'somamobilemeans its ABL leaves exactly 3.3 V and 1.8 V, and the setter won't be called there. That's from the code path, not a read on an 8 Pro, so an 8 Pro owner's boot log would settle it: there should be no "Bringing" line.The two rails in the three zuma-family DTBs
3. Touch comes in a later boot, one change per boot. The next akita boot adds the GT9895 node on top of this. The rails are read back at 3.0 V and 1.8 V before the driver enables them.
tools/kernel-pr-check --build OUT --merge origin/omamobilepasses everything:fc7086a68;checkpatch --strictwith no errors and no warnings;drivers/regulator/s2mps11.cbuilds withW=1(arm64, LLVM) and no warnings.No device tree is touched.
🤖 Generated with Claude Code