Repository navigation
Conversation
The MAX77759 fuel gauge has the same Config2.dSOCen / Status.dSOCi 1 % change alert as the MAX17055, and the battery model loaded on POR enables it (Config2 0x0090 on the Pixel 7 Pro). The driver still treated the MAX77759 like the older gauges and also armed a SALRT window of +/-1 % around the current SOC, re-armed from the integer part of RepSOC on every alert. Both alerts then watch the same whole-percent boundary. On a Pixel 7 Pro (gs201) the gauge interrupt fires in bursts of 300 to 460 interrupts within about a second, each time RepSOC crosses a whole percent, while charging and while discharging; one boot counted 43960 gauge interrupts before the battery ran flat. SALRT read the window around the new percent (0x1412 at 19.00 %) at every burst. Use the MAX17055 scheme on the MAX77759: dSOCi for the 1 % steps and SALRT only for the critical SOC threshold. Google's driver for this gauge does the same; it enables dSOCen through the model's Config2 and never programs SALRT. It also drops the 1 % window during suspend, so a suspended phone is no longer woken on every percent, which is what the MAX17055 path already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Derek Ross <derekross@gmail.com>
The MAX77759 fuel gauge doesn't release its ALRT output when the host
clears Status; it does so at a later fuel-gauge update, up to one task
period afterwards. Google's driver for this gauge says so ("gauge will
take up to 351 ms to clear ALRM1") and sleeps 500 ms at the end of its
threaded handler for that reason.
This driver requests the interrupt oneshot and the line is level-low,
so the interrupt is unmasked as soon as the handler returns and taken
again while ALRT is still asserted. On a Pixel 7 Pro (gs201, TaskPeriod
0x2d00, 351.6 ms) every whole-percent change produced a burst of 300 to
460 interrupts within about a second, and Status read 0x0000 around the
bursts. Each pass reads Status over I2C and sends a power_supply
uevent, which also wakes userspace hundreds of times per percent.
Keep the interrupt masked for one and a half task periods after a pass
on the MAX77759. The period is read from the gauge, so a battery model
that changes TaskPeriod changes the wait too. An alert that is still
pending afterwards keeps the line low and is taken on the next pass, so
none is lost. Other gauges are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Derek Ross <derekross@gmail.com>
… set The threaded handler reports a power supply change on every interrupt, even when Status has no bit set. The interrupt is requested shared, so such an interrupt may belong to another device; on a gauge that is slow to release ALRT it is the same alert taken again. On a Pixel 7 Pro (MAX77759) the second case sent hundreds of power_supply uevents per whole-percent change, each read again by userspace. Return IRQ_NONE without a uevent when Status reads zero, so a shared line is reported correctly and a line that stays asserted with nothing latched is caught by the spurious interrupt detector instead of turning into a stream of uevents. On the MAX77759 the alert hold-off applies on this path too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Derek Ross <derekross@gmail.com>
The driver leaves CHG_CNFG_01's FCHGTIME at the value it finds, so the
charger's fast-charge safety timer stays armed. With the input limited
to 500 mA a charge from empty takes longer than that timer: on a Pixel 7
Pro charging from 0 % on a laptop port, the charger stopped after about
12 hours at 92 %, reading offline and "Not charging" with the cable in
and USB still working, until a reboot started it again.
Google's max77759_charger.c clears FCHGTIME at probe ("disable fast
charge safety timer"), leaving charge termination to the charger's own
done detection and the battery's temperature limits. Do the same in
init, inside the window where the protected registers are unlocked.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Derek Ross <derekross@gmail.com>
…harger charger_input_valid() required both CHGIN_OK and CHG_OK in CHG_INT_OK. CHG_OK clears when the charge is done: on a Pixel 7 Pro on a laptop port, CHG_INT_OK went from 0xdd to 0xcd as CHG_DETAILS_01 reached DONE (0x4), and online and present dropped to 0 with the cable in and the mode still CHG_BUCK_ON. Userspace then counts a full phone on the charger as running on battery (upower applies its battery policy). Report the input from CHGIN_OK alone; the status property already says Full, and charger faults through status and health. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Derek Ross <derekross@gmail.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.
Five commits:
Evidence:
device/cheetah/NOTES.md2026-10-30. Overnight on 00568 the charge went CC, CV, top-off, then DONE, with CNFG_01 at 0x98. On 00571 the charger reads online at Full.These drivers are shared with the Pixel 6 Pro, so raven needs a charge test before merge.
Part of the curated Pixel 7 Pro publish (8 stacked PRs, merged in order, commit by commit). This branch is based on the previous series' branch; after each merge the next PR is retargeted to
omamobile. The whole stack equals the integration kernel the reference phone runs, merged withomamobile:7.3.0-rc6-omamobile-push1-gaae3b058ef98booted on the Pixel 7 Pro on 2026-10-30 withtools/phone-smokeall ok (display, GPU, touch, Wi-Fi, Bluetooth, sound, sensors, four cameras, charging). Every series end builds with no new warnings. Fixups and reverts are folded, and pure debugging code was dropped. Every commit carries the author's Signed-off-by.Draft until the Pixel 6 Pro (raven) check of the shared drivers is done.
🤖 Generated with Claude Code