From 05c62f0270b47b637aea2cc33bfdaf5e5671da62 Mon Sep 17 00:00:00 2001 From: Derek Ross Date: Sun, 15 Nov 2026 11:04:29 -0500 Subject: [PATCH 1/4] USB-C-PLAN, usbc-deadman: K1b, a NO_AUTOIBUS left set stops charging A community 7 Pro on #169 read CHG_CNFG_09 0x93 after a boot from an empty battery and gained nothing on the cable; a chat user reports the same symptom. The driver never clears the bit. The fix is on the kernel branch omamobile-charger-autoibus; this records the cause, the regmap cache trap that makes an i2cset-then-rebind test lie, and a gated runbook. The MAX77759 also owns the USB data switch, so the runbook's writes go through tools/usbc-deadman: two new steps, k1b-autoibus-on and k1b-autoibus-off, change only bit 7 of 0xc2, read it back, and undo to the saved value unless confirmed over a fresh SSH login. Co-Authored-By: Claude Opus 5.5 --- device/cheetah/USB-C-PLAN.md | 110 ++++++++++++++++++++++++++++++++++- tools/usbc-deadman | 5 +- tools/usbc-deadman-phone | 19 +++++- 3 files changed, 130 insertions(+), 4 deletions(-) diff --git a/device/cheetah/USB-C-PLAN.md b/device/cheetah/USB-C-PLAN.md index 4e7e502e3..a2cdfb973 100644 --- a/device/cheetah/USB-C-PLAN.md +++ b/device/cheetah/USB-C-PLAN.md @@ -850,6 +850,114 @@ the loader undoes itself (that is its job). By hand: --- +### K1b: a NO_AUTOIBUS left set stops charging (2026-11-15, offline; nothing run yet) + +**The report.** A community 7 Pro on issue #169 that booted from an empty +battery read `CHG_CNFG_09` (0xc2) = `0x93`: the 500 mA limit (sel 19) with +`NO_AUTOIBUS` (bit 7) set. The battery current sat between -145 and +26 mA +on the cable; `i2cset -f -y 5 0x69 0xc2 0x13` took it to +1.41 A within a +second. A user in the community chat reports the same symptom twice ("won't +take a charge"), with no register read yet. Every boot of the reference +phone has read `0x13`, and it did again on 2026-11-15 (kernel +`7.3.0-rc6-omamobile-gda171eae4cb7`, at 98 %). + +**Why.** With no Type-C driver, the charger raises its input current above +`default_ilim_ua` only by its own detection, which `NO_AUTOIBUS` turns off. +Nothing in the driver touched the bit, so whatever the bootloader left +stayed. Google's driver sets the bit, but it also programs the limit from +the source its USB-PD stack negotiated; we have neither. Who sets it isn't +known; the one instance was a boot from an empty battery, when ABL charges +before Linux. + +**The fix**, `omamobile-charger-autoibus` @ `7269926dc5eb` ("power: supply: +max77759: let the charger set its own input current", one commit on +`github/omamobile` @ `d49d68c764d4`): `max77759_charger_start_default()` +clears `NO_AUTOIBUS` after setting the default limit, and the `found:` and +`probed:` lines end in `(fixed)` while the bit is set. The TCPM path is +unchanged. checkpatch `--strict` clean, `W=1` clean in the build container, +`tools/kernel-pr-check` passes all but the human sign-off. Test build: +`out-charger-autoibus`, `7.3.0-rc6-omamobile-push1-g7269926dc5eb`. + +This picks the side of K1 that every boot has run on so far (bit clear, the +charger following BC1.2 and Rp); it doesn't add the SDP cap K1 describes. + +**A trap for the test.** The charger regmap is `REGCACHE_FLAT`, filled +from the hardware when the MFD probes. A bit set later by `i2cset` is not in +the cache, so `regmap_update_bits()` sees it clear and writes nothing: +rebinding the charger after an `i2cset` would show the fix failing. The bit +has to be in the hardware before the MFD probes, that is, across a reboot. +Whether a warm reboot keeps it (or ABL rewrites 0xc2) is not known; K1b.3 +finds out. + +Runbook (each step the human's go; the phone on a wall charger, the battery +below 90 % so it charges at constant current, screen on). Every write to +the MAX77759 runs under the dead-man switch (section 4): the chip also owns +the USB data switch, and USB is the only link. `tools/usbc-deadman` has two +steps for this, `k1b-autoibus-on` and `k1b-autoibus-off`: each saves 0xc2, +changes only bit 7, reads it back, and is confirmed over a fresh SSH login +(`--fresh`) or undone by the phone (the saved 0xc2 written back, the data +switch closed if VBUS is there), with the watchdog behind that. `tools/usbc-deadman +dump` is the read-only view (its CNFG_09 line shows NO_AUTOIBUS). + +**K1b.0, read-only (risk: none).** + + uname -r + journalctl -k -b | grep -E 'max77759-charger.*(found|probed)' + i2cget -f -y 5 0x69 0xc2; i2cget -f -y 5 0x69 0xb9 + for i in $(seq 10); do cat /sys/class/power_supply/max170xx_battery/current_now; sleep 1; done + +Expect `0x13`, `0x05`, current about +1.4 A (µA in sysfs). **Stop** if 0xb9 +isn't `0x05` or the battery is above 42 C. + +**K1b.1, the symptom on the release kernel (risk: low; one charger config +bit, under the dead-man; tell the human first: charging stops for a few +minutes).** + + tools/usbc-deadman k1b-autoibus-on + tools/phone-ssh --fresh 'for i in $(seq 30); do cat /sys/class/power_supply/max170xx_battery/current_now; sleep 2; done' + +**Expect** exit 0 ("CONFIRMED"), the dump's CNFG_09 line `NO_AUTOIBUS 1`. +**Pass:** the current falls to about 0 (below +300 mA) within seconds, +which reproduces the report on our phone. **Stop** if the tool exits +non-zero (3 undone, 4 no answer: follow its recovery text), the mode +(0xb9) isn't `0x05`, or USB drops. **Rollback:** K1b.2, or by hand +`tools/usbc-deadman undo k1b-autoibus-on`; a reboot also ends it (whether +the bit survives one is K1b.4's question). + +**K1b.2, back to normal (risk: low; under the dead-man).** +`tools/usbc-deadman k1b-autoibus-off`; expect exit 0, `NO_AUTOIBUS 0`, ++1.4 A within seconds. If the phone undoes this step it writes back the +bit-set value from K1b.1: charging stays at the 500 mA limit, USB is not +affected; run the step again or reboot. **Stop** as in K1b.1. + +**K1b.3, the test kernel (risk: medium, a push and a reboot).** Stop the +modem first (`systemctl stop omamobile-modem`), then +`KERNEL_DIR=~/omamobile-kernel/wt-charger-autoibus +KERNEL_OUT=~/omamobile-kernel/out-charger-autoibus bin/omamobile push`. +After boot, K1b.0 again: `uname -r` reads the test release, 0xc2 `0x13`, +current as before, `phone-smoke` passes. **Rollback:** push the release +kernel from `out-k1115rel`. + +**K1b.4, the fix itself (risk: low; the bit set under the dead-man, then +a warm reboot).** `tools/usbc-deadman k1b-autoibus-on`, check that charging +stops as in K1b.1, then `systemctl reboot` (it stops the modem). **Stop** +before the reboot if the step didn't confirm. After boot: + + journalctl -k -b | grep -E 'max77759-charger.*(found|probed)' + i2cget -f -y 5 0x69 0xc2 + +**Pass:** `found: … (fixed)`, then `probed:` without it, 0xc2 `0x13` and ++1.4 A. If `found:` has no `(fixed)`, the bit didn't survive the reboot (or +ABL rewrote it): record which, and the fix stays proven only by the next +boot from an empty battery (K1b.5). **Stop** if `probed:` still says +`(fixed)`. + +**K1b.5, the field case (whenever a battery runs flat).** Boot from empty +on the cable and read the two probe lines: `found: … (fixed)` then a clean +`probed:` closes it, and tells us ABL sets the bit. + +--- + ### What the battery reports, and what upower sees, in each state | State | Gauge `status` | Line power in upower | `on-battery` | @@ -876,7 +984,7 @@ current flowing. | Overlays B4a/B4b | `device/cheetah/overlays/usbc-{tcpm,role}-test.dtso` | done; apply to today's overlaid DTB (checked) | | P1: device-cheetah 0.1.32 (D1) | blacklist, options, softdep, test flip | **to write** | | P2: `omamobile-typec-start` + unit, rescue as fallback watcher (D2) | device-cheetah | **to write** | -| K1 (only if G0 shows SDP above 500 mA): set `NO_AUTOIBUS` with the limit, as Google does | `max77759_charger.c` `set_input_current_limit()` | to write if needed; changes the charge rate on CDP ports (1.5 A to 0.5 A), so the human decides | +| K1 (only if G0 shows SDP above 500 mA): set `NO_AUTOIBUS` with the limit, as Google does | `max77759_charger.c` `set_input_current_limit()` | to write if needed; changes the charge rate on CDP ports (1.5 A to 0.5 A), so the human decides. The other half, clearing a bit the bootloader left set, is K1b above: **written, untested** | | K2 (nice to have): round the guard's current down; charger `status` "Not charging" while inhibited | `max77759_charger.c` | not needed for safety | | K3 (D4b/c): fold overlays into the DTS; gauge `power-supplies` | `gs201-cheetah.dts` | after B4b/D3 | | Tool: `usbc-deadman` uses `out-usbc` nowhere; only the plan text does | `USB-C-PLAN.md` section 6 | replace with this | diff --git a/tools/usbc-deadman b/tools/usbc-deadman index c0632b2f8..17f6b746b 100755 --- a/tools/usbc-deadman +++ b/tools/usbc-deadman @@ -16,7 +16,8 @@ # tools/usbc-deadman undo STEP revert a confirmed STEP by hand # tools/usbc-deadman log the phone's /var/log/usbc-deadman.log # -# STEP: b2-core | b3-charger | b4a-tcpm | b4b-role | replug | noop +# STEP: b2-core | b3-charger | b4a-tcpm | b4b-role | replug | noop | +# k1b-autoibus-on | k1b-autoibus-off (CHG_CNFG_09 bit 7, USB-C-PLAN K1b) # # Options: # --confirm SECS phone waits this long for our confirmation (default 90; @@ -87,7 +88,7 @@ case "$cmd" in dump) install_phone; phone 'usbc-deadman-phone dump'; exit $? ;; log) phone 'cat /var/log/usbc-deadman.log'; exit $? ;; undo) install_phone; phone "usbc-deadman-phone undo ${1:?STEP}"; exit $? ;; - b2-core|b3-charger|b4a-tcpm|b4b-role|replug|noop) step="$cmd" ;; + b2-core|b3-charger|b4a-tcpm|b4b-role|replug|noop|k1b-autoibus-on|k1b-autoibus-off) step="$cmd" ;; *) usage 1 ;; esac while (($#)); do diff --git a/tools/usbc-deadman-phone b/tools/usbc-deadman-phone index a0f474bda..d170b6676 100755 --- a/tools/usbc-deadman-phone +++ b/tools/usbc-deadman-phone @@ -29,7 +29,8 @@ # usbc-deadman-phone undo STEP revert a confirmed STEP by hand # usbc-deadman-phone rescue-watch loop: close the data switch after each replug # -# STEP: b2-core | b3-charger | b4a-tcpm | b4b-role | replug | noop +# STEP: b2-core | b3-charger | b4a-tcpm | b4b-role | replug | noop | +# k1b-autoibus-on | k1b-autoibus-off (CHG_CNFG_09 bit 7, USB-C-PLAN K1b) # Options: --confirm SECS (default 90) --grace SECS (default 60) # --ilim UA (b3: default_ilim_ua, default 500000) --no-watchdog @@ -169,6 +170,18 @@ apply() { lsmod | grep -q '^tcpci_maxim ' && { log "tcpci_maxim already loaded"; return 0; } log "modprobe tcpci_maxim (TCPM takes over the port; expect one USB re-enumeration)" modprobe tcpci_maxim ;; + k1b-autoibus-on|k1b-autoibus-off) + # CHG_CNFG_09 (0xc2) bit 7, NO_AUTOIBUS: set, the input stays at the + # ILIM field; clear, the charger raises it from what it detects. + # Only that bit changes; the undo writes back the saved value. + local v want + save_charger + v=$(rd $CHG 0xc2) || { log "cannot read 0xc2"; return 1; } + if [[ $1 == k1b-autoibus-on ]]; then want=$((v | 0x80)); else want=$((v & 0x7f)); fi + want=$(printf '0x%02x' "$want") + wr $CHG 0xc2 "$want" || return 1 + [[ $(rd $CHG 0xc2) == "$want" ]] || { log "0xc2 reads $(rd $CHG 0xc2), not $want"; return 1; } + log "0xc2 $v -> $want" ;; *) log "unknown step $1"; return 1 ;; esac } @@ -185,6 +198,10 @@ revert() { force_vbus log "modprobe -r tcpci_maxim tcpci tcpm" modprobe -r tcpci_maxim tcpci tcpm ;; + k1b-autoibus-on|k1b-autoibus-off) + local v + v=$(awk '$1 == "0xc2" {print $2}' $D/charger.saved 2>/dev/null) + if [[ -n $v ]]; then wr $CHG 0xc2 "$v"; else log "no saved 0xc2: left as is"; fi ;; esac rescue } From b7684b68f13a69a7d1a6102b893bf0ce00dc76a5 Mon Sep 17 00:00:00 2001 From: Derek Ross Date: Sun, 15 Nov 2026 13:57:09 -0500 Subject: [PATCH 2/4] USB-C-PLAN, usbc-deadman: K1b after review The setup needs the laptop's USB link (the dead-man tool and the checks run over it) and a source advertising Rp 1.5 A or 3.0 A, or the bit changes nothing and K1b.1 can't fail: K1b.0 now reads CC_STATUS and stops at Rp default. The modem is stopped for the test, NV backups are checked first, K1b.3 lists the whole build, K1b.4 has a rollback, and the wording follows the evidence (every read on record, the input following Rp, who may set the bit). usbc-deadman-phone: the k1b steps save the value from the same read that decides the write, in their own file, and refuse when that read fails, so the undo always has what it needs and doesn't touch b3-charger's saved registers. undo restores what was there before that step. Co-Authored-By: Claude Opus 5.5 --- device/cheetah/USB-C-PLAN.md | 183 +++++++++++++++++++++-------------- tools/usbc-deadman-phone | 17 +++- 2 files changed, 121 insertions(+), 79 deletions(-) diff --git a/device/cheetah/USB-C-PLAN.md b/device/cheetah/USB-C-PLAN.md index a2cdfb973..4924d73bf 100644 --- a/device/cheetah/USB-C-PLAN.md +++ b/device/cheetah/USB-C-PLAN.md @@ -857,61 +857,88 @@ battery read `CHG_CNFG_09` (0xc2) = `0x93`: the 500 mA limit (sel 19) with `NO_AUTOIBUS` (bit 7) set. The battery current sat between -145 and +26 mA on the cable; `i2cset -f -y 5 0x69 0xc2 0x13` took it to +1.41 A within a second. A user in the community chat reports the same symptom twice ("won't -take a charge"), with no register read yet. Every boot of the reference -phone has read `0x13`, and it did again on 2026-11-15 (kernel -`7.3.0-rc6-omamobile-gda171eae4cb7`, at 98 %). +take a charge"), with no register read yet. Every read on record has the +bit clear: B3.0, the two `usbc-deadman dump`s in `logs/`, the Pixel 6 Pro's +C2, the reporter's other sessions, and the reference phone on 2026-11-15 +(`7.3.0-rc6-omamobile-gda171eae4cb7`, `0x13` at 98 %). Clear is also the +power-on value (0x13 in Google's register header). **Why.** With no Type-C driver, the charger raises its input current above -`default_ilim_ua` only by its own detection, which `NO_AUTOIBUS` turns off. -Nothing in the driver touched the bit, so whatever the bootloader left -stayed. Google's driver sets the bit, but it also programs the limit from -the source its USB-PD stack negotiated; we have neither. Who sets it isn't -known; the one instance was a boot from an empty battery, when ABL charges -before Linux. - -**The fix**, `omamobile-charger-autoibus` @ `7269926dc5eb` ("power: supply: -max77759: let the charger set its own input current", one commit on -`github/omamobile` @ `d49d68c764d4`): `max77759_charger_start_default()` -clears `NO_AUTOIBUS` after setting the default limit, and the `found:` and -`probed:` lines end in `(fixed)` while the bit is set. The TCPM path is -unchanged. checkpatch `--strict` clean, `W=1` clean in the build container, -`tools/kernel-pr-check` passes all but the human sign-off. Test build: -`out-charger-autoibus`, `7.3.0-rc6-omamobile-push1-g7269926dc5eb`. - -This picks the side of K1 that every boot has run on so far (bit clear, the -charger following BC1.2 and Rp); it doesn't add the SDP cap K1 describes. - -**A trap for the test.** The charger regmap is `REGCACHE_FLAT`, filled -from the hardware when the MFD probes. A bit set later by `i2cset` is not in -the cache, so `regmap_update_bits()` sees it clear and writes nothing: -rebinding the charger after an `i2cset` would show the fix failing. The bit -has to be in the hardware before the MFD probes, that is, across a reboot. -Whether a warm reboot keeps it (or ABL rewrites 0xc2) is not known; K1b.3 -finds out. - -Runbook (each step the human's go; the phone on a wall charger, the battery -below 90 % so it charges at constant current, screen on). Every write to -the MAX77759 runs under the dead-man switch (section 4): the chip also owns -the USB data switch, and USB is the only link. `tools/usbc-deadman` has two -steps for this, `k1b-autoibus-on` and `k1b-autoibus-off`: each saves 0xc2, -changes only bit 7, reads it back, and is confirmed over a fresh SSH login -(`--fresh`) or undone by the phone (the saved 0xc2 written back, the data -switch closed if VBUS is there), with the watchdog behind that. `tools/usbc-deadman -dump` is the read-only view (its CNFG_09 line shows NO_AUTOIBUS). +`default_ilim_ua` only by itself, following the Rp the source advertises +(#169's readings: Rp 3.0 A gives +1.42 A, Rp default about 0 net), and +`NO_AUTOIBUS` turns that off. Nothing in the driver touched the bit, so +whatever was left in the chip stayed. Who sets it isn't known. Most likely +the bootloader: the one instance was a boot from an empty battery, when ABL +charges before Linux. Another candidate is stock: Google's driver writes +`NO_AUTOIBUS` = 1 with every input limit (it programs the limit from its +USB-PD stack, which we don't have), so a warm reboot from slot A could carry +it over if the bit survives a reboot, which K1b.4 finds out. + +**The fix**, linux-omarchy-mobile#261, `omamobile-charger-autoibus` (one +commit on `github/omamobile` @ `d49d68c764d4`): +`max77759_charger_start_default()` clears `NO_AUTOIBUS` after setting the +default limit (a failure is a warning, not a failed probe), and the `found:` +and `probed:` lines end in `(NO_AUTOIBUS set)` while it is set. +`psy_work_item()` doesn't touch the bit; probe clears it on any phone with +`default_ilim_ua` set (the 7 Pro, the Pixel 6 Pro, and the Pixel 7 once +#259 lands), with or without TCPM, though no phone has both today. On a +boot with the bit already clear the regmap cache skips the write, so +nothing changes on the bus. checkpatch `--strict` and `W=1` clean, +`tools/kernel-pr-check --merge` passes all but the human sign-off. + +This picks the side of K1 that every read on record has run on (bit clear, +the input following Rp); it doesn't add the SDP cap K1 describes. + +**A trap for the test.** The charger regmap is `REGCACHE_FLAT` with no +`reg_defaults_raw`, filled from the hardware when the MFD probes, and 0xc2 +isn't volatile. A bit set later by `i2cset` is not in the cache, so +`regmap_update_bits()` sees it clear and writes nothing: rebinding the +charger after an `i2cset` would show the fix failing. The bit has to be in +the hardware before the MFD probes, that is, across a reboot. Whether a +warm reboot keeps it (or ABL rewrites 0xc2) is not known; K1b.4 finds out. + +**Setup.** The phone on the laptop's USB-C port: the dead-man tool and every +check here need the USB link (`tools/usbc-deadman` stops at "phone not +reachable at 172.16.42.1"), so a wall charger alone won't do. The source +has to advertise Rp 1.5 A or 3.0 A, or the bit makes no difference (#169: +at Rp default the current is about 0 net either way) and K1b.1 can't fail. +G0 on 2026-10-19 read Rp 3.0 A on this port; K1b.0 checks it again. If it +reads default, a USB-C PD hub between the laptop and a wall charger that +passes data is the next thing to try. The battery below 90 %, so it charges +at constant current, screen on, the modem stopped for K1b.1 to K1b.4 +(`systemctl stop omamobile-modem`; with it up, a dead-man watchdog reset +would use the modem's one allowed unclean end, AGENTS.md section 2), and +after K1b.3's reboot `systemctl mask omamobile-modem-boot.target` for the +test (unmask it at the end). + +Every write to the MAX77759 runs under the dead-man switch (section 4): the +chip also owns the USB data switch, and USB is the only link. +`tools/usbc-deadman` has two steps for this, `k1b-autoibus-on` and +`k1b-autoibus-off`. Each reads 0xc2 once, refuses (nothing written) if the +read fails, keeps that value in its own `/run/usbc-deadman/.saved`, +changes only bit 7 and reads it back. It is confirmed over a fresh SSH login +(`--fresh`) or undone by the phone (its own saved value written back, the +data switch closed if VBUS is there), with the watchdog behind that. +`tools/usbc-deadman undo ` restores what was there before that step, +whatever ran since. `tools/usbc-deadman dump` is the read-only view (its +CNFG_09 line shows NO_AUTOIBUS; TCPC 0x1d is CC_STATUS). **K1b.0, read-only (risk: none).** - uname -r - journalctl -k -b | grep -E 'max77759-charger.*(found|probed)' - i2cget -f -y 5 0x69 0xc2; i2cget -f -y 5 0x69 0xb9 - for i in $(seq 10); do cat /sys/class/power_supply/max170xx_battery/current_now; sleep 1; done + tools/nv-backup --check # AGENTS.md section 1, before PMIC work + tools/phone-ssh 'uname -r; journalctl -k -b | grep -E "max77759-charger.*(found|probed)"' + tools/usbc-deadman dump + tools/phone-ssh 'for i in $(seq 10); do cat /sys/class/power_supply/max170xx_battery/current_now; sleep 1; done' -Expect `0x13`, `0x05`, current about +1.4 A (µA in sysfs). **Stop** if 0xb9 -isn't `0x05` or the battery is above 42 C. +**Expect** CNFG_09 sel 19 with `NO_AUTOIBUS 0`, CNFG_00 mode 5, the battery +about +1.4 A (µA in sysfs), and CC_STATUS (0x1d) with the attached CC at 2 +(Rp 1.5 A) or 3 (Rp 3.0 A): CC1 is bits 1:0, CC2 bits 3:2. **Stop** if the +NV check fails, the mode isn't 5, the battery is above 42 C, or the CC +reads 1 (Rp default): change the setup first. **K1b.1, the symptom on the release kernel (risk: low; one charger config bit, under the dead-man; tell the human first: charging stops for a few -minutes).** +minutes).** The modem stopped (Setup). tools/usbc-deadman k1b-autoibus-on tools/phone-ssh --fresh 'for i in $(seq 30); do cat /sys/class/power_supply/max170xx_battery/current_now; sleep 2; done' @@ -919,42 +946,50 @@ minutes).** **Expect** exit 0 ("CONFIRMED"), the dump's CNFG_09 line `NO_AUTOIBUS 1`. **Pass:** the current falls to about 0 (below +300 mA) within seconds, which reproduces the report on our phone. **Stop** if the tool exits -non-zero (3 undone, 4 no answer: follow its recovery text), the mode -(0xb9) isn't `0x05`, or USB drops. **Rollback:** K1b.2, or by hand -`tools/usbc-deadman undo k1b-autoibus-on`; a reboot also ends it (whether -the bit survives one is K1b.4's question). +non-zero (3 undone, 4 no answer: follow its recovery text; 5 refused or 6 +failed: nothing stayed applied), the mode isn't 5, or USB drops. +**Rollback:** K1b.2, or `tools/usbc-deadman undo k1b-autoibus-on`; a reboot +may end it too (K1b.4's question). **K1b.2, back to normal (risk: low; under the dead-man).** `tools/usbc-deadman k1b-autoibus-off`; expect exit 0, `NO_AUTOIBUS 0`, +1.4 A within seconds. If the phone undoes this step it writes back the -bit-set value from K1b.1: charging stays at the 500 mA limit, USB is not -affected; run the step again or reboot. **Stop** as in K1b.1. +bit-set value it found: charging stays at the 500 mA limit and USB is not +affected; run the step again, or `undo k1b-autoibus-on`. **Stop** as in +K1b.1. -**K1b.3, the test kernel (risk: medium, a push and a reboot).** Stop the -modem first (`systemctl stop omamobile-modem`), then +**K1b.3, the test kernel (risk: medium, a push and a reboot).** With `KERNEL_DIR=~/omamobile-kernel/wt-charger-autoibus -KERNEL_OUT=~/omamobile-kernel/out-charger-autoibus bin/omamobile push`. -After boot, K1b.0 again: `uname -r` reads the test release, 0xc2 `0x13`, -current as before, `phone-smoke` passes. **Rollback:** push the release -kernel from `out-k1115rel`. - -**K1b.4, the fix itself (risk: low; the bit set under the dead-man, then -a warm reboot).** `tools/usbc-deadman k1b-autoibus-on`, check that charging -stops as in K1b.1, then `systemctl reboot` (it stops the modem). **Stop** -before the reboot if the step didn't confirm. After boot: - - journalctl -k -b | grep -E 'max77759-charger.*(found|probed)' - i2cget -f -y 5 0x69 0xc2 - -**Pass:** `found: … (fixed)`, then `probed:` without it, 0xc2 `0x13` and -+1.4 A. If `found:` has no `(fixed)`, the bit didn't survive the reboot (or -ABL rewrote it): record which, and the fix stays proven only by the next -boot from an empty battery (K1b.5). **Stop** if `probed:` still says -`(fixed)`. +KERNEL_OUT=~/omamobile-kernel/out-charger-autoibus` set, build the whole set +offline first: `bin/omamobile kernel`, `initramfs`, `images` (cheetah, the +default device) and `modules`. Then, the modem stopped, `bin/omamobile +push`. After boot, mask the modem for the test (Setup), then K1b.0 again: +`uname -r` reads the test release, `probed:` has no `(NO_AUTOIBUS set)`, +CNFG_09 `NO_AUTOIBUS 0`, current as before, `tools/phone-smoke` passes. +**Stop** if any of those fail. **Rollback:** the same `push` with +`KERNEL_OUT=~/omamobile-kernel/out-k1115rel` (the release kernel, its set +complete). + +**K1b.4, the fix itself (risk: low; the bit set under the dead-man, then a +warm reboot).** `tools/usbc-deadman k1b-autoibus-on`, check that charging +stops as in K1b.1, then `systemctl reboot`. **Stop** before the reboot if +the step didn't confirm. After boot: + + tools/phone-ssh 'journalctl -k -b | grep -E "max77759-charger.*(found|probed)"' + tools/usbc-deadman dump + +**Pass:** `found: … (NO_AUTOIBUS set)`, then `probed:` without it, CNFG_09 +`NO_AUTOIBUS 0` and +1.4 A. If `found:` doesn't show it, the bit didn't +survive the warm reboot (or ABL rewrote it): record which, and the fix +stays proven only by a boot from an empty battery (K1b.5). **Stop** if +`probed:` still shows it. **Rollback:** `tools/usbc-deadman +k1b-autoibus-off` (K1b.2) puts the bit back to clear on any kernel; the +kernel itself as in K1b.3. At the end, `systemctl unmask +omamobile-modem-boot.target`. **K1b.5, the field case (whenever a battery runs flat).** Boot from empty -on the cable and read the two probe lines: `found: … (fixed)` then a clean -`probed:` closes it, and tells us ABL sets the bit. +on the cable and read the two probe lines: `found: … (NO_AUTOIBUS set)` +then a clean `probed:` closes it, and tells us ABL sets the bit. --- diff --git a/tools/usbc-deadman-phone b/tools/usbc-deadman-phone index d170b6676..fa54bde5d 100755 --- a/tools/usbc-deadman-phone +++ b/tools/usbc-deadman-phone @@ -173,10 +173,14 @@ apply() { k1b-autoibus-on|k1b-autoibus-off) # CHG_CNFG_09 (0xc2) bit 7, NO_AUTOIBUS: set, the input stays at the # ILIM field; clear, the charger raises it from what it detects. - # Only that bit changes; the undo writes back the saved value. + # Only that bit changes. The undo writes back the value this read + # saw, kept per step (not charger.saved, which b3-charger owns). local v want - save_charger - v=$(rd $CHG 0xc2) || { log "cannot read 0xc2"; return 1; } + rm -f "$D/$1.saved" + v=$(rd $CHG 0xc2) + [[ $v == 0x[0-9a-f][0-9a-f] ]] || { log "cannot read 0xc2 (got '$v'): nothing written"; return 1; } + echo "$v" > "$D/$1.saved" + [[ $(cat "$D/$1.saved" 2>/dev/null) == "$v" ]] || { log "cannot save 0xc2: nothing written"; return 1; } if [[ $1 == k1b-autoibus-on ]]; then want=$((v | 0x80)); else want=$((v & 0x7f)); fi want=$(printf '0x%02x' "$want") wr $CHG 0xc2 "$want" || return 1 @@ -200,8 +204,11 @@ revert() { modprobe -r tcpci_maxim tcpci tcpm ;; k1b-autoibus-on|k1b-autoibus-off) local v - v=$(awk '$1 == "0xc2" {print $2}' $D/charger.saved 2>/dev/null) - if [[ -n $v ]]; then wr $CHG 0xc2 "$v"; else log "no saved 0xc2: left as is"; fi ;; + # This step's own saved value: undo k1b-autoibus-on restores what + # was there before that step, whatever ran since. + v=$(cat "$D/$1.saved" 2>/dev/null) + if [[ $v == 0x[0-9a-f][0-9a-f] ]]; then wr $CHG 0xc2 "$v" + else log "no saved 0xc2 for $1: left as is"; fi ;; esac rescue } From b5daf806f80462edb4dacfd48602ca719c7e5a86 Mon Sep 17 00:00:00 2001 From: Derek Ross Date: Tue, 17 Nov 2026 21:08:48 -0500 Subject: [PATCH 3/4] USB-C-PLAN K1b: mask and stop the modem before the push, not after the boot K1b.3 pushed the test kernel and masked the modem's boot target after the boot. The 7 Pro starts the modem at boot and masking a target stops nothing that boot already started, so K1b.4 would have armed the dead-man watchdog with the modem up, against the runbook's own Setup. The mask now goes in before the push, K1b.3 and K1b.4 each check that the modem reads inactive, and K1b.4 stops if it doesn't. Also from round 60's review: K1b.2 is K1b.1's rollback of record (a second k1b-autoibus-on in one boot makes the undo keep the bit set), and the heading says no write has run, since a read has. Co-Authored-By: Claude Fable 5.2 --- device/cheetah/USB-C-PLAN.md | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/device/cheetah/USB-C-PLAN.md b/device/cheetah/USB-C-PLAN.md index 4924d73bf..ad79d61a6 100644 --- a/device/cheetah/USB-C-PLAN.md +++ b/device/cheetah/USB-C-PLAN.md @@ -850,7 +850,7 @@ the loader undoes itself (that is its job). By hand: --- -### K1b: a NO_AUTOIBUS left set stops charging (2026-11-15, offline; nothing run yet) +### K1b: a NO_AUTOIBUS left set stops charging (2026-11-15, offline; no write run yet) **The report.** A community 7 Pro on issue #169 that booted from an empty battery read `CHG_CNFG_09` (0xc2) = `0x93`: the 500 mA limit (sel 19) with @@ -908,8 +908,10 @@ passes data is the next thing to try. The battery below 90 %, so it charges at constant current, screen on, the modem stopped for K1b.1 to K1b.4 (`systemctl stop omamobile-modem`; with it up, a dead-man watchdog reset would use the modem's one allowed unclean end, AGENTS.md section 2), and -after K1b.3's reboot `systemctl mask omamobile-modem-boot.target` for the -test (unmask it at the end). +before K1b.3's push `systemctl mask omamobile-modem-boot.target`, so the +test kernel's boots come up without it (unmask it at the end). The mask +goes in before the push because the 7 Pro starts the modem at boot, and +masking the target stops nothing a boot has already started. Every write to the MAX77759 runs under the dead-man switch (section 4): the chip also owns the USB data switch, and USB is the only link. @@ -948,8 +950,10 @@ minutes).** The modem stopped (Setup). which reproduces the report on our phone. **Stop** if the tool exits non-zero (3 undone, 4 no answer: follow its recovery text; 5 refused or 6 failed: nothing stayed applied), the mode isn't 5, or USB drops. -**Rollback:** K1b.2, or `tools/usbc-deadman undo k1b-autoibus-on`; a reboot -may end it too (K1b.4's question). +**Rollback:** K1b.2, with the dump's `NO_AUTOIBUS 0` as its check. (`undo +k1b-autoibus-on` also works after one run of the step; a second run in the +same boot saves the bit-set value, and the undo then leaves the bit set.) A +reboot may end it too (K1b.4's question). **K1b.2, back to normal (risk: low; under the dead-man).** `tools/usbc-deadman k1b-autoibus-off`; expect exit 0, `NO_AUTOIBUS 0`, @@ -962,8 +966,12 @@ K1b.1. `KERNEL_DIR=~/omamobile-kernel/wt-charger-autoibus KERNEL_OUT=~/omamobile-kernel/out-charger-autoibus` set, build the whole set offline first: `bin/omamobile kernel`, `initramfs`, `images` (cheetah, the -default device) and `modules`. Then, the modem stopped, `bin/omamobile -push`. After boot, mask the modem for the test (Setup), then K1b.0 again: +default device) and `modules`. Then, on the phone, `systemctl mask +omamobile-modem-boot.target` and `systemctl stop omamobile-modem` (already +stopped since K1b.1: `systemctl is-active omamobile-modem` reads +`inactive`), and only then `bin/omamobile push`. The test kernel boots +without the modem (Setup). After boot, K1b.0 again: +`systemctl is-active omamobile-modem` reads `inactive`, `uname -r` reads the test release, `probed:` has no `(NO_AUTOIBUS set)`, CNFG_09 `NO_AUTOIBUS 0`, current as before, `tools/phone-smoke` passes. **Stop** if any of those fail. **Rollback:** the same `push` with @@ -971,7 +979,9 @@ CNFG_09 `NO_AUTOIBUS 0`, current as before, `tools/phone-smoke` passes. complete). **K1b.4, the fix itself (risk: low; the bit set under the dead-man, then a -warm reboot).** `tools/usbc-deadman k1b-autoibus-on`, check that charging +warm reboot).** First `systemctl is-active omamobile-modem` reads +`inactive`: **stop** if it doesn't, the watchdog must not be armed with the +modem up. Then `tools/usbc-deadman k1b-autoibus-on`, check that charging stops as in K1b.1, then `systemctl reboot`. **Stop** before the reboot if the step didn't confirm. After boot: From 7105fda20c246477494863541eb4d63e974b8b92 Mon Sep 17 00:00:00 2001 From: Derek Ross Date: Wed, 18 Nov 2026 12:46:03 -0500 Subject: [PATCH 4/4] USB-C-PLAN: K1b, the second and third phones' flat boots on #169 A second 7 Pro read NO_AUTOIBUS set after a flat boot (2026-11-16), the same phone charged normally after two earlier flat boots, and a third read it clear on flat boots, so the bit isn't set on every boot from empty and K1b.5 says a flat boot without the suffix is no result. Co-Authored-By: Claude Fable 5.2 --- device/cheetah/USB-C-PLAN.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/device/cheetah/USB-C-PLAN.md b/device/cheetah/USB-C-PLAN.md index ad79d61a6..8ecd03ae2 100644 --- a/device/cheetah/USB-C-PLAN.md +++ b/device/cheetah/USB-C-PLAN.md @@ -856,7 +856,10 @@ the loader undoes itself (that is its job). By hand: battery read `CHG_CNFG_09` (0xc2) = `0x93`: the 500 mA limit (sel 19) with `NO_AUTOIBUS` (bit 7) set. The battery current sat between -145 and +26 mA on the cable; `i2cset -f -y 5 0x69 0xc2 0x13` took it to +1.41 A within a -second. A user in the community chat reports the same symptom twice ("won't +second. A second 7 Pro on the same issue (2026-11-16) read `0x93` after a +boot from flat: -223 mA with the screen on, about +250 mA with it off, and ++1.41 A five seconds after the same write; a reboot from 88 % then read +`0x13`. A user in the community chat reports the same symptom twice ("won't take a charge"), with no register read yet. Every read on record has the bit clear: B3.0, the two `usbc-deadman dump`s in `logs/`, the Pixel 6 Pro's C2, the reporter's other sessions, and the reference phone on 2026-11-15 @@ -868,8 +871,10 @@ power-on value (0x13 in Google's register header). (#169's readings: Rp 3.0 A gives +1.42 A, Rp default about 0 net), and `NO_AUTOIBUS` turns that off. Nothing in the driver touched the bit, so whatever was left in the chip stayed. Who sets it isn't known. Most likely -the bootloader: the one instance was a boot from an empty battery, when ABL -charges before Linux. Another candidate is stock: Google's driver writes +the bootloader: both instances were boots from an empty battery, when ABL +charges before Linux. It isn't every such boot: the second phone booted flat +on 11-12 and 11-13 and took +1.41 A with no write (register not read), and +a third 7 Pro read `0x13` on flat boots on 11-15 and 11-17 (#169). Another candidate is stock: Google's driver writes `NO_AUTOIBUS` = 1 with every input limit (it programs the limit from its USB-PD stack, which we don't have), so a warm reboot from slot A could carry it over if the bit survives a reboot, which K1b.4 finds out. @@ -999,7 +1004,9 @@ omamobile-modem-boot.target`. **K1b.5, the field case (whenever a battery runs flat).** Boot from empty on the cable and read the two probe lines: `found: … (NO_AUTOIBUS set)` -then a clean `probed:` closes it, and tells us ABL sets the bit. +then a clean `probed:` closes it, and tells us ABL sets the bit. A flat boot +whose `found:` line has no suffix is no result: not every flat boot sets the +bit (#169). ---