Repository navigation
Pixel 8 Pro: USI9 / hsi2c_9 and the battery pack's EEPROM (stacked on #163) - #175
Conversation
07dc83c to
5838d76
Compare
|
Thanks Lef, this is a tidy follow-on, and reading the pack ID one byte at a time, with the EEPROM read-only, is exactly the right amount of caution. I checked it against Google's sources:
The four commits match A few things before it merges:
On reading the ID at runtime versus describing the model in the board file: let's settle that in the gauge-model work. A model fixed in the board file would be wrong on a phone with a COS pack, so I lean towards something that uses the ID, but I'd like to see what mainline's gauge driver can take first. The note about the I2C adapter numbers moving is useful, thanks; nothing in our tree hard-codes them. I've approved the CI run. Once #163 is merged, please rebase onto |
5838d76 to
524112e
Compare
|
Thanks @derekross, all three are in (force-pushed, the tree is identical, only commit messages and the one comment line changed). The last commit now records the test: the tree and bus overlay, the at24 line, and the one-byte read of 0x17 (1, ATL). The earlier ones say they were tested with the board commit on top. The comment says MAX77759 now, and the header commit uses the google,zuma-clock prefix like #163. For the rebase: I'll rebase onto omamobile once #163 is in, or merge it alone if that's easier for you, either is fine by me. Agreed on the model question, I'll hold off until you've seen what mainline's gauge driver can take. |
USI9 is the I2C bus (hsi2c_9) of the Pixel 8 Pro's battery pack EEPROM, which holds the battery ID that picks the fuel gauge model. It sits on CMU_PERIC1 like USI11: a user mux, a divider and the IPCLK, PCLK and RSTNSYNC gates. Add the five ids after USI11's. Signed-off-by: Lef <me@lefteros.com> Assisted-by: LLM
USI9 is the I2C bus (hsi2c_9) of the Pixel 8 Pro's battery pack EEPROM, which holds the battery ID that picks the fuel gauge model. It is on CMU_PERIC1 like USI11, and firmware sets it up the same way: the user mux and the divider are read-only, and Linux turns on the three gates. The offsets are from Google's cmucal tables, each next to the USI11 one that already works: the user mux at 0x690 (USI11: 0x640, bit 4, parents the oscillator and the PERIC1 IP clock), the divider at 0x1824 (USI11: 0x1810, bits 0 to 3), and the IPCLK, PCLK and RSTNSYNC gates at 0x2070, 0x2074 and 0x20a0, bit 21 (USI11: 0x2048, 0x204c, 0x2094). The PCLK gate hangs off the PERIC1 NoC like USI11's, the other two off the divider. Tested on a Pixel 8 Pro with the board commit and the two device tree commits on top: the bus clocks were on and the EEPROM answered. Signed-off-by: Lef <me@lefteros.com> Assisted-by: LLM
USI9 is at 0x10c900c0 with its SW_CONF at offset 0x4 of the PERIC1 sysreg, and the bus is hsi2c_9 at 0x10c90000 on GIC SPI 657, as in Google's device tree. It is the I2C bus of the Pixel 8 Pro's battery pack EEPROM (the wireless charger sits on it too). Add its pins, gpp19-4 and gpp19-5 on function 2 with no pull, as stock has them. Both nodes are disabled: a board file or a bring-up overlay enables them. Tested on a Pixel 8 Pro with the board commit on top; a bring-up overlay enabled cmu_peric1, the sysreg, USI9 and hsi2c_9. Signed-off-by: Lef <me@lefteros.com> Assisted-by: LLM
…si2c_9 The Pixel 8 Pro's battery pack has an EEPROM on USI9 / hsi2c_9: stock has it as "at,24c08" at 0x50 on a 400 kHz bus. Its byte 0x17 is the battery ID that Google's driver matches against the fuel gauge models (0 the default model, 1 ATL, 2 COS, 3 LSN, 170 Google's dummy), and which pack the phone has is what decides the right model. The rest of the EEPROM holds the pack's part number, dates and history, so the node is read-only. Mainline's at24 driver wants "atmel,24c08", not stock's alias. The bus and USI9 stay disabled in the board file, like hsi2c_11; a bring-up overlay enables them. Nothing feeds the ID to the gauge yet. Tested on a Pixel 8 Pro (slot B, release 7.3.0-rc6-omamobile-push1- g7975b84a8017: Brett's c6 tree with derekross#163 and the four commits of this series, as the branch husky-pack-eeprom-booted). A bring-up overlay enabled cmu_peric1, the sysreg, USI9 and hsi2c_9. The log shows at24 0-0050: 1024 byte 24c08 EEPROM, read-only and a one-byte read of offset 0x17 returned 1, the ATL pack. Signed-off-by: Lef <me@lefteros.com> Assisted-by: LLM
524112e to
006dae5
Compare
|
Thanks Lef, all three points are in, and the rebase onto |
|
@derekross thank you for merging this and #163. Next from my side is the bus-on-by-default PR you described on omarchy-mobile#1, after #250 merges. |
This is stacked on #163: it needs the bus nodes and the clock work of that one, so the branch carries #163's six commits first and only the last four are new here. I'll rebase it when #163 merges.
What it does: it describes the I2C bus of the Pixel 8 Pro's battery pack EEPROM, so Linux can read the battery ID. Google's driver reads one byte of that EEPROM (offset 0x17) and uses it to pick the fuel gauge model; the gauge needs the right model for its temperature and its percentage. The four commits:
The nodes are all disabled, like hsi2c_11; a bring-up overlay switches them on (it is in omarchy-mobile #249 as pack-eeprom-test.dtso). CONFIG_EEPROM_AT24=m was already on, so there is no config change.
Tested on a Pixel 8 Pro: I booted this on the c6 base, with the overlay: the log shows "at24 0-0050: 1024 byte 24c08 EEPROM, read-only" and the three extra addresses of the 24c08 appear. I read byte 0x17 and only that byte: it is 1, which in Google's driver and the stock husky device tree is the ATL pack (the other values are 0 default-a1-0k, 2 COS, 3 LSN, 170 Google's dummy). That agrees with the 5,022,000 uAh design capacity the gauge showed before it fell back to its power-on state (the ATL model's 0x09cf times 2 mAh). The tree I booted is @greenbrettmichael's c6 plus the commits of #163 and these four as I first wrote them (before the cherry-pick onto the omamobile base, which only needed one conflict resolved in the pinctrl comment): https://github.com/Somnius/linux-omarchy-mobile/tree/husky-pack-eeprom-booted (tip 7975b84), release 7.3.0-rc6-omamobile-push1-g7975b84a8017. Enabling the bus renumbers the I2C adapters (the EEPROM's became i2c-0 and the battery chips i2c-1), which is worth knowing for anything that hardcodes a bus number.
Checks: kernel-pr-check --build --merge is clean in the container on the whole stack, dtbs_check on zuma-husky.dtb shows only the same two eusb2-phy supply warnings as before and the new eeprom@50 node validates, and the six commits of #163 are unchanged.
Not tested: another pack or phone (only the ATL pack), writing to the EEPROM (it is read-only here on purpose), and anything that uses the ID automatically: nothing feeds the byte to the gauge yet, I loaded the matching model by hand from an overlay. Whether the ID should be read at runtime or the model just described in the board file is something I'd like your view on, now that I know this pack is ATL.
tools/phone-smoke from the booted kernel
phone-smoke: husky
Kernel
7.3.0-rc6-omamobile-push1-g7975b84a8017, tools atbb11919, 2026-11-01T13:18Z.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