Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions device/husky/BATTERY-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- SPDX-License-Identifier: MIT -->
# Pixel 8 Pro (husky) battery, charging and USB-C: bring-up notes and results

Last updated: 2026-11-01. One phone, one person (Lef), one day of hands-on tests, written up in full so that others can check it and reuse it. Everything here is tagged:
Last updated: 2026-11-02. One phone, one person (Lef), one day of hands-on tests, written up in full so that others can check it and reuse it. Everything here is tagged:

- **Verified** means it was read from a file, a log or the phone and the source is named.
- **Not verified** means it is an inference, or comes from memory of a datasheet, and says what would settle it.
Expand All @@ -17,7 +17,7 @@ Nothing in this document contains a serial number, IMEI, MAC address, IP address
| Gauge battery model | Google's ATL model (the pack's real ID, read from its EEPROM), loaded through an overlay. The temperature reads about 35 C and moves; replacing the fallback model with the right one dropped the reported level by 10 points (section 5.6). |
| MFD core (PMIC at 0x66, `max77759`) | Binds, no interrupt storm, loads at boot. |
| Charger (0x69, `max77759_charger`) | Loaded by hand under a dead-man tool, three runs: 500 mA and 900 mA on a desktop USB port, and a wall charger. The driver charges the battery, slowly (see section 7). |
| Type-C controller (0x25, `tcpci_maxim`) | No driver loaded: it stays disabled and blocked. The only access to the chip is its USB data switch register (0x25:0x93), read and written by the rescue service (section 8). |
| Type-C controller (0x25, `tcpci_maxim`) | Blocked at boot; loaded by hand under the dead-man tool (`b4-tcpm`, section 7.2): the port registers as a sink, 3.0 A from the desktop port, the driver closes the data switch on a replug itself, and with the charger loaded the charger follows TCPM's current limit. Three boots on 2026-11-01. Without the driver the only access to the chip is its USB data switch register (0x25:0x93), read and written by the rescue service (section 8). Sourcing VBUS (host mode) is not done: [HOST-MODE-RUNBOOK.md](HOST-MODE-RUNBOOK.md). |
| USB link across an unplug | Lost until a reboot, because the Type-C chip opens the USB data switch. Fixed with `omamobile-usb-rescue`. |
| Slot B boot retries | A hazard: each boot of slot B uses one retry (3 after a flash or `set_active`), and when they run out the bootloader falls back to GrapheneOS, whose first boot wiped `userdata`. How slot B gets marked successful is on hold until the maintainer decides (#252); until then, flash a known-good image set before the last try (sections 3 and 9). |
| PCA9468 direct charger (0x57) | No mainline driver. Not touched. |
Expand Down Expand Up @@ -177,6 +177,18 @@ Not verified, and not claimed: how much current the charger actually draws from

A note for UI authors: the charger power supply says `Charging` (fast charge) while the gauge's own power supply says `Discharging` whenever the net current is negative, so the status-bar icon (charger) and the fetch widget (gauge) can disagree. Both are telling the truth.

### 7.2 The Type-C driver (`b4-tcpm`) and the USB role switch: three boots on 2026-11-01

Kernel `7.3.0-rc6-omamobile-push1-g5899fec2bd28` (the e1 kernel: the shared base plus our eight battery and EEPROM commits) for all three. Plan: [TYPEC-FAST-CHARGE-PLAN.md](TYPEC-FAST-CHARGE-PLAN.md) stages 3 and 4, [HOST-MODE-PLAN.md](HOST-MODE-PLAN.md) stage 1. The dead-man step `b4-tcpm` stops `omamobile-usb-rescue`, loads `tcpci_maxim` (which pulls `tcpci` and `tcpm`; the device tree keeps `pd-disable`, so Rp sensing only, no PD), soaks under its guard (the battery limits of section 6, hard-reset or contaminant states in the tcpm log, `USBSW_CTRL` 0x93 not 0x09 with VBUS valid, both links dead) and undoes itself unless confirmed over a new SSH login. Control over Wi-Fi in every case. Each flash refilled slot B's tries to three and each boot used one. Logs kept locally.

**Boot 1, 20:06-20:13: the node enabled, the driver loaded charger-less.** Overlay `overlays/typec-test.dtso` sets `usb-typec@25` to `okay`. After boot: the I2C client `1-0025` present and unbound, only the MFD core loaded, Wi-Fi up, the rescue active, `tcpci_maxim` blocked, `USBSW_CTRL` 0x09. `b4-tcpm` at 20:09:06-20:11:20 with the USB cable on the desktop's front USB-C port: the driver bound (`maxtcpc 1-0025`), `tcpm` registered `typec/port0` with `power_role [sink]`, `data_role host [device]`, `port_type [sink]`, `power_operation_mode 3.0A`; partner `type not_dfp`, no PD (a USB source advertising 3.0 A on CC); power supply `tcpm-source-psy-1-0025` `online 1`, `current_max 3,000,000 uA`, `voltage_now 5,000,000 uV`. TCPC after the load: `CC_STATUS` 0x1c, `POWER_STATUS` 0x0d, `USBSW_CTRL` 0x09 (left closed by the driver), `FAULT_STATUS` 0x00 (0x80, "all registers reset", before the load). USB gadget `configured` and `usb0` up throughout, Wi-Fi up, **0 hard resets**, confirmed and soaked 120 s clean, no trip, no reset. The battery charged at +0.4..+0.5 A with the charger driver not loaded (input limit 0xc2 unchanged at 0x13). Kernel messages `maxtcpc 1-0025: dummy supplies not allowed for exclusive requests (id=vbus)` and `Failed to get vbus regulator handle`: the connector has no VBUS source in the device tree, so the port is a sink only (HOST-MODE-PLAN section 0). The tcpm debugfs log printed nothing in the dump: unknown why; to check before any PD stage, since the hard-reset stop reads that log. Replug at 20:12-20:13 with the rescue stopped: unplug gave `USBSW_CTRL` 0x00 (data switch open), CHGIN 0x00; replug 12 s later gave `USBSW_CTRL` 0x09 **written by the driver, not the rescue**, the phone back on the USB address in seconds, `typec/port0` and the partner back, the tcpm supply online at 3 A. With the driver loaded the rescue is redundant; without it, still required.

**Boot 2, 20:19-20:26: charger and Type-C together.** Flash, `b3-charger --ilim 500000 --soak 120`, then `b4-tcpm --soak 300` in the same boot. `b3-charger` soaked clean (the driver probed `mode 0x5, float 4200 mV, fast charge 1533400 uA`, capped 1485000 in the 20-42 C band, input limit 500000 uA; the bootloader had left float 4350 mV and fast charge 1933420 uA). `b4-tcpm` with the charger loaded: soak clean, **0 hard resets**, `USBSW_CTRL` 0x09 throughout, USB and Wi-Fi up. **The charger followed TCPM:** `current_max 3,000,000 uA` and the input-limit register 0xc2 went 0x13 (500 mA) to **0x77 (3 A)** and stayed there (the log line every 10 s read `0xc2 0x77 0xb9 0x05`): the TCPM-to-charger path of `max77759_charger.c` on hardware. Battery current in the soak +0.33..+0.52 A, 4.148 to 4.164 V, 35.6-35.8 C, 78 %; not 1.5 A because the pack was near the 4.2 V float where the current tapers (an earlier +1.49 A reading was at 4.0 V and 52-55 %) [I: a repeat at about 65 % settles it]. No trips, no resets. The `b4-tcpm` undo also undoes `b3-charger` in this case (charging ends off).

**Boot 3, 20:56-21:03: the USB role switch, no VBUS (HOST-MODE-PLAN stage 1).** Overlays `typec-test` and `usb-role-test` (dwc3 `dr_mode = "otg"`, `usb-role-switch`, default peripheral, a graph to the connector). After boot: `dr_mode otg` in the live DT, `/sys/class/usb_role/11210000.usb-role-switch/role` = `device`, UDC `configured`, USB SSH up on the first boot (dwc3 does not wait for the Type-C driver), `typec/port0` absent until the driver loads. `b4-tcpm` charger-less (soak 120 s) over Wi-Fi: clean, port0 sink, 3.0 A, **no hard resets**, `USBSW_CTRL` 0x09. Then, by hand over Wi-Fi with the desktop cable out and a restore-to-device trap: `echo host > .../role` (no VBUS, the connector still sink-only) took the gadget away and two xHCI root hubs appeared, `usb1` at 480 Mbit/s and `usb2` at 10000 Mbit/s; `typec/port0/data_role` still read `host [device]` (the userspace write bypasses TCPM). `echo device` 5 s later: UDC `configured`, `usb0` carrier 1, the USB address answered in 4 ms. No hang, no oops, no kernel message in host mode. Conclusion: zuma's dwc3 runs as a host with the in-tree `dwc3` and `xhci-plat`, no stock glue driver, and the PHY survives the switch with nothing attached. Not shown: enumeration of a real device (no VBUS, so nothing could attach), and TCPM setting the role itself on an attach.

Not recorded in these notes because the source files do not have them: the exact battery level and temperature at each boot's start beyond what is quoted, and the tcpm debugfs log's contents (empty in the dump).

### 7.1 What stock does, decoded, and a first safe step (a proposal, nothing implemented)

Read-only research on Google's stock husky device tree (the MP overlay, capacity 0x1356 = 4950 mAh) and Google's GPL charger sources (shusky `bms` repository). The decoded tables were recomputed independently and match.
Expand Down Expand Up @@ -229,7 +241,7 @@ So the layout is consistent with husky's [verified, read-only, on files]: the ma

- The bring-up used a modprobe block by hand and an overlay each time, not the package. Once the package ships `omamobile-max77759.conf`, delete the local `/etc/modprobe.d/omamobile-battery-test.conf`: a file in `/etc` of the same name would replace the package's and its later changes would not apply.
- `modprobe -r max77759_charger` was used four times (by the tool's undo). CONTRIBUTING warns about unloading bring-up modules; for this driver the unload worked every time, but note that the driver has no remove function and leaves charging on when unloaded, which is why the undo forces the mode to 0x4 explicitly.
- No Type-C work, no charger limits above the conservative ones, no JEITA, no PCA9468, no wireless, no OTG.
- No charger limits above the conservative ones, no JEITA, no PCA9468, no wireless, no PD. The Type-C driver ran under the dead-man tool (section 7.2). OTG (sourcing 5 V on the port from the external boost) has a draft runbook, [HOST-MODE-RUNBOOK.md](HOST-MODE-RUNBOOK.md), with the `b5-host` and `baseline` steps of the dead-man tool; nothing in it runs until the maintainer says go.

## 10a. Charger baseline, plugged and done (2026-11-06, kernel 7.3.0-rc6-omamobile-push1-g904a64931327)

Expand Down Expand Up @@ -261,7 +273,7 @@ When the charger driver binds with today's device tree it sets 4.20 V on purpose

## 12. Files

In this repository: `device/husky/overlays/battery-clk-test.dtso`, `battery-i2c-test.dtso`, `gauge-model.dtso`, `gauge-model-atl.dtso`, `pack-eeprom-test.dtso` (all under `device/husky/overlays/`), `tools/gen-gauge-overlay.py` (reads Google's public `zuma-husky-battery-data.dtsi`, section 5.7), `tools/husky-deadman`, `tools/husky-deadman-phone`, and the package changes (USB rescue, blocklist) in #250. Kernel side: kernel #163 (the bus) and #154 (panel size, which the on-screen keyboard needs).
In this repository: `device/husky/overlays/battery-clk-test.dtso`, `battery-i2c-test.dtso`, `gauge-model.dtso`, `gauge-model-atl.dtso`, `pack-eeprom-test.dtso`, `typec-test.dtso`, `usb-role-test.dtso` (all under `device/husky/overlays/`), `tools/gen-gauge-overlay.py` (reads Google's public `zuma-husky-battery-data.dtsi`, section 5.7), `tools/husky-deadman`, `tools/husky-deadman-phone` (with `tests/husky-deadman`), [HOST-MODE-RUNBOOK.md](HOST-MODE-RUNBOOK.md), and the package changes (USB rescue, blocklist) in #250. Kernel side: kernel #163 (the bus) and #154 (panel size, which the on-screen keyboard needs).

Kept locally, available on request, no serials: the dead-man tool's per-run kernel logs, the gauge test logs (including the interrupt log for #170), the charge-watch logs, and the `tools/phone-smoke` report from this kernel.

Expand Down
Loading