Skip to content

arm64: dts: exynos: google: gs201-panther: the fuel gauge and its battery model - #171

Merged
derekross merged 2 commits into
derekross:omamobilefrom
nesmeck:omamobile-gs201-panther-battery
Nov 1, 2026
Merged

derekross merged 2 commits into
derekross:omamobilefrom
nesmeck:omamobile-gs201-panther-battery

Conversation

@nesmeck

@nesmeck nesmeck commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

The Pixel 7's battery through the MAX77759's fuel gauge, as on the Pixel 7 Pro, on the I2C bus that #167 enabled. Two commits, one per test boot:

  1. The fuel gauge and the battery. fuel-gauge@36 on hsi2c_13, maxim,max77759-fg, with:

    • its interrupt on gpa9-3, level low, and a new if_pmic_fg_int pin group (EINT, pull-up, 2.5 mA);
    • the 5 mOhm sense resistor (shunt-resistor-micro-ohms, which also keeps the driver out of its voltage-only mode);
    • a simple-battery: 4277 mAh, 4.45 V maximum, 3.3 V empty.

    Every value is from the Pixel 7's live device tree (max77759fg@36, if-pmic-fg-irq, google,chg-battery-capacity, google,fv-max-uv, and VEmpty of its gauge models). The PMIC at 0x66 stays undescribed, so the charger, GPIO and NVMEM cells don't bind and charging stays as ABL leaves it.

  2. The battery model. Stock's ModelGauge m5 model for the pack with a 1 kOhm ID resistor (Coslight, cos-a1-1k), from Google's GPL gs201-panther-battery-data.dtsi. All three of Google's models (0, 1 and 3 kOhm) match the live tree's word for word.

    • Why this pack: the gauge's TempCo read 0x1a02 under stock's driver on this phone. That is cos-a1-1k's value; the 0 and 3 kOhm models have 0x223e and 0x1802.
    • One value changed: RelaxCfg is 0x143b, which stock writes over the model at boot (maxim,r_regval_1720x = <0x2a143b>), as the Pixel 7 Pro's node does too.

Tested on a Pixel 7 (slot B, 7.3.0-rc6), with the touchscreen, GPU and haptics:

Without the model (…-g549fddfe41cc) With it (…-ge654d41e556f)
dmesg binds to 1-0036, no errors battery model loaded (DesignCap 0x873, TaskPeriod 0x2d00)
capacity 99 % 92 %
temp 22.0 °C (stuck) 33.1 °C
charge_full / design 2912 / 3000 mAh 4324 / 4326 mAh
upower and the shell's bar battery, 99 % battery, 92 %

The report's battery line reads Discharging on the cable: ABL's input current limit is below what the phone drew with the screen on. That belongs to the charger, a later step.

phone-smoke (`…-g51074200c999`: this PR, #167, #133, #166 and the driver fix)

phone-smoke: panther

Kernel 7.3.0-rc6-omamobile-push1-g51074200c999, tools at 84d3edf, 2026-11-01T03:29Z.

Check Result Detail
boot (required) ok kernel 7.3.0-rc6-omamobile-push1-g51074200c999, slot b, up 1847s
storage guard (required) ok 55 partitions; only userdata and slot B's boot images writable
root (required) ok ext4 on userdata, 98G free
kernel health (required) ok no oops or BUG; 0 WARN, 6 error lines in dmesg
systemd units ok none failed
USB gadget (required) ok bound to 11210000.usb
display ok card0-Unknown-1 connected, 1080x2400
GPU ok render node on panthor
session (required) ok Hyprland and the Omarchy shell running
lock ok PAM file present, the shell can lock (passwordPam true, locked false)
touch ok FocalTech FT3658
buttons ok gpio-keys
Wi-Fi skip no wireless interface
Bluetooth skip no controller
battery ok 86% Discharging, 34 °C
sound cards skip none
sensors skip no sensor proxy
cameras skip no libcamera tools
thermal ok hottest zone 34 °C

Packages: hyprland 0.56.2-5.1, libcamera 0.7.2-4.21, mesa 1:26.2.4-1.4, omacam 0.3.3-1, omamobile-apps 0.2.0-1, omamobile-device-panther 0.1.3-1, omamobile-firstboot 0.1.2-1, omamobile-keyring 20261026-1, omamobile-mirror 0.1.1-1, omamobile-omarchy 0.1.12-1, omamobile-owl-widgets 0.1.1-1, omamobile-shell 0.2.28-1, omarchy 4.0.6-1, quickshell 0.3.2.r7.g2b4501a-1

Checks: tools/kernel-pr-check --build OUT --merge origin/omamobile passes everything:

  • a clean merge onto caf5f8a;
  • the sign-offs;
  • checkpatch --strict with no warnings;
  • the 8 device trees with W=1 and dtbs_check, with no new warnings.

🤖 Generated with Claude Code

… battery

Describe the MAX77759's fuel gauge at 0x36 on USI13, as on the Pixel 7
Pro: interrupt on gpa9-3, low, with a pull-up, and the 5 mOhm sense
resistor, all as in the Pixel 7's live device tree. The battery takes
the live tree's values: 4277 mAh (google,chg-battery-capacity), 4.45 V
maximum (google,fv-max-uv) and 3.3 V empty (VEmpty of its gauge
models).

There is no battery model yet, so the gauge reports from its default
one: voltage and current are measured, while the capacity, the
percentage and the temperature are approximate. Without a model the
driver writes only the gauge's alert settings.

Tested on a Pixel 7 from slot B (7.3.0-rc6), with the touchscreen, GPU,
haptics and USB rescue: max17042_battery binds to 1-0036 and registers
max170xx_battery, reading 4.33 V, 99 % and Charging on the cable, with
no I2C errors and no interrupts on gpa9-3. upower and the shell show the
battery. With the cable out for a minute, btop showed a discharge of
about 1.3 W from it; after the replug it read Charging again. As
expected with no model, the temperature stays at 22.0 C and charge_full
is the default model's.

Assisted-by: Claude Opus 5.5
Signed-off-by: Alejandro Garcia <skipper.pelygro@gmail.com>
…ttery model

Give the gauge the ModelGauge m5 model that the stock kernel loads for
the pack with a 1 kOhm ID resistor (Coslight, cos-a1-1k in Google's
gs201-panther-battery-data.dtsi), as the Pixel 7 Pro does with its own.
The phone's pack is that one: under stock's driver the gauge's TempCo
read 0x1a02, this model's, where the 0 and 3 kOhm models have 0x223e and
0x1802. RelaxCfg takes the value stock writes over the model at boot
(r_regval_1720x in the live device tree); the rest, FilterCfg included,
is Google's, and the same as the live tree's.

On a POR, the driver writes the model into the gauge's RAM and clears
POR. With it, the gauge measures the battery thermistor, and one
capacity LSB becomes 2 mAh (TaskPeriod 0x2d00).

Tested on a Pixel 7 from slot B (7.3.0-rc6), on top of the previous
patch, with the gauge in POR: the driver logs "battery model loaded
(DesignCap 0x873, TaskPeriod 0x2d00)". On the cable it then read 92 %
(99 % with the default model), 4.33 V, 33.1 C (22.0 C before),
charge_full 4324 mAh of 4326 mAh design, and Charging. upower and the
shell show 92 %. With the cable out for a minute, btop showed a
discharge of 1.38-1.67 W from it. No I2C errors. The gauge's interrupt
fired in bursts, about 1300 times while the model loaded and about 400
during the unplug, and was quiet otherwise.

Assisted-by: Claude Opus 5.5
Signed-off-by: Alejandro Garcia <skipper.pelygro@gmail.com>
@derekross

Copy link
Copy Markdown
Owner

Thank you, @nesmeck. Two commits, one per test boot, with the table for each and the smoke report: that's exactly how I like a board change to arrive, and the TempCo read to tell the three packs apart is a neat trick.

What I checked:

  • The model. I compared maxim,fg-model and maxim,fg-params with maxim,cos-a1-1k in Google's gs201-panther-battery-data.dtsi (kernel/devices/google/pantah, branch android-gs-pantah-6.1-android16). All 48 model words and 26 of the 27 parameters match; the one difference is RelaxCfg (0x0839 in Google's table, 0x143b here), which you explain as the value stock writes over the model at boot, the same choice the Pixel 7 Pro's node makes. The parameter order is the same as cheetah's, which the driver relies on. TempCo 0x1a02 is indeed this pack's (0x223e and 0x1802 for the other two).
  • The battery. 4277 mAh matches google,chg-battery-capacity in Google's gs201-panther-battery.dtsi, and DesignCap 0x873 at 2 mAh per LSB gives the 4326 mAh you saw.
  • The pins. if_pmic_fg_int is the same as the Pixel 7 Pro's (gpa9-3, EINT, pull-up, 2.5 mA), defined in panther's own file, and an alive bank with no power-down properties, as it should be.
  • Scope. Only gs201-panther.dts changes, so the other gs201 boards' DTBs are untouched, and leaving the PMIC at 0x66 undescribed keeps the charger and the Type-C side as ABL leaves them, which is the right call while USB is your only link.

Our gate on today's omamobile matches what you reported: a clean merge, the sign-offs and prefixes pass, checkpatch has nothing to say, and the 8 device trees build with W=1 and no new warnings. CI's run on this head also passed dtbs_check.

This doesn't depend on #170: without it the gauge's interrupt still bursts at each 1 % step, as it does on the Pixel 7 Pro today, but nothing breaks. I'll merge this one as it is. Thanks!

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