Repository navigation
Conversation
|
Thank you, Lef. This is a remarkable day's work, and the notes are some of the most honest I've had: every claim tagged, the reviews of your own tool listed with what they found, and the one-change-per-boot exceptions admitted instead of hidden. Reading the pack ID from the EEPROM, finding that the fallback model overstated the charge by ten points, and correcting it the same day is exactly the kind of result I hoped this work would produce. What I checked: the five overlays compile with A few things before it lands:
Smaller things, not blocking:
Thanks again. With items 1 to 4 in, I'm glad to merge this right after #250. |
…ator Three overlays for the MAX77759 steps of the battery plan, none default, listed through DTB_OVERLAYS like the other devices': - battery-clk-test: CMU_PERIC1 and its sysreg, USI11 and the bus still off (step M2b); - battery-i2c-test: also USI11 and hsi2c_11, the bus of the gauge, PMIC, charger registers and Type-C controller (M3). They need kernel derekross#163; - gauge-model: Google's ModelGauge m5 model for the pack, as maxim,fg-model and maxim,fg-params on the fuel gauge (M4c). Without a model the gauge stays in its power-on state (Status 0x0002, Config 0x2354) and reports a battery temperature stuck at exactly 22.0 C: the same gauge on a Pixel 7 does the same without its model and reads 33.1 C with it (kernel derekross#171). With default-a1-0k (what Google's driver falls back to for an unknown pack) loaded through this overlay the driver logs "battery model loaded (DesignCap 0x994, TaskPeriod 0x2d00)", the power-on bit clears, and the temperature reads 34.4 C and moves. The pack (ATL, COS or LSN) is not known yet, so the percentage may be a few points off; the charge voltage comes from the device tree, not the model. tools/gen-gauge-overlay.py writes the overlay from Google's stock husky node, so no number is typed by hand: each stock u32 table cell becomes two u16 words, the stock parameter bytes become big-endian u16 words in the order of struct max77759_fg_params. The shipped gauge-model.dtso is its output for default-a1-0k. tests/device-overlays compiles all three with dtc -@ (48 overlays ok). Booted on a Pixel 8 Pro (7.3.0-rc6, slot B): all three, in order. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…r runs Ported from tools/usbc-deadman for the Pixel 8 Pro. A step runs detached on the phone and undoes itself unless the desktop gets back in over a new SSH login and confirms, a guard watches the battery, and if even the undo fails the SoC watchdog resets the phone, which boots with the charger driver blocked. Steps: noop, wd-drill (stops feeding the watchdog on purpose) and b3-charger (modprobe max77759_charger with default_ilim_ua, temp_guard and the gauge as guard_psy). Preflight refuses unless the gadget is configured, the MFD is loaded, the charger and Type-C drivers are not, the charger is blocked in modprobe.d (blacklist or install), the battery is 30 to 80 %, at most 4.15 V, 10 to 40 C and not exactly 22.0 C (a stuck gauge), the input limit is at most 900 mA, and no b3-charger ran this boot (the MFD register cache goes stale after any i2cset). The guard checks every 2 s: more than 4.30 V or under 3.0 V, above 45 C or under 5 C, more than 1.7 A either way, three bad reads. The undo unloads the module, restores registers 0xbb, 0xbd and 0xc2, sets the mode to OFF and then 0x4, and reads it back; it leaves charging off. After the soak nothing guards the charger: undo by hand, and reboot before another run. Went through two review rounds before the first run (not by a maintainer) and a third on the final plan. The first real runs found two more bugs, both fixed here: the blocklist's "install ... /bin/false" line made the tool's own modprobe run /bin/false (it uses modprobe --ignore-install now), and a probe failure could leave charging on with no driver (it now requires the max77759-charger power supply to exist after the load). Run on a Pixel 8 Pro: noop, noop without confirming (the phone undid it by itself), wd-drill (the phone reset and came back with the charger unloaded), then b3-charger at 500 mA, at 900 mA and with a wall charger, 10 minute soaks. Nothing tripped; the numbers are in the notes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The runbook and the results of the battery work on a Pixel 8 Pro, step by step (M1 to M5): the bus, the gauge, the MFD, the gauge model, the dead-man tool, three charger runs (500 mA and 900 mA on a desktop USB port, and a wall charger), the USB replug problem, the slot B retry problem and what the devinfo bytes show about it. Each claim says whether it was verified or not. The open questions are listed in order: the pack ID, a device-tree model, the charge limits, whether a reset restores the charger registers, the Type-C step, and the boot-success marker. Also move the husky Battery and Charging rows in device/husky/ROADMAP.md and the matrix in docs/DEVICES.md from "no" to "testing", with what that means: the gauge and temperature work with the model overlay, and the charger driver only ran in guarded runs and charges slowly on plain 5 V. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…y run, stock charging decoded Three additions to the notes, each from work done after the first version. The gauge interrupt: on a Pixel 8 Pro the stock max17042_battery module raises 400 to 470 interrupts per 1 % step of the battery level (466 and 402 measured, from /proc/interrupts every 30 s under a CPU load), the burst kernel derekross#170 describes. With derekross#170's patch the next two steps each add 1 interrupt. Only the module was rebuilt (release name pinned) and swapped on the running phone; the model stayed loaded. The boot-success marker: cheetah's omamobile-bootctl dump, run read-only on the three backups of husky's devinfo partition, prints version 3.15 "verified layout" and the same slot bytes as the hand decode. Stock's charging, decoded from the stock device tree and Google's GPL sources: the temperature bands and voltage tiers with the current limits as mA and C-rate, that all the bands are software (no JEITA registers in the charger chip, the fast-charge timer disabled), what the PCA9468 does and what is lost without it, how the input limit is voted, and a proposal for a first safe step beyond 4.2 V and 1.485 A, for review. The tables were recomputed independently and match; nothing is implemented. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ck ID results The battery pack's ID is byte 0x17 of its EEPROM (an at24c08 at 0x50 on hsi2c_9, USI9), and on a Pixel 8 Pro it reads 1: an ATL pack. Google's driver matches that byte against the gauge models (0 default-a1-0k, 1 atl-a1-1k, 2 cos-a1-2k, 3 lsn-a1-3k, 170 Google's dummy), so the model this directory has used so far, the fallback default-a1-0k, was the wrong one: with the right model loaded the reported level fell from 70 % to 60 % at the same voltage (3.95 V), and charge_full_design is the 5,022,000 uAh the gauge showed before it fell back to its power-on state (the ATL model's DesignCap 0x09cf, times 2 mAh). Add gauge-model-atl.dtso, and regenerate gauge-model.dtso from the same source: the husky MP overlay (ov8), where the ATL node has DesignCap 0x09cf and model version 5; the Pixel 8's overlay (ov16) has other ATL, COS and LSN nodes (a smaller pack), so the notes and the generator now say which file to use. The generator's header no longer assumes the fallback model. Add pack-eeprom-test.dtso, which switches USI9 and hsi2c_9 on (needs the kernel change that adds them). BATTERY-NOTES.md gets the new section 5.6: how the ID was read (only byte 0x17 was ever read; the rest of that EEPROM holds the pack's part number and history), why the model has to be reset to be replaced (the driver loads it only while Status bit 1 is set; writing that bit does not stick), the hardware reset that worked (driver unloaded, 0x000F to register 0x60, read back at every step: power-on defaults, then the ATL load), and what is not verified. It also corrects the DesignCap figures of the first version, which came from the Pixel 8 overlay. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A fourth charger run, after the gauge model was corrected to ATL, with a 30-minute guard on the phone and the cable moved from the desktop's USB port to a wall charger: the net battery current averaged -55 mA on the port and +38 mA on the charger (positive in 146 of 156 samples, at most +95 mA), the voltage rose by 9 mV, the battery stayed at 33.5 to 34.6 C, and the level went from 59 to 60 % in about 55 minutes. The charger's registers were the same on both sources. The notes say so, and that why is not verified: probably that neither source is allowed more than the default current without a Type-C driver. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The tool's recovery text had the Pixel 7 Pro's buttons: on the 8 Pro the forced restart is Power + Volume Up for 15 to 30 s, then Power + Volume Down for fastboot, and the known-good set is "your known-good image set". Both the recovery text and wd-drill's start message now warn that every reset spends one of slot B's three boot tries. The phone half refuses a board that is not google,zuma-husky. The notes get a boot-count rule in the safety section, a clause on which kernel was booted against derekross#163 and derekross#175 as they stand, the hand writes marked as research, the stock tables' source, the 2 mAh per unit fix, the overlay list, and the matrix cells qualified as a test kernel. gen-gauge- overlay.py gets its SPDX header. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Lef <me@lefteros.com>
b892e24 to
d540bc6
Compare
|
Thanks @derekross. Rebased onto main (the DEVICES.md conflict with @greenbrettmichael's rows is resolved, I kept his Wi-Fi/touch cells and only changed Battery and Charging) and pushed a commit with your items:
Also in: the hand writes are marked as one-off research (and the ROADMAP line reworded the way you suggested), the stock tables point at the factory image's dtbo and Google's GPL source, the 2 mAh per unit fix, SPDX on the generator, a google,zuma-husky check in husky-deadman-phone, the overlay list in section 12, and the local log path is gone. |
|
Thank you, Lef. I've gone through the new commit point by point, and every item is in:
The smaller ones are in too: the hand writes marked as one-off research, the ROADMAP line reworded, the 2 mAh per unit fix, the SPDX header, and the Since you've allowed edits, I'll make a few last touches myself when I merge, after #250:
Two notes for later, not for this PR:
Thanks again for turning the review around so carefully. |
|
Landed on main as 196c7cf (squashed, authored by you), with the four small edits I listed. Thanks, Lef. |
|
@derekross thanks, the four edits are fine by me. On the stock tables: I only have the GrapheneOS copy of the husky images here (that's where |
|
@derekross an update on the stock tables, and I'm dropping what I said about downloading the factory image: Google's download page says the factory images "may not be disassembled, decompiled, reverse engineered", so I won't decompile one. Google's own published source has the tables, under GPL-2.0-only:
|
|
@Somnius thank you, that's a better source than the one I suggested. I fetched |
…sults (derekross#249) The 8 Pro's battery bring-up: the overlays that enable the gauge's bus, the gauge model and the pack EEPROM, the husky-deadman tool for charger steps, and BATTERY-NOTES with the results and the recovery steps. The battery and charging cells in DEVICES say "on a test kernel". Maintainer edits at merge: the notes' file list names the overlays in this change, the USB rescue's version is 0.1.4 (derekross#250), the summary table points at the slot B marking hold (derekross#252), and the dead-man's recovery text no longer assumes the block is in /etc/modprobe.d. Closes derekross#249 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What and why
The battery bring-up of the 8 Pro as the runbook @derekross asked for on kernel #163 ("the overlay and your results belong in device/husky/ with a runbook"): the three bring-up overlays, the dead-man tool I used for the first charger runs, a script that writes the gauge-model overlay from Google's stock tree, and device/husky/BATTERY-NOTES.md with every step and result, three charger runs, the USB replug problem, the slot B retry problem and the open questions, each claim marked verified or not. It also moves the husky Battery and Charging rows of device/husky/ROADMAP.md and docs/DEVICES.md from "no" to "testing" and says what that means (the gauge and its temperature work with the model overlay; the charger driver only ran in guarded runs and charges slowly on a plain charger).
The short version of what the notes say: with Google's battery model loaded through gauge-model.dtso the gauge's temperature goes from stuck at 22.0 C to 34.4 C and moving (@nesmeck's kernel #171 sees the same on the Pixel 7); max77759_charger ran three times under the dead-man tool (500 mA and 900 mA on a desktop port, and a wall charger), nothing tripped, and on the wall charger the net current turned positive; I don't know which pack the phone has, so the model is Google's fallback for an unknown pack and the percentage may be a few points off.
Needs: kernel #163 (the bus nodes the overlays switch on) and, for the blocklist and the replug rescue the notes talk about, the device package PR (#250). No package changes here, only device/husky, tools and docs, so no version bumps.
Device and build
uname -r): 7.3.0-rc6-omamobile-push1-gc7a0b2ef2f66-dirty (@greenbrettmichael's c6 plus the commits of kernel omamobile-modem 0.1.10: the modem profile starts once per boot #163), booted with these overlaysChecks (no phone needed)
tools/pr-check origin/mainpassestests/allpassestests/packages: no package changed; the run over every package fails in three suites on my desktop only because pythondbusandgiare not installed hereversionbumped: n/a, no package changedCo-Authored-By:orAssisted-by:trailer, never aSigned-off-by:On the phone
userdata, weakens the storage guard, or reads registers from userspace (AGENTS.md §1): the first two hold. The tools do read and write registers of the external MAX77759 chips (gauge, charger, Type-C) over I2C with i2cget and i2cset, as cheetah's usbc-deadman does; no devmem, nothing on the SoC's PMU. BATTERY-NOTES.md section 3 lists it.tools/phone-smokereportphone-smoke: husky
Kernel
7.3.0-rc6-omamobile-push1-gc7a0b2ef2f66-dirty, tools atbb11919, 2026-11-01T11:15Z.Packages: hyprland 0.56.2-5.1, libcamera 0.7.2-4.22, mesa 1:26.2.4-1.4, omacam 0.3.3-1, omamobile-apps 0.2.0-1, omamobile-device-husky 0.1.1-1, omamobile-firstboot 0.1.2-1, omamobile-keyring 20261026-1, omamobile-mirror 0.1.1-1, omamobile-omarchy 0.1.20-1, omamobile-owl-widgets 0.1.1-1, omamobile-shell 0.2.45-1, omarchy 4.0.6-1, quickshell 0.3.2.r7.g2b4501a-1