Skip to content

power: supply: max77759: let the charger set its own input current - #261

Open
derekross wants to merge 1 commit into
omamobilefrom
omamobile-charger-autoibus
Open

derekross wants to merge 1 commit into
omamobilefrom
omamobile-charger-autoibus

Conversation

@derekross

@derekross derekross commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

On a Pixel 7 Pro that booted from an empty battery, CHG_CNFG_09 (0xc2) read 0x93: the 500 mA limit with NO_AUTOIBUS (bit 7) set. The phone gained nothing on the cable (battery current -145 to +26 mA) until the bit was cleared by hand, which brought +1.41 A within a second (reported on derekross/omarchy-mobile#169). A user in the community chat reports the same symptom, "sometimes won't take a charge", with no register read yet.

Why. With no Type-C port controller to report the source, the driver charges at default_ilim_ua and relies on the charger to raise its input current from what it detects. NO_AUTOIBUS turns that off, and nothing in the driver touched the bit, so whatever the bootloader left stayed. Google's driver sets the bit, but it also programs the limit from what its USB-PD stack negotiated, and this driver has neither.

The change (one commit):

  • max77759_charger_start_default() clears NO_AUTOIBUS after it sets the default limit.
  • The found: and probed: lines end in (NO_AUTOIBUS set) while the bit is set; a failed clear only warns, so a user's log tells the two cases apart.
  • psy_work_item() does not touch the bit. Probe clears it on any phone with default_ilim_ua set (the 7 Pro, the Pixel 6 Pro, and the Pixel 7 with arm64: dts: exynos: google: gs201-panther: add the MAX77759 PMIC for its charger #259), with or without TCPM; no phone has both today.
  • MAX77759_CHGR_REG_CHG_CNFG_09_NO_AUTOIBUS is added to include/linux/mfd/max77759.h.

This keeps the charger's own choice of input current, which every boot of the reference phone has run on (0xc2 = 0x13). The 500 mA cap for computer ports discussed in USB-C-PLAN K1 is not part of this.

Checks (after review round 1, which added Fixes: and Link:):

  • checkpatch --strict: clean.
  • W=1 (arm64, LLVM, the project container) of max77759_charger.c and drivers/mfd/max77759.c: no warnings.
  • tools/kernel-pr-check: passes everything except the sign-off.
  • Test build: 7.3.0-rc6-omamobile-push1-g16dd7a780e64.

Not tested on hardware yet. The runbook is USB-C-PLAN K1b (omarchy-mobile PR, linked below). It reproduces the symptom on the release kernel under tools/usbc-deadman, then sets the bit across a warm reboot on this kernel. The charger regmap is REGCACHE_FLAT, filled from the hardware when the MFD probes, so a bit set with i2cset and then a rebind would not exercise the fix. It runs after the 2026.11.15 install and the M6-D sleep test.

Before merge:

Also relevant to #259 (Pixel 7 charger node), which takes the same default_ilim_ua path.

🤖 Generated with Claude Code

With no Type-C port controller to report the source, the driver charges
at default_ilim_ua and relies on the charger to raise the input current
itself, following the Rp the source advertises. It can do that only while
NO_AUTOIBUS (CHG_CNFG_09 bit 7) is clear, and nothing in the driver ever
cleared it.

Something before the kernel can leave the bit set, most likely the
bootloader: the one case seen was a Pixel 7 Pro that booted from an empty
battery, with CHG_CNFG_09 reading 0x93, the 500 mA limit with NO_AUTOIBUS
set. The input stayed at 500 mA, which a phone in use draws in full, so
the battery current sat between -145 and +26 mA on the cable. Clearing
the bit by hand (0x13, also its power-on value) took it to +1.41 A within
a second, and it stayed there.

Google's driver sets NO_AUTOIBUS, but it also programs the input limit
from the source its USB-PD stack negotiated. This driver doesn't know the
source on the default path, so clear the bit there. A failure only warns:
failing the probe would leave the charger running without the temperature
guard. The found: and probed: lines show "(NO_AUTOIBUS set)" while it is
set, so a log tells the two cases apart.

psy_work_item() doesn't touch the bit; probe clears it on any phone with
default_ilim_ua set, with or without TCPM (none has both today). On a boot
with the bit already clear, the regmap cache, filled from the hardware at
MFD probe, skips the write.

Fixes: f9c0e84 ("power: supply: max77759: charge at a default input limit without a source report")
Link: derekross/omarchy-mobile#169
Assisted-by: Claude Opus 5.5

@derekross derekross left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review notes on my own PR, second pass. The head hasn't moved.

CI is red on one check, and it is this commit's own: tools/kernel-pr-check says "no human Signed-off-by" on 16dd7a780e64. Everything else in that run passes (the merge, the prefix, checkpatch --strict, the policy checks, the W=1 build). It isn't the gate fault fixed this week, which was about a test file that only builds through its driver. With today's gate on today's omamobile (26867fc4e826) the result is the same: one failing line, the sign-off.

The branch is 43 commits behind omamobile now, but the charger driver, its header and the MFD are unchanged from the 2026.11.15 release to today's tip, so the test kernel built from this head runs the driver exactly as it will land. It merges cleanly with the three other open charger PRs.

Since the first pass, @iamteedoh reported a third Pixel 7 Pro on derekross/omarchy-mobile#169: 0xc2 = 0x13 on two flat-battery boots this week, charging at +1.4 A. So it stands at two phones with 0x93, both after flat boots, and flat boots on two phones where the bit was clear (one read, one judged from the +1.41 A it took). Thank you, and thanks to @azazelpy and @gitpash for the register reads.

Before merge:

  1. USB-C-PLAN K1b on my Pixel 7 Pro (derekross/omarchy-mobile#815).
  2. My Signed-off-by. In the same amend: "the one case seen" becomes two phones and "not after every flat boot", and the trailer becomes Assisted-by: LLM, the form our tree's coding-assistants.rst gives.

Still to write down in USB-C-PLAN: with the bit clear, default_ilim_ua is where the charger starts, not a ceiling, so the reported input limit reads low; and we don't know what sets the bit, so a clear at probe may not be the whole fix.

@Somnius

Somnius commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

@derekross one data point from the 8 Pro side. On my husky 0xc2 read 0x13 (NO_AUTOIBUS clear) every time I looked: the stage-0 register log on 2026-11-01 (every sample c2=0x13) and the dead-man tool's saved registers before the 500 mA run the same day (0xc2 0x13). Those were normal boots with charge left in the battery, not a boot from flat, so they don't tell us what the bootloader does after an empty battery. I've never seen 0x93 on mine.

Husky takes the same start_default() path when default_ilim_ua is set, so I can boot a kernel with this commit on my unit and check that the found:/probed: lines come out without (NO_AUTOIBUS set) and that 0xc2 still reads 0x13 afterwards, under the usual dead-man and without raising the float. That's only a boot check, it won't reproduce the flat-battery case. Tell me if you want it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants