From 5eb07d7e1533a4e2417c01b123ab203c2b84b587 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 03:07:28 -0647 Subject: [PATCH 01/26] MODEM-PLAN: GNSS G3 fifth to twenty-fourth tries, the SPI link The engine tracks satellites and gnssd's watchdog does the rest. The link garbles single bytes at the 6.24 MHz the SPI really runs at, and stock's OSCCLK clock, 32-bit words and auto CS break the framing. --- device/tegu/MODEM-PLAN.md | 181 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 181 insertions(+) diff --git a/device/tegu/MODEM-PLAN.md b/device/tegu/MODEM-PLAN.md index 191187207..18188abd3 100644 --- a/device/tegu/MODEM-PLAN.md +++ b/device/tegu/MODEM-PLAN.md @@ -542,6 +542,187 @@ startNmea 25; callbacks location 4, NMEA 5). longer stops the profile. Until M6 qualifies the power-off, don't stop the modem profile by hand; reboot with someone at the palmtop. +### G3, third try: rails on (2026-10-28, `7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty`, round ps1 DTB with ldo9s-11s on) + +[V] With LDO9S-11S on, Kepler loads, reaches OPERATIONAL and no longer +logs "FCAL Part 1 is not done yet": the RF front end calibrates now. The +gnss-slsi HAL and our client start a session (capabilities 0xe7df, start +and startNmea ok, status SESSION_BEGIN then ENGINE_ON), but every engine +start still ends in the same fault: "KEP M7 HARDFAULT ... LR,PC 600B5B39 +0000062C" (16 times in 10 minutes, ENGINE_ON/ENGINE_OFF each time), no +NMEA. So the rails were one missing piece, not the fault itself. Indoor or +outdoor doesn't matter yet: the engine crashes before it searches. +The G3 script's HARDFAULT count missed these (gnssd wrote them outside its +window). + +### G3, fourth try: the AoC told the GNSS type (2026-10-28, evening, gn3 DTB) + +[V] With `&aoc { gnss-type = <2>; }` (kAOCGnssType, as Google's +`zumapro-phone-ignss.dtsi`), Kepler loads, goes OPERATIONAL, and the +gnss-slsi HAL and our client start a session (startNmea ok, "the HAL asks +for a location"). But every engine start still ends in the same "KEP M7 +HARDFAULT ... LR,PC 600B5B39 0000062C" (20 in 4 minutes), so the type isn't +it. In the register dump, R3 = 0x62D and PC = 0x62C: the M7 jumped +through a function pointer holding 0x62D, a Thumb address near zero, which +looks like an entry nobody filled in. Other leads from the logs: +`aiding_timemark_reader_thread: open() errno:2` (gnssd can't open its +time-mark device), `TGT_MEMS initInterface: fromBinder() failed` (the HAL's +sensor service is missing), and `libsighandler.so` not found. Next, attended +and on the charger, with the modem up: `strace -f` gnssd across one engine start, to see which +files and devices it opens or fails to open (observation only). + +### G3, fifth to eighth tries (2026-10-29, night, same kernel, on the charger, outdoors spot) + +- **strace of gnssd across engine starts** (`logs/tegu-modem-20261027/phone/g7-strace.sh`): + the HAL's request reaches gnssd, gnssd talks CHPP to Kepler over + `gnss_ipc` normally (the all-zero reads after each write are the SPI + full-duplex bytes Google's `send_betp` passes up by design), and Kepler + stops answering a few seconds after the engine start; gnssd then reads the + GNSS image back (`IOCTL_READ_GNSS_IMAGE`) and dumps RAM. `umts_boot0` + ioctl 0x28 (EINVAL, not in our CPIF) comes after the fault, in the crash + path. +- **Missing libraries**: gnssd `dlopen()`s `libcustomgnss.so` + (`GlueLayer_IsUseCustomGnssLib=1`), which needs `libsitril-gps.so` and + `libsitril-client.so` (RIL's GPS channel, binder to radioExternal). All + three were missing from the chroot. With them in, libcustomgnss reads the + CP state from `/sys/bus/platform/devices/cpif/modem_state`, which the + chroot lacked; with that bound, it logs "Modem state ONLINE". `GpsOpen()` + still fails (no radioExternal HAL). Kepler's fault is unchanged (PR #141). +- **DVS and DFS off** through gnssd's `/data/vendor/gps/overlay/gps_overlay.conf` + (read 27 times): the fault is unchanged (9 in 4 minutes). +- **Stock's rails are Kepler's to control**: LDO9S-11S carry + `channel-mux-selection` 0x29-0x2b (subsys GPS) in stock's DT, with + LDO9S ranging 0.725-1.3 V; our DT holds them on at fixed voltages. +- **Hazard found**: after the modem profile has stopped (gnssd's exit), + starting the profile again in `OMAMOBILE_MODEM_STAGE=rfsd` reset the + palmtop silently (watchdog, no pstore). Reboot instead. +- **Where the fault is** (local disassembly of the soft-watchdog RAM dump, + which is kepler.bin as loaded at 0x60000000; private, never committed): + the patch code at 0x600B5B34 calls a veneer at 0x600E143C that jumps to + 0x200005B5 (R12 at the fault), code in Kepler's SRAM (the main stack is at + 0x2002FF38). That code branched through R3 = 0x62D, and the M7 faulted + fetching 0x62C, low memory that isn't in the image. So something maps or + powers Kepler's low memory, or fills that pointer, and it hasn't happened + by engine start. `umts_boot0` ioctl 0x28 (gnssd's "SHMEM_SIZE -1") is + not defined in Google's tegu CPIF either, so stock gets EINVAL too and it + isn't the cause. +- **The loaded image is intact.** The dump differs from kepler.bin in 17 + words, all in the configuration header below 0x390, and they are gps.cfg's + values that gnssd writes before the load (RfMiscCtrl 0x80008001 at 0x10, + AidingConfiguration 0x20046 at 0x1c, the VDR 200/20 limits at + 0x344-0x350). So the write-combine mapping of GNSS_FW (stock: cached, + over an I/O-coherent link) doesn't corrupt the load. The layout matches + stock too: GNSS_FW at cp_rmem + 8 MiB, 4 MiB long. The missing piece is + on the core's side (its low memory at engine start), which the AP can't + see; the next step is Kepler's own debug log (`gps_overlay.conf.next`). + +### G3, ninth to fourteenth tries: the "hardfault" is gnssd's watchdog (2026-10-29, night) + +[V] With gnssd's debug log on (`gps_overlay.conf`: `debug_enable=1`, +`debug_console=1`, `chpp_log_level=4`), the engine is seen **working**: it +tracks satellites (SVIDs 5, 11, 12, 13 at C/N0 29-35 dB-Hz) within ~10 s +of the start. The fault that follows is gnssd's own: its soft watchdog +logs "KEP soft_dog pos req timeout", then "sw version timeout", resets +Kepler and sends BLC ID 6 ("Try and trigger hard fault to see if CPU is +locked up or maybe we can get RAM dumps"), which is the "KEP M7 +HARDFAULT" with PC 0x62C. The watchdog fires because the CHPP link over +the GNSS SPI loses packets: thousands of "ACK timeout" and 244 "Rx BAD +checksum" in one run. In the raw reads, frames that should start with the +CHPP preamble `68 43` often read `34 21`, the same bits one bit late, and +long frames end in zeros. + +The SPI settings tried, each on a fresh boot (the CP boots once per boot): + +| SPI mode | rx chunk | feedback delay | RX bad checksums | Kepler | +| --- | --- | --- | --- | --- | +| 0 (as ported) | 64 | 2 (as ported) | 244 | tracks, then the watchdog | +| 0 | 32 | 2 | 17 | opstate 0 | +| 0 | 32 | 0 (stock's value) | 93 | opstate 0 | +| 1 | 32 | 0 | 34 | opstate 0 | +| 1 | 64 | 0 | 0 (RX clean) | TX lost: Kepler never sees our RESET-ACK | +| 0, 1 MHz | 64 | 0 | 63 | opstate 0 | +| 3 | 64 | 0 | 32 | opstate 0 | +| 0, 32-bit words (swapped in gnss_spi) | 64 | 2 | 1 | RX transfers time out (-110), opstate 0 | +| 0, 32-bit, auto CS (`google,gs101-spi` only) | 64 | 2 | 0 | RX transfers time out (-110), opstate 0 | +| 0, auto CS | 64 | 2 | 274 | tracks, then the watchdog (as ported) | + +So RX samples the core's data a bit early in mode 0, mode 1 fixes RX but +breaks TX, and neither the feedback delay nor a slower clock fixes it. +Stock drives this SPI with 32-bit words, `swap-mode = <1>` and DMA +(`dma-mode`, PDMA 0x14/0x15); our port uses PIO. 32-bit words alone (byte +order fixed in gnss_spi) time out in PIO, so the next step is DMA for this +SPI. Google's driver uses auto CS for this device (no +`samsung,spi-chip-select-mode`), but auto CS changes nothing with 8-bit +words. Our DT has no PDMA controller (stock's overlay uses `pdma1`), so DMA +means a PL330 node for zumapro first. The palmtop is back on the as-ported setting (mode 0, +64-byte reads, delay 2, the gn3 DTB). + +Next steps for the link, from the night of 10-29 (not tried yet): +- **32-bit words in PIO time out** (`res -110`, every 64-byte read) under + mainline spi-s3c64xx. Not its FIFO-level check: Google's driver makes the + same `RX_FIFO_LVL < xfer->len` comparison for 32-bit words and works, so + the level counts bytes. -110 is mainline's interrupt wait + (`wait_for_completion_timeout` in `s3c64xx_wait_for_pio()` with + `use_irq`), which Google's driver doesn't have: it polls. The FIFO + trigger interrupt with 32-bit words is the next thing to read + (spi-s3c64xx is built in, so a change is a kernel push). +- **DMA:** stock's `pdma1` is a PL330 at 0x10130000 (SPI 806, a 200 MHz + fixed clock, Samsung's 36-bit address wrappers, which mainline doesn't + have), with the GNSS SPI on channels 0x14 (tx) and 0x15 (rx). A + read-only probe (2026-10-29) read its PrimeCell IDs (periph 0x30 0x13, + cell 0x0d 0xf0) from Linux without an abort, so a DT node can probe it. + Mainline uses DMA only for transfers longer than the 64-byte FIFO, so the + 64-byte reads would stay PIO. + +**What the link does (10-29, night), cause still open:** mainline spi-s3c64xx cuts +every PIO transfer of 64 bytes or more into 63-byte pieces +(`xfer->len = fifo_len - 1`), stopping and flushing the FIFO between them. +So each 64-byte read of Kepler becomes 63 + 1 bytes, and each longer write +is cut mid-frame; 32-bit words then can't work at all (63 isn't a multiple +of 4: the `len-63` timeouts). Stock never splits: it uses DMA. But the +split isn't shown to be the cause: with gnss_spi cutting every transfer +into 60-byte pieces itself (one message, CS held, every pause on a 32-bit +boundary, so the controller never cuts), the link garbled just the same +(369 bad checksums, Kepler tracking, then the watchdog). Progress: a runtime test module +registered stock's pdma1 (PL330 at 0x10130000, SPI 806) and the built-in +pl330 driver probed it and ran a 256-byte memcpy correctly; a DTB with the +node probes it at boot. But with `dmas` on the GNSS SPI (0x14/0x15, either +order), RX DMA moves nothing (residue 64): the SPI's DMA requests don't +reach pdma1, so some routing stock sets up is still missing (a sysreg or +USI DMA select, or the PL330's peripheral security setting). The palmtop +is back on gn3 without the node. A one-boot reset at 69 s happened on the +second boot with the node, cause not seen. + +### G3, fifteenth to twenty-third tries: the SPI runs at twice stock's clock (2026-10-29, small hours) + +[V] Each try on a fresh boot of the gn3 kernel, gnssd's debug log on, a test +`gnss_spi.ko` with module parameters (feedback delay, chip-select setup, +clock, `HIGH_SPEED_EN`), raw RX bytes taken from strace of gnssd's reads of +`/dev/gnss_ipc`. Results: + +| Try | Setting | Bad checksums | Kepler | +| --- | --- | --- | --- | +| baseline (control) | as ported: 8-bit, 64-byte reads, delay 2 | 46 | tracks (C/N0 29-34), then the watchdog | +| w32p32 | 32-bit words, 32-byte pieces in one message | 19 | no watchdog, stops after RESET-ACK | +| w32rx32 | 32-bit, 32-byte reads | 7 | same | +| fb3 | 32-bit, feedback delay 3 | 5 | same | +| cs200 | 32-bit, delay 3, 200 us CS setup | 0 | same | +| osc | 32-bit, USI3 mux on OSCCLK, about 1.5 MHz | 0 | same | +| acs | 32-bit, auto CS DTB | 0 | same | +| osc8 | 8-bit, OSCCLK, about 1.5 MHz, delay 0 | 1 | same | +| hs | 8-bit, `HIGH_SPEED_EN` forced, 32-byte transfers | 17 | same | +| hs60 | 8-bit, `HIGH_SPEED_EN`, 60-byte reads | 408 | tracks, then the watchdog (38) | + +What the raw bytes show: + +- **The real SPI clock is 6.24 MHz, not 3.125.** USI3's mux (`zumapro_mout_hsi0_usi3_local`) is read-only in clk-zumapro and sits on the 399.36 MHz parent; the 4-bit divider stops at /16, so the IP clock is 24.96 MHz and the SPI clock 24.96 / 4, whatever spi-s3c64xx asks for. The "1 MHz" try of the night before ran at 6.24 MHz too. +- **The baseline's errors are per byte:** one byte of a repeated frame arrives with its top bit taken from the previous byte's last bit (`10 01 00 0a ... 4f b6 25 9c` read as `08 00 00 05 ... 27 db 12 ce`), and the rest of the frame is right. That is the controller sampling before Kepler's data has settled: too little margin at 6.24 MHz, as mode 1 (which samples half a clock later) showed. +- **Every changed setting broke the framing instead:** with 32-bit words, with the OSCCLK mux, and with chip select toggled every 32 bytes, CHPP frames arrive at any bit offset (8-bit baseline: always 0 or 1), the link stops after RESET-ACK, and the bad-checksum count drops only because few frames are recognised. A chip-select toggle in the middle of a frame drops one byte from Kepler at the break. So the low counts in this table are not improvements. + +The next step is the clock itself, in the kernel: let spi-s3c64xx reach 12.5 MHz on USI3 (3.125 MHz SPI) from a parent that can give it, as stock does, with nothing else changed. The OSCCLK try isn't a fair test of that (24.576 / 4, about 1.5 MHz, switched behind the clock framework's back). The palmtop is back on the baseline (`gnss_spi` aa4618bb, `gnssif` eb0f3d9a, gn3 DTB, no debug overlay). One reset at 348 s, after the hs60 run had ended, came during modem PCIe link activity ("PHY isolated"), not in the SPI path. + +**Stock's clock, tried (twenty-fourth try):** Google's zuma CMU table (`cmucal-vclk.c`, `div_clk_hsi0_usix_12mhz_lut_params` = div 1, mux 1) makes USI3's 12 MHz from OSCCLK / 2 (12.288 MHz, a 3.07 MHz SPI clock). A test module set exactly that (mux to OSCCLK, divider held at /2, 8-bit, delay 0). Framing broke as in the other OSCCLK try: Kepler resent one frame (`68 43 00 20 01 00 0a ...`) for seconds, and every copy arrived shifted by the same 4 bits across many separate reads, then by 5, then 6. So Kepler's bit counter runs on across chip-select cycles, and on OSCCLK it gains or loses clocks; on the 399.36 MHz parent (baseline, 6.24 MHz) the frames stay at bit 0 and only single bytes are misread. A clk-zumapro change that lets USI3 reach OSCCLK / 2 is drafted (`~/android/mainline/wt-spi-word`, not built) but not worth a kernel until the slip is understood; it would reproduce this test. The palmtop is on the baseline again. + ### Suspend with the modem on (2026-10-27, early morning, same kernel) - **What ran:** s2idle on `7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty` From 70ffe18f51f13ab6dffb4eb4505fc35ee0fc00c2 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 03:30:30 -0647 Subject: [PATCH 02/26] MODEM-PLAN: GNSS G3, stock's clock and mode 1 reads Stock's OSCCLK clock breaks framing here. Reading in mode 1 lines every frame up on the as-ported clock, but the first bytes after each chip select still arrive damaged, and Kepler resets can take the SoC down. --- device/tegu/MODEM-PLAN.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/device/tegu/MODEM-PLAN.md b/device/tegu/MODEM-PLAN.md index 18188abd3..5f09a3fca 100644 --- a/device/tegu/MODEM-PLAN.md +++ b/device/tegu/MODEM-PLAN.md @@ -723,6 +723,10 @@ The next step is the clock itself, in the kernel: let spi-s3c64xx reach 12.5 MHz **Stock's clock, tried (twenty-fourth try):** Google's zuma CMU table (`cmucal-vclk.c`, `div_clk_hsi0_usix_12mhz_lut_params` = div 1, mux 1) makes USI3's 12 MHz from OSCCLK / 2 (12.288 MHz, a 3.07 MHz SPI clock). A test module set exactly that (mux to OSCCLK, divider held at /2, 8-bit, delay 0). Framing broke as in the other OSCCLK try: Kepler resent one frame (`68 43 00 20 01 00 0a ...`) for seconds, and every copy arrived shifted by the same 4 bits across many separate reads, then by 5, then 6. So Kepler's bit counter runs on across chip-select cycles, and on OSCCLK it gains or loses clocks; on the 399.36 MHz parent (baseline, 6.24 MHz) the frames stay at bit 0 and only single bytes are misread. A clk-zumapro change that lets USI3 reach OSCCLK / 2 is drafted (`~/android/mainline/wt-spi-word`, not built) but not worth a kernel until the slip is understood; it would reproduce this test. The palmtop is on the baseline again. +**Read in mode 1, write in mode 0 (twenty-fifth and twenty-sixth tries).** The baseline's raw reads show more than single bytes: about 80% of CHPP frames arrive one whole bit late (the preamble found at bit offset 1, so CHPP never sees it), which is where most ACK timeouts come from. Feedback delay 3 at 8 bits changed nothing (57 bad checksums, same split of offsets). A test module that switches `spi->mode` per transfer (read-only transfers in mode 1, writes in mode 0; spi-s3c64xx reconfigures on every transfer because its `cur_speed` never equals the rate asked) put every frame at bit offset 0 for the first time on the as-ported clock: short frames pass, the engine reports satellites, the watchdog fires later. Long frames (279 bytes) still fail: the first byte or two after each read's chip select are damaged (in one string Kepler resent, the byte after a 60-byte boundary read `6` in one copy and `8` in the next, and `11 00 11` became `41`). 60-byte reads, so spi-s3c64xx never splits a read, didn't change that. Two resets came from the modem side, not the SPI: after Kepler's watchdog resets, gnssd reloads the image over the CP's PCIe link (`IOCTL_READ_GNSS_IMAGE`, then "PHY isolated"), and the SoC reset within a second (03:15, and 02:43 after the hs60 run). Frequent Kepler resets are therefore a crash risk until the link is fixed; keep GNSS runs short. Separately, two boots reset at about 34 s, right after Bluetooth started (01:41, 03:03), before any GNSS step. + +**Stock's clock, tried (twenty-fourth try):** Google's zuma CMU table (`cmucal-vclk.c`, `div_clk_hsi0_usix_12mhz_lut_params` = div 1, mux 1) makes USI3's 12 MHz from OSCCLK / 2 (12.288 MHz, a 3.07 MHz SPI clock). A test module set exactly that (mux to OSCCLK, divider held at /2, 8-bit, delay 0). Framing broke as in the other OSCCLK try: Kepler resent one frame (`68 43 00 20 01 00 0a ...`) for seconds, and every copy arrived shifted by the same 4 bits across many separate reads, then by 5, then 6. So Kepler's bit counter runs on across chip-select cycles, and on OSCCLK it gains or loses clocks; on the 399.36 MHz parent (baseline, 6.24 MHz) the frames stay at bit 0 and only single bytes are misread. A clk-zumapro change that lets USI3 reach OSCCLK / 2 is drafted (`~/android/mainline/wt-spi-word`, not built) but not worth a kernel until the slip is understood; it would reproduce this test. The palmtop is on the baseline again. + ### Suspend with the modem on (2026-10-27, early morning, same kernel) - **What ran:** s2idle on `7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty` From d0fd5ac0f79a3c3eacb3eba50bb4234dff3b5430 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 04:32:40 -0647 Subject: [PATCH 03/26] MODEM-PLAN: GNSS G3, bytes lost at each chip-select release Kepler resends frames, so the copies can be compared. In mode 1, long frames lose the same bytes at every 64-byte read boundary. --- device/tegu/MODEM-PLAN.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/device/tegu/MODEM-PLAN.md b/device/tegu/MODEM-PLAN.md index 5f09a3fca..1c5a3fdda 100644 --- a/device/tegu/MODEM-PLAN.md +++ b/device/tegu/MODEM-PLAN.md @@ -725,6 +725,8 @@ The next step is the clock itself, in the kernel: let spi-s3c64xx reach 12.5 MHz **Read in mode 1, write in mode 0 (twenty-fifth and twenty-sixth tries).** The baseline's raw reads show more than single bytes: about 80% of CHPP frames arrive one whole bit late (the preamble found at bit offset 1, so CHPP never sees it), which is where most ACK timeouts come from. Feedback delay 3 at 8 bits changed nothing (57 bad checksums, same split of offsets). A test module that switches `spi->mode` per transfer (read-only transfers in mode 1, writes in mode 0; spi-s3c64xx reconfigures on every transfer because its `cur_speed` never equals the rate asked) put every frame at bit offset 0 for the first time on the as-ported clock: short frames pass, the engine reports satellites, the watchdog fires later. Long frames (279 bytes) still fail: the first byte or two after each read's chip select are damaged (in one string Kepler resent, the byte after a 60-byte boundary read `6` in one copy and `8` in the next, and `11 00 11` became `41`). 60-byte reads, so spi-s3c64xx never splits a read, didn't change that. Two resets came from the modem side, not the SPI: after Kepler's watchdog resets, gnssd reloads the image over the CP's PCIe link (`IOCTL_READ_GNSS_IMAGE`, then "PHY isolated"), and the SoC reset within a second (03:15, and 02:43 after the hs60 run). Frequent Kepler resets are therefore a crash risk until the link is fixed; keep GNSS runs short. Separately, two boots reset at about 34 s, right after Bluetooth started (01:41, 03:03), before any GNSS step. +**Where the bytes go (twenty-seventh try, mode 1 reads with 50 us chip-select setup):** 101 bad checksums (260 without the setup), and the palmtop stayed up through 14 Kepler watchdog resets with omamobile-modem 0.1.9's slower CP watcher (#148). Comparing the copies Kepler resends: short frames inside one 64-byte read agree byte for byte, and every copy of a long frame loses the same one or two bytes at each 64-byte read boundary (`11 00 11 00 10 00 01` read as `11 00 00 | 00 01`, `00 00 31 2e 30 2e 30` as `00 00 2e | 2e 30`). So in mode 1 Kepler's stream drops bytes when chip select is released between reads, deterministically, not by timing. In the as-ported mode 0 the copies disagree mostly at byte 63, the one-byte tail spi-s3c64xx splits off each 64-byte read. Next: hold chip select across rx_work's consecutive reads of one Kepler message (one long transfer while gnss2ap stays high), which also removes the split. + **Stock's clock, tried (twenty-fourth try):** Google's zuma CMU table (`cmucal-vclk.c`, `div_clk_hsi0_usix_12mhz_lut_params` = div 1, mux 1) makes USI3's 12 MHz from OSCCLK / 2 (12.288 MHz, a 3.07 MHz SPI clock). A test module set exactly that (mux to OSCCLK, divider held at /2, 8-bit, delay 0). Framing broke as in the other OSCCLK try: Kepler resent one frame (`68 43 00 20 01 00 0a ...`) for seconds, and every copy arrived shifted by the same 4 bits across many separate reads, then by 5, then 6. So Kepler's bit counter runs on across chip-select cycles, and on OSCCLK it gains or loses clocks; on the 399.36 MHz parent (baseline, 6.24 MHz) the frames stay at bit 0 and only single bytes are misread. A clk-zumapro change that lets USI3 reach OSCCLK / 2 is drafted (`~/android/mainline/wt-spi-word`, not built) but not worth a kernel until the slip is understood; it would reproduce this test. The palmtop is on the baseline again. ### Suspend with the modem on (2026-10-27, early morning, same kernel) From b342e97680d080100ca114072894f7c5c5abc8c9 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 04:40:14 -0647 Subject: [PATCH 04/26] MODEM-PLAN: GNSS G3, chip select held across a message Holding chip select between Kepler's reads ends long frames in zeros, so Kepler wants it released between reads, as stock does. --- device/tegu/MODEM-PLAN.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/device/tegu/MODEM-PLAN.md b/device/tegu/MODEM-PLAN.md index 1c5a3fdda..d319ae9c0 100644 --- a/device/tegu/MODEM-PLAN.md +++ b/device/tegu/MODEM-PLAN.md @@ -727,6 +727,8 @@ The next step is the clock itself, in the kernel: let spi-s3c64xx reach 12.5 MHz **Where the bytes go (twenty-seventh try, mode 1 reads with 50 us chip-select setup):** 101 bad checksums (260 without the setup), and the palmtop stayed up through 14 Kepler watchdog resets with omamobile-modem 0.1.9's slower CP watcher (#148). Comparing the copies Kepler resends: short frames inside one 64-byte read agree byte for byte, and every copy of a long frame loses the same one or two bytes at each 64-byte read boundary (`11 00 11 00 10 00 01` read as `11 00 00 | 00 01`, `00 00 31 2e 30 2e 30` as `00 00 2e | 2e 30`). So in mode 1 Kepler's stream drops bytes when chip select is released between reads, deterministically, not by timing. In the as-ported mode 0 the copies disagree mostly at byte 63, the one-byte tail spi-s3c64xx splits off each 64-byte read. Next: hold chip select across rx_work's consecutive reads of one Kepler message (one long transfer while gnss2ap stays high), which also removes the split. +**Chip select held across a message (twenty-eighth try):** mode 1 reads with chip select kept asserted between rx_work's reads (released when gnss2ap drops or before a write) made it worse: 292 bad checksums, and the 279-byte frames now end in zeros (footer 0). Kepler wants chip select released between its 64-byte reads, as stock does, so the bytes lost at each release in the mode 1 tries have another cause. What's left untried needs stock evidence: a logic-analyzer capture of stock's SPI21 (CS, SCLK, MISO timing between reads), or stock's register state for SPI21 and CMU_HSI0 USI3 while GNSS runs. + **Stock's clock, tried (twenty-fourth try):** Google's zuma CMU table (`cmucal-vclk.c`, `div_clk_hsi0_usix_12mhz_lut_params` = div 1, mux 1) makes USI3's 12 MHz from OSCCLK / 2 (12.288 MHz, a 3.07 MHz SPI clock). A test module set exactly that (mux to OSCCLK, divider held at /2, 8-bit, delay 0). Framing broke as in the other OSCCLK try: Kepler resent one frame (`68 43 00 20 01 00 0a ...`) for seconds, and every copy arrived shifted by the same 4 bits across many separate reads, then by 5, then 6. So Kepler's bit counter runs on across chip-select cycles, and on OSCCLK it gains or loses clocks; on the 399.36 MHz parent (baseline, 6.24 MHz) the frames stay at bit 0 and only single bytes are misread. A clk-zumapro change that lets USI3 reach OSCCLK / 2 is drafted (`~/android/mainline/wt-spi-word`, not built) but not worth a kernel until the slip is understood; it would reproduce this test. The palmtop is on the baseline again. ### Suspend with the modem on (2026-10-27, early morning, same kernel) From 3a8619aa2673b246861984bcddaca15d7a6ac657 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 05:05:08 -0647 Subject: [PATCH 05/26] MODEM-PLAN: GNSS G3, Kepler one bit late at feedback delay 3 With feedback delay 3 Kepler's frames are intact but one bit late. A per-read realignment gives clean short frames and satellites; long frames still lose data at each chip-select release. --- device/tegu/MODEM-PLAN.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/device/tegu/MODEM-PLAN.md b/device/tegu/MODEM-PLAN.md index d319ae9c0..1a245afd2 100644 --- a/device/tegu/MODEM-PLAN.md +++ b/device/tegu/MODEM-PLAN.md @@ -729,6 +729,8 @@ The next step is the clock itself, in the kernel: let spi-s3c64xx reach 12.5 MHz **Chip select held across a message (twenty-eighth try):** mode 1 reads with chip select kept asserted between rx_work's reads (released when gnss2ap drops or before a write) made it worse: 292 bad checksums, and the 279-byte frames now end in zeros (footer 0). Kepler wants chip select released between its 64-byte reads, as stock does, so the bytes lost at each release in the mode 1 tries have another cause. What's left untried needs stock evidence: a logic-analyzer capture of stock's SPI21 (CS, SCLK, MISO timing between reads), or stock's register state for SPI21 and CMU_HSI0 USI3 while GNSS runs. +**One bit late, cleanly, with feedback delay 3 (twenty-ninth to thirty-second tries, offline checks on the saved reads with CHPP's CRC32 over the 8-byte header and payload):** at feedback delay 3 (mode 0, 8 bits, the as-ported clock) Kepler's frames are intact but one bit late: shifting the reads left one bit turns 11 valid frames into 123 (at delay 2 the same shift recovers nothing). Kepler is on time just after it starts and one bit late later, so a fixed shift lost its first RESET-ACKs for 2 s and set off a reset storm (125 RESETs from Kepler, 144 RESET-ACKs from gnssd); delaying our writes by one bit as well killed the link outright, so writes are right as they are. A per-read choice (a preamble at bit 0 keeps the read, at bit 1 shifts it, a read without one keeps the last choice) gives clean short frames and the engine reporting satellites, but 279- and 361-byte frames still fail: setting the one dropped bit at each 64-byte boundary every possible way repairs none of them, so more than a bit goes missing at each chip-select release, as in the mode 1 tries. The test module (`gnss_spi.c` with `fb_delay`, `realign`, `rx_cpha`, `hold`, `osc`, `div` parameters) is on maclab in `~/tegu/gnssif-realign`; the palmtop is back on the baseline. + **Stock's clock, tried (twenty-fourth try):** Google's zuma CMU table (`cmucal-vclk.c`, `div_clk_hsi0_usix_12mhz_lut_params` = div 1, mux 1) makes USI3's 12 MHz from OSCCLK / 2 (12.288 MHz, a 3.07 MHz SPI clock). A test module set exactly that (mux to OSCCLK, divider held at /2, 8-bit, delay 0). Framing broke as in the other OSCCLK try: Kepler resent one frame (`68 43 00 20 01 00 0a ...`) for seconds, and every copy arrived shifted by the same 4 bits across many separate reads, then by 5, then 6. So Kepler's bit counter runs on across chip-select cycles, and on OSCCLK it gains or loses clocks; on the 399.36 MHz parent (baseline, 6.24 MHz) the frames stay at bit 0 and only single bytes are misread. A clk-zumapro change that lets USI3 reach OSCCLK / 2 is drafted (`~/android/mainline/wt-spi-word`, not built) but not worth a kernel until the slip is understood; it would reproduce this test. The palmtop is on the baseline again. ### Suspend with the modem on (2026-10-27, early morning, same kernel) From bcda1c52b2e3b7ac2e7887968b6131aedf033134 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 05:18:30 -0647 Subject: [PATCH 06/26] MODEM-PLAN: GNSS G3, stock's clock read correctly, and the link hang At stock's clock Kepler's frames are intact but its bit offset drifts with every transfer, more as the clock slows. The CP link hang came back with the slower watcher, so it remains open. --- device/tegu/MODEM-PLAN.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/device/tegu/MODEM-PLAN.md b/device/tegu/MODEM-PLAN.md index 1a245afd2..3c9fcdcee 100644 --- a/device/tegu/MODEM-PLAN.md +++ b/device/tegu/MODEM-PLAN.md @@ -731,6 +731,8 @@ The next step is the clock itself, in the kernel: let spi-s3c64xx reach 12.5 MHz **One bit late, cleanly, with feedback delay 3 (twenty-ninth to thirty-second tries, offline checks on the saved reads with CHPP's CRC32 over the 8-byte header and payload):** at feedback delay 3 (mode 0, 8 bits, the as-ported clock) Kepler's frames are intact but one bit late: shifting the reads left one bit turns 11 valid frames into 123 (at delay 2 the same shift recovers nothing). Kepler is on time just after it starts and one bit late later, so a fixed shift lost its first RESET-ACKs for 2 s and set off a reset storm (125 RESETs from Kepler, 144 RESET-ACKs from gnssd); delaying our writes by one bit as well killed the link outright, so writes are right as they are. A per-read choice (a preamble at bit 0 keeps the read, at bit 1 shifts it, a read without one keeps the last choice) gives clean short frames and the engine reporting satellites, but 279- and 361-byte frames still fail: setting the one dropped bit at each 64-byte boundary every possible way repairs none of them, so more than a bit goes missing at each chip-select release, as in the mode 1 tries. The test module (`gnss_spi.c` with `fb_delay`, `realign`, `rx_cpha`, `hold`, `osc`, `div` parameters) is on maclab in `~/tegu/gnssif-realign`; the palmtop is back on the baseline. +**Stock's clock again, read correctly (thirty-third and thirty-fourth tries):** the OSCCLK frames are not garbled: every read that holds a frame has a valid one at some bit shift (offline: 32 of 33 valid when each read is shifted to its preamble). But at OSCCLK / 2 (3.07 MHz) Kepler's bit offset walks by one or two bits about every 100 ms (0, 2, 3, 5, 6, 7, 0, 1, 3 in the first second), roughly a clock edge gained or lost per transfer; with the offset tracked per read and our writes delayed by it, 20 frames came through clean but Kepler only answered RESETs. At OSCCLK / 1 (6.14 MHz) the offset changed twice in 100 s. So the drift grows as the clock slows, the opposite of a too-fast slave; a clock edge seen twice (or a glitch) at each transfer's start or stop would fit. The 05:02 reset (CLUSTER0_NONCPU_WDTRESET) came with #148's watcher installed: in its last minute the CP link cycled twice a second in step with gnssd's `IOCTL_LOAD_GNSS_IMAGE` calls, so the watcher was one source of link cycling, not the only one, and the hang (CPIF's link power-down racing an access, presumably) is still open. Keep GNSS runs short until it is fixed. + **Stock's clock, tried (twenty-fourth try):** Google's zuma CMU table (`cmucal-vclk.c`, `div_clk_hsi0_usix_12mhz_lut_params` = div 1, mux 1) makes USI3's 12 MHz from OSCCLK / 2 (12.288 MHz, a 3.07 MHz SPI clock). A test module set exactly that (mux to OSCCLK, divider held at /2, 8-bit, delay 0). Framing broke as in the other OSCCLK try: Kepler resent one frame (`68 43 00 20 01 00 0a ...`) for seconds, and every copy arrived shifted by the same 4 bits across many separate reads, then by 5, then 6. So Kepler's bit counter runs on across chip-select cycles, and on OSCCLK it gains or loses clocks; on the 399.36 MHz parent (baseline, 6.24 MHz) the frames stay at bit 0 and only single bytes are misread. A clk-zumapro change that lets USI3 reach OSCCLK / 2 is drafted (`~/android/mainline/wt-spi-word`, not built) but not worth a kernel until the slip is understood; it would reproduce this test. The palmtop is on the baseline again. ### Suspend with the modem on (2026-10-27, early morning, same kernel) From a12fd6059f3a2138a32aa02f018f3d8f088ed37a Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 05:41:46 -0647 Subject: [PATCH 07/26] MODEM-PLAN: the CP link hang, read from the CPIF source The doorbell writes into the CP's BAR with no lock held across its link check, and the PCIe power-off clears pcie_powered_on outside the transmit lock, so a doorbell can land while the PHY goes into isolation. --- device/tegu/MODEM-PLAN.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/device/tegu/MODEM-PLAN.md b/device/tegu/MODEM-PLAN.md index 3c9fcdcee..57e2f59e1 100644 --- a/device/tegu/MODEM-PLAN.md +++ b/device/tegu/MODEM-PLAN.md @@ -733,6 +733,8 @@ The next step is the clock itself, in the kernel: let spi-s3c64xx reach 12.5 MHz **Stock's clock again, read correctly (thirty-third and thirty-fourth tries):** the OSCCLK frames are not garbled: every read that holds a frame has a valid one at some bit shift (offline: 32 of 33 valid when each read is shifted to its preamble). But at OSCCLK / 2 (3.07 MHz) Kepler's bit offset walks by one or two bits about every 100 ms (0, 2, 3, 5, 6, 7, 0, 1, 3 in the first second), roughly a clock edge gained or lost per transfer; with the offset tracked per read and our writes delayed by it, 20 frames came through clean but Kepler only answered RESETs. At OSCCLK / 1 (6.14 MHz) the offset changed twice in 100 s. So the drift grows as the clock slows, the opposite of a too-fast slave; a clock edge seen twice (or a glitch) at each transfer's start or stop would fit. The 05:02 reset (CLUSTER0_NONCPU_WDTRESET) came with #148's watcher installed: in its last minute the CP link cycled twice a second in step with gnssd's `IOCTL_LOAD_GNSS_IMAGE` calls, so the watcher was one source of link cycling, not the only one, and the hang (CPIF's link power-down racing an access, presumably) is still open. Keep GNSS runs short until it is fixed. +**The CP link hang, read from the source (offline):** our `tegu-pcie0-cp` guards DBI and configuration space while the PHY is isolated (accesses return 0 or are dropped), but not the CP's BAR window, which CPIF uses for doorbells and the MSI registers. In CPIF (`s51xx_pcie_send_doorbell_int()`), the doorbell checks the link and then `iowrite32()`s into the BAR with no lock held across. The main sender (`link_device.c`) is safe: it takes `pcie_tx_lock`, sees `pcie_onoff_lock` held during a power-off and reserves the doorbell instead. But `s5100_poweroff_pcie()` clears `pcie_powered_on` outside `pcie_tx_lock`, and it only takes that lock briefly at the start to wait for a running transmit, so a sender that took the lock just before the power-off mutexes can ring the doorbell while the PHY goes into isolation. `IOCTL_LOAD_GNSS_IMAGE` itself only copies into the GNSS_FW carve-out in AP memory (no link access); the reloads matter because the Kepler reset around them makes IPC traffic, so the link wakes and idles twice a second. Next, hands-free but at the price of watchdog resets: a counter or trace at each BAR access in CPIF and at `cp_phy_isolate()`, to see which access lands after isolation; or the narrow fix of making `tegu-pcie0-cp` refuse isolation while CPIF holds `pcie_tx_lock` (a hook), which needs a CPIF change either way. + **Stock's clock, tried (twenty-fourth try):** Google's zuma CMU table (`cmucal-vclk.c`, `div_clk_hsi0_usix_12mhz_lut_params` = div 1, mux 1) makes USI3's 12 MHz from OSCCLK / 2 (12.288 MHz, a 3.07 MHz SPI clock). A test module set exactly that (mux to OSCCLK, divider held at /2, 8-bit, delay 0). Framing broke as in the other OSCCLK try: Kepler resent one frame (`68 43 00 20 01 00 0a ...`) for seconds, and every copy arrived shifted by the same 4 bits across many separate reads, then by 5, then 6. So Kepler's bit counter runs on across chip-select cycles, and on OSCCLK it gains or loses clocks; on the 399.36 MHz parent (baseline, 6.24 MHz) the frames stay at bit 0 and only single bytes are misread. A clk-zumapro change that lets USI3 reach OSCCLK / 2 is drafted (`~/android/mainline/wt-spi-word`, not built) but not worth a kernel until the slip is understood; it would reproduce this test. The palmtop is on the baseline again. ### Suspend with the modem on (2026-10-27, early morning, same kernel) From 0dacd9397d9c9d8dbc3c366672be5f41dcd77450 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 05:42:07 -0647 Subject: [PATCH 08/26] MODEM-PLAN: correct the CP link hang reading The doorbell path is serialized with the PCIe power-off after all; no unguarded BAR access found by reading. --- device/tegu/MODEM-PLAN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/tegu/MODEM-PLAN.md b/device/tegu/MODEM-PLAN.md index 57e2f59e1..712017956 100644 --- a/device/tegu/MODEM-PLAN.md +++ b/device/tegu/MODEM-PLAN.md @@ -733,7 +733,7 @@ The next step is the clock itself, in the kernel: let spi-s3c64xx reach 12.5 MHz **Stock's clock again, read correctly (thirty-third and thirty-fourth tries):** the OSCCLK frames are not garbled: every read that holds a frame has a valid one at some bit shift (offline: 32 of 33 valid when each read is shifted to its preamble). But at OSCCLK / 2 (3.07 MHz) Kepler's bit offset walks by one or two bits about every 100 ms (0, 2, 3, 5, 6, 7, 0, 1, 3 in the first second), roughly a clock edge gained or lost per transfer; with the offset tracked per read and our writes delayed by it, 20 frames came through clean but Kepler only answered RESETs. At OSCCLK / 1 (6.14 MHz) the offset changed twice in 100 s. So the drift grows as the clock slows, the opposite of a too-fast slave; a clock edge seen twice (or a glitch) at each transfer's start or stop would fit. The 05:02 reset (CLUSTER0_NONCPU_WDTRESET) came with #148's watcher installed: in its last minute the CP link cycled twice a second in step with gnssd's `IOCTL_LOAD_GNSS_IMAGE` calls, so the watcher was one source of link cycling, not the only one, and the hang (CPIF's link power-down racing an access, presumably) is still open. Keep GNSS runs short until it is fixed. -**The CP link hang, read from the source (offline):** our `tegu-pcie0-cp` guards DBI and configuration space while the PHY is isolated (accesses return 0 or are dropped), but not the CP's BAR window, which CPIF uses for doorbells and the MSI registers. In CPIF (`s51xx_pcie_send_doorbell_int()`), the doorbell checks the link and then `iowrite32()`s into the BAR with no lock held across. The main sender (`link_device.c`) is safe: it takes `pcie_tx_lock`, sees `pcie_onoff_lock` held during a power-off and reserves the doorbell instead. But `s5100_poweroff_pcie()` clears `pcie_powered_on` outside `pcie_tx_lock`, and it only takes that lock briefly at the start to wait for a running transmit, so a sender that took the lock just before the power-off mutexes can ring the doorbell while the PHY goes into isolation. `IOCTL_LOAD_GNSS_IMAGE` itself only copies into the GNSS_FW carve-out in AP memory (no link access); the reloads matter because the Kepler reset around them makes IPC traffic, so the link wakes and idles twice a second. Next, hands-free but at the price of watchdog resets: a counter or trace at each BAR access in CPIF and at `cp_phy_isolate()`, to see which access lands after isolation; or the narrow fix of making `tegu-pcie0-cp` refuse isolation while CPIF holds `pcie_tx_lock` (a hook), which needs a CPIF change either way. +**The CP link hang, read from the source (offline):** our `tegu-pcie0-cp` guards DBI and configuration space while the PHY is isolated (accesses return 0 or are dropped), but not the CP's BAR window, which CPIF uses for its doorbell. CPIF's main doorbell path (`link_device.c`) looks safe: it rings under `pcie_tx_lock` after checking that `pcie_onoff_lock` is free and `pcie_powered_on` is set, and `s5100_poweroff_pcie()` takes `pcie_onoff_lock` first and then waits for `pcie_tx_lock` before it powers the link down, so a doorbell either finishes before the power-off or is reserved for later. `IOCTL_LOAD_GNSS_IMAGE` only copies into the GNSS_FW carve-out in AP memory (no link access); the reloads matter because the Kepler reset around them makes IPC traffic, so the link wakes and idles twice a second. I found no unguarded BAR access by reading; the other doorbell callers (`modem_ctrl_s5100.c`) are the CP boot and the power-on path. Next, hands-free but at the price of watchdog resets: a trace at each BAR access in CPIF and at `cp_phy_isolate()`, to see which access lands after isolation. **Stock's clock, tried (twenty-fourth try):** Google's zuma CMU table (`cmucal-vclk.c`, `div_clk_hsi0_usix_12mhz_lut_params` = div 1, mux 1) makes USI3's 12 MHz from OSCCLK / 2 (12.288 MHz, a 3.07 MHz SPI clock). A test module set exactly that (mux to OSCCLK, divider held at /2, 8-bit, delay 0). Framing broke as in the other OSCCLK try: Kepler resent one frame (`68 43 00 20 01 00 0a ...`) for seconds, and every copy arrived shifted by the same 4 bits across many separate reads, then by 5, then 6. So Kepler's bit counter runs on across chip-select cycles, and on OSCCLK it gains or loses clocks; on the 399.36 MHz parent (baseline, 6.24 MHz) the frames stay at bit 0 and only single bytes are misread. A clk-zumapro change that lets USI3 reach OSCCLK / 2 is drafted (`~/android/mainline/wt-spi-word`, not built) but not worth a kernel until the slip is understood; it would reproduce this test. The palmtop is on the baseline again. From 785bdc05afa2c00db846822ea151f0b01e346c81 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 09:17:56 -0647 Subject: [PATCH 09/26] MODEM-PLAN: GNSS G3 on 10-29 morning, the clock and the cut fixed Two kernel changes give the GNSS SPI stock's 3.072 MHz and one uncut 64-byte read per block. Mode 0 reads stay marginal, mode 1 reads lose one byte per back-to-back block; a logic analyzer is the next tool. --- device/tegu/MODEM-PLAN.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/device/tegu/MODEM-PLAN.md b/device/tegu/MODEM-PLAN.md index 712017956..1eca255ca 100644 --- a/device/tegu/MODEM-PLAN.md +++ b/device/tegu/MODEM-PLAN.md @@ -735,6 +735,18 @@ The next step is the clock itself, in the kernel: let spi-s3c64xx reach 12.5 MHz **The CP link hang, read from the source (offline):** our `tegu-pcie0-cp` guards DBI and configuration space while the PHY is isolated (accesses return 0 or are dropped), but not the CP's BAR window, which CPIF uses for its doorbell. CPIF's main doorbell path (`link_device.c`) looks safe: it rings under `pcie_tx_lock` after checking that `pcie_onoff_lock` is free and `pcie_powered_on` is set, and `s5100_poweroff_pcie()` takes `pcie_onoff_lock` first and then waits for `pcie_tx_lock` before it powers the link down, so a doorbell either finishes before the power-off or is reserved for later. `IOCTL_LOAD_GNSS_IMAGE` only copies into the GNSS_FW carve-out in AP memory (no link access); the reloads matter because the Kepler reset around them makes IPC traffic, so the link wakes and idles twice a second. I found no unguarded BAR access by reading; the other doorbell callers (`modem_ctrl_s5100.c`) are the CP boot and the power-on path. Next, hands-free but at the price of watchdog resets: a trace at each BAR access in CPIF and at `cp_phy_isolate()`, to see which access lands after isolation. +### G3, the morning of 10-29: the clock fixed, the cut fixed, and what is left (thirty-fifth to forty-fourth tries) + +[V] Two kernel changes, built from the gn3 source (`~/tegu/int-dt-20261026/kernel` on maclab, the reproducible build; the first attempt from `wt-modem` carried an older USI4 clock table and broke the audio I2C) and pushed as boot images only: spi-s3c64xx no longer cuts a transfer that fills the FIFO (64 bytes in one polled piece; the 32 + 32 test had shown every frame crossing a piece boundary failing with chip select held, so the cut, not the chip-select release, lost the bytes), and clk-zumapro lets USI3 reach OSCCLK (`nMUX`, so the framework may reparent, plus `CLK_SET_RATE_PARENT` on the divider and the source gate): `zumapro_gout_hsi0_usi3_ip` now reads 12.288 MHz after the first transfer, a 3.072 MHz bus, stock's rate. Both are commits on `tegu-spi-word-pieces` (kernel PR). Graphics, audio bring-up and touch are unaffected on that kernel. The SPI block's own prescaler does not exist on this IP (CLK_CFG reads 0 and ignores writes). + +[V] Reads, with every byte dumped to the kernel log (a gnssif built with `GNSS_PKT_DEBUG`, 64 bytes per line) and short 12-second sessions so Kepler's watchdog does not pile up resets: +- Mode 0 at stock's clock is marginal at every feedback delay: the per-read detector flips between "on time" and "one bit late" within a session, and long frames fail wherever it flips. (Delay 3 at 6.24 MHz had looked stable only because the session was short.) +- Mode 1 reads (writes stay mode 0) are byte-aligned and intact, but every block after the first one of a message loses its first byte: inserting one byte (0xAA) at the first position of block 1 makes Kepler's constant version frame pass its CRC. With a 100 us chip-select setup the protocol was the healthiest seen (0 ACK timeouts, our packets acknowledged), the first-byte loss unchanged. A 500 us gap before each read made Kepler stop sending long frames; a 50 us chip-select hold did nothing. +- Padding each write to a whole 64-byte exchange (gnssif) changed nothing measurable. +- CHPP's checksum is CRC32 over the 8-byte header and the payload (checked on short frames); the tools are in `/tmp/w32p32` on fw12 and the captures in `logs/tegu-gnss-w32-20261029/`. + +So with the clock and the cut right, what is left is one byte per back-to-back chip-select cycle in mode 1, or a half-bit sampling margin in mode 0, which is exactly the kind of question a logic analyzer on SPI21's SCLK, CS and MISO answers in a minute and software guessing does not. The palmtop runs the new kernel with the as-ported modules. The resets during this morning's sessions were mostly the curated startup's 150 s dead-man after its own false-positive fault check (an `OF: overlay: WARNING` line), rebooting through `reboot-to bootloader`; a few hard resets with no record in pstore remain unexplained (`logs/morning-20261029.md` item 7). + **Stock's clock, tried (twenty-fourth try):** Google's zuma CMU table (`cmucal-vclk.c`, `div_clk_hsi0_usix_12mhz_lut_params` = div 1, mux 1) makes USI3's 12 MHz from OSCCLK / 2 (12.288 MHz, a 3.07 MHz SPI clock). A test module set exactly that (mux to OSCCLK, divider held at /2, 8-bit, delay 0). Framing broke as in the other OSCCLK try: Kepler resent one frame (`68 43 00 20 01 00 0a ...`) for seconds, and every copy arrived shifted by the same 4 bits across many separate reads, then by 5, then 6. So Kepler's bit counter runs on across chip-select cycles, and on OSCCLK it gains or loses clocks; on the 399.36 MHz parent (baseline, 6.24 MHz) the frames stay at bit 0 and only single bytes are misread. A clk-zumapro change that lets USI3 reach OSCCLK / 2 is drafted (`~/android/mainline/wt-spi-word`, not built) but not worth a kernel until the slip is understood; it would reproduce this test. The palmtop is on the baseline again. ### Suspend with the modem on (2026-10-27, early morning, same kernel) From 7de735fc3445653cd8849b8dc4b47a4d13dc5668 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 09:34:02 -0647 Subject: [PATCH 10/26] MODEM-PLAN: GNSS G3 parked without a hardware probe --- device/tegu/MODEM-PLAN.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/device/tegu/MODEM-PLAN.md b/device/tegu/MODEM-PLAN.md index 1eca255ca..35011a7e6 100644 --- a/device/tegu/MODEM-PLAN.md +++ b/device/tegu/MODEM-PLAN.md @@ -747,6 +747,8 @@ The next step is the clock itself, in the kernel: let spi-s3c64xx reach 12.5 MHz So with the clock and the cut right, what is left is one byte per back-to-back chip-select cycle in mode 1, or a half-bit sampling margin in mode 0, which is exactly the kind of question a logic analyzer on SPI21's SCLK, CS and MISO answers in a minute and software guessing does not. The palmtop runs the new kernel with the as-ported modules. The resets during this morning's sessions were mostly the curated startup's 150 s dead-man after its own false-positive fault check (an `OF: overlay: WARNING` line), rebooting through `reboot-to bootloader`; a few hard resets with no record in pstore remain unexplained (`logs/morning-20261029.md` item 7). +**Parked (2026-10-29, the owner's decision):** no logic analyzer, and no more module-level guessing. The two kernel changes stay (kernel PR #135); the as-ported gnssif and gnss_spi run on the palmtop. GNSS resumes when either a stock capture of SPI21's timing or a new idea about the first byte of a back-to-back block turns up. + **Stock's clock, tried (twenty-fourth try):** Google's zuma CMU table (`cmucal-vclk.c`, `div_clk_hsi0_usix_12mhz_lut_params` = div 1, mux 1) makes USI3's 12 MHz from OSCCLK / 2 (12.288 MHz, a 3.07 MHz SPI clock). A test module set exactly that (mux to OSCCLK, divider held at /2, 8-bit, delay 0). Framing broke as in the other OSCCLK try: Kepler resent one frame (`68 43 00 20 01 00 0a ...`) for seconds, and every copy arrived shifted by the same 4 bits across many separate reads, then by 5, then 6. So Kepler's bit counter runs on across chip-select cycles, and on OSCCLK it gains or loses clocks; on the 399.36 MHz parent (baseline, 6.24 MHz) the frames stay at bit 0 and only single bytes are misread. A clk-zumapro change that lets USI3 reach OSCCLK / 2 is drafted (`~/android/mainline/wt-spi-word`, not built) but not worth a kernel until the slip is understood; it would reproduce this test. The palmtop is on the baseline again. ### Suspend with the modem on (2026-10-27, early morning, same kernel) From bd24a2d9f2a8e75f5086f7413b14afbdc3b789e2 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 10:01:52 -0647 Subject: [PATCH 11/26] device/tegu MODEM-PLAN: one copy of the twenty-fourth try, headings for the night, the link-hang trace gated The paragraph on the twenty-fourth try was in twice; the second copy goes. The small hours' section held tries 24-34 and the CP link analysis under the "fifteenth to twenty-third tries" heading, so they get their own. The trace at each BAR access in CPIF, written as a hands-free next step, is now G3-L1: attended, on the charger, with Expect, Stop, a cap on resets, Rollback and risk, and the tracing change on a kernel branch before it boots. It only runs if GNSS is resumed; the status line now says GNSS is parked. Placeholders mark where the bring-up branch and the partition check go. --- device/tegu/MODEM-PLAN.md | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/device/tegu/MODEM-PLAN.md b/device/tegu/MODEM-PLAN.md index 35011a7e6..2c17709b2 100644 --- a/device/tegu/MODEM-PLAN.md +++ b/device/tegu/MODEM-PLAN.md @@ -7,8 +7,12 @@ modem's cp2ap lines) is bound with its EINTs in the base DT trains Gen1 x1 and enumerates as 144d:a5a5; M3-M5 passed: CPIF and cbd boot it to **ONLINE** (Gen3 x2) with working IPC (pktproc), no SIM yet; G1-G2 passed: gnssd loads Kepler's firmware and talks CHPP over SPI; -G3 partial: our HAL client starts sessions, but Kepler's core faults at -engine start. Next: a stock GNSS capture, IOCC, the SIM. +G3 partial: our HAL client starts sessions and the engine tracks +satellites, but the CHPP link over the GNSS SPI loses bytes and gnssd's +own watchdog resets Kepler (the "hardfault"); the clock and the transfer +cut are fixed in the kernel (2026-10-29), and GNSS is parked without a +hardware probe (the owner's decision, 2026-10-29). The CP link hang with +frequent Kepler resets is open. Next: a stock GNSS capture, IOCC, the SIM. The staged plan (sections F, K, U and runbooks M0.2-M6, G1-G4) is below, with each step's results under it. Kernel branches `omamobile-tegu-modem` and `omamobile-tegu-gnssif` (section K). @@ -721,6 +725,8 @@ What the raw bytes show: The next step is the clock itself, in the kernel: let spi-s3c64xx reach 12.5 MHz on USI3 (3.125 MHz SPI) from a parent that can give it, as stock does, with nothing else changed. The OSCCLK try isn't a fair test of that (24.576 / 4, about 1.5 MHz, switched behind the clock framework's back). The palmtop is back on the baseline (`gnss_spi` aa4618bb, `gnssif` eb0f3d9a, gn3 DTB, no debug overlay). One reset at 348 s, after the hs60 run had ended, came during modem PCIe link activity ("PHY isolated"), not in the SPI path. +### G3, twenty-fourth to thirty-fourth tries: stock's clock, mode 1 reads, where the bytes go (2026-10-29, small hours) + **Stock's clock, tried (twenty-fourth try):** Google's zuma CMU table (`cmucal-vclk.c`, `div_clk_hsi0_usix_12mhz_lut_params` = div 1, mux 1) makes USI3's 12 MHz from OSCCLK / 2 (12.288 MHz, a 3.07 MHz SPI clock). A test module set exactly that (mux to OSCCLK, divider held at /2, 8-bit, delay 0). Framing broke as in the other OSCCLK try: Kepler resent one frame (`68 43 00 20 01 00 0a ...`) for seconds, and every copy arrived shifted by the same 4 bits across many separate reads, then by 5, then 6. So Kepler's bit counter runs on across chip-select cycles, and on OSCCLK it gains or loses clocks; on the 399.36 MHz parent (baseline, 6.24 MHz) the frames stay at bit 0 and only single bytes are misread. A clk-zumapro change that lets USI3 reach OSCCLK / 2 is drafted (`~/android/mainline/wt-spi-word`, not built) but not worth a kernel until the slip is understood; it would reproduce this test. The palmtop is on the baseline again. **Read in mode 1, write in mode 0 (twenty-fifth and twenty-sixth tries).** The baseline's raw reads show more than single bytes: about 80% of CHPP frames arrive one whole bit late (the preamble found at bit offset 1, so CHPP never sees it), which is where most ACK timeouts come from. Feedback delay 3 at 8 bits changed nothing (57 bad checksums, same split of offsets). A test module that switches `spi->mode` per transfer (read-only transfers in mode 1, writes in mode 0; spi-s3c64xx reconfigures on every transfer because its `cur_speed` never equals the rate asked) put every frame at bit offset 0 for the first time on the as-ported clock: short frames pass, the engine reports satellites, the watchdog fires later. Long frames (279 bytes) still fail: the first byte or two after each read's chip select are damaged (in one string Kepler resent, the byte after a 60-byte boundary read `6` in one copy and `8` in the next, and `11 00 11` became `41`). 60-byte reads, so spi-s3c64xx never splits a read, didn't change that. Two resets came from the modem side, not the SPI: after Kepler's watchdog resets, gnssd reloads the image over the CP's PCIe link (`IOCTL_READ_GNSS_IMAGE`, then "PHY isolated"), and the SoC reset within a second (03:15, and 02:43 after the hs60 run). Frequent Kepler resets are therefore a crash risk until the link is fixed; keep GNSS runs short. Separately, two boots reset at about 34 s, right after Bluetooth started (01:41, 03:03), before any GNSS step. @@ -733,7 +739,11 @@ The next step is the clock itself, in the kernel: let spi-s3c64xx reach 12.5 MHz **Stock's clock again, read correctly (thirty-third and thirty-fourth tries):** the OSCCLK frames are not garbled: every read that holds a frame has a valid one at some bit shift (offline: 32 of 33 valid when each read is shifted to its preamble). But at OSCCLK / 2 (3.07 MHz) Kepler's bit offset walks by one or two bits about every 100 ms (0, 2, 3, 5, 6, 7, 0, 1, 3 in the first second), roughly a clock edge gained or lost per transfer; with the offset tracked per read and our writes delayed by it, 20 frames came through clean but Kepler only answered RESETs. At OSCCLK / 1 (6.14 MHz) the offset changed twice in 100 s. So the drift grows as the clock slows, the opposite of a too-fast slave; a clock edge seen twice (or a glitch) at each transfer's start or stop would fit. The 05:02 reset (CLUSTER0_NONCPU_WDTRESET) came with #148's watcher installed: in its last minute the CP link cycled twice a second in step with gnssd's `IOCTL_LOAD_GNSS_IMAGE` calls, so the watcher was one source of link cycling, not the only one, and the hang (CPIF's link power-down racing an access, presumably) is still open. Keep GNSS runs short until it is fixed. -**The CP link hang, read from the source (offline):** our `tegu-pcie0-cp` guards DBI and configuration space while the PHY is isolated (accesses return 0 or are dropped), but not the CP's BAR window, which CPIF uses for its doorbell. CPIF's main doorbell path (`link_device.c`) looks safe: it rings under `pcie_tx_lock` after checking that `pcie_onoff_lock` is free and `pcie_powered_on` is set, and `s5100_poweroff_pcie()` takes `pcie_onoff_lock` first and then waits for `pcie_tx_lock` before it powers the link down, so a doorbell either finishes before the power-off or is reserved for later. `IOCTL_LOAD_GNSS_IMAGE` only copies into the GNSS_FW carve-out in AP memory (no link access); the reloads matter because the Kepler reset around them makes IPC traffic, so the link wakes and idles twice a second. I found no unguarded BAR access by reading; the other doorbell callers (`modem_ctrl_s5100.c`) are the CP boot and the power-on path. Next, hands-free but at the price of watchdog resets: a trace at each BAR access in CPIF and at `cp_phy_isolate()`, to see which access lands after isolation. +### The CP link hang (2026-10-29, read from the CPIF source, offline) + +**The CP link hang, read from the source (offline):** our `tegu-pcie0-cp` guards DBI and configuration space while the PHY is isolated (accesses return 0 or are dropped), but not the CP's BAR window, which CPIF uses for its doorbell. CPIF's main doorbell path (`link_device.c`) looks safe: it rings under `pcie_tx_lock` after checking that `pcie_onoff_lock` is free and `pcie_powered_on` is set, and `s5100_poweroff_pcie()` takes `pcie_onoff_lock` first and then waits for `pcie_tx_lock` before it powers the link down, so a doorbell either finishes before the power-off or is reserved for later. `IOCTL_LOAD_GNSS_IMAGE` only copies into the GNSS_FW carve-out in AP memory (no link access); the reloads matter because the Kepler reset around them makes IPC traffic, so the link wakes and idles twice a second. I found no unguarded BAR access by reading; the other doorbell callers (`modem_ctrl_s5100.c`) are the CP boot and the power-on path. The step that would find it is below, gated; it has not run, and GNSS is parked (see "Parked" under the morning of 10-29), so it runs only if GNSS is ever resumed. + +**G3-L1: which BAR access lands after isolation (attended, on the charger; risk: medium-high).** A trace at each BAR access in CPIF and at `cp_phy_isolate()` (the caller, the lock state and `pcie_powered_on` in the kernel log), to see which access lands after isolation. The tracing change goes on a kernel branch first (`omamobile-tegu-modem`, or a bring-up branch on the fork, linked by commit), is built there and reaches slot B through `bin/omamobile push`; nothing is patched on the palmtop by hand, and the kernel never boots before the branch is pushed. Before the step: M0.1's partition check, the kmsg stream to the laptop with `--watchdog`, the palmtop on the charger with someone at it the whole time, and a 12-second GNSS session (as the morning's) to bring on Kepler's watchdog resets and the link cycling. Expect: the log names the access that follows `cp_phy_isolate()`, or the link cycles through Kepler's resets without a hang. Stop: two SoC resets (a hang with no record in pstore counts as one), or any `ufshcd_err_handler` line in dmesg, or an NV partition that reads `ro=0` or mounted; after a stop, no further boot of the tracing kernel that day. Cap: two resets per session and three sessions in all, then the step is closed and the hang waits for a stock capture. Rollback: `bin/omamobile push` of the previous images (the gn3 kernel), then M0.1 again, as after any reset with the modem up. Risk: medium-high, because each reset is a hang with the modem up, which has been followed by a recovered UFS error-handler pass on cheetah; the partition check afterwards is not optional. ### G3, the morning of 10-29: the clock fixed, the cut fixed, and what is left (thirty-fifth to forty-fourth tries) @@ -747,9 +757,11 @@ The next step is the clock itself, in the kernel: let spi-s3c64xx reach 12.5 MHz So with the clock and the cut right, what is left is one byte per back-to-back chip-select cycle in mode 1, or a half-bit sampling margin in mode 0, which is exactly the kind of question a logic analyzer on SPI21's SCLK, CS and MISO answers in a minute and software guessing does not. The palmtop runs the new kernel with the as-ported modules. The resets during this morning's sessions were mostly the curated startup's 150 s dead-man after its own false-positive fault check (an `OF: overlay: WARNING` line), rebooting through `reboot-to bootloader`; a few hard resets with no record in pstore remain unexplained (`logs/morning-20261029.md` item 7). -**Parked (2026-10-29, the owner's decision):** no logic analyzer, and no more module-level guessing. The two kernel changes stay (kernel PR #135); the as-ported gnssif and gnss_spi run on the palmtop. GNSS resumes when either a stock capture of SPI21's timing or a new idea about the first byte of a back-to-back block turns up. +**The night's test code and the partition check** (the maintainer's points 4 and 5 on #138): +- bring-up branch: (the `gnss_spi.ko` builds with the `fb_delay`, `realign`, `rx_cpha`, `hold`, `osc` and `div` parameters, the module that registered `pdma1` and ran the PL330 memcpy, the module that set USI3's mux and divider behind the clock framework, the per-transfer `spi->mode` switch, the DTBs with the `pdma1` node and with auto CS, and how each test DTB reached slot B). +- partition check: (`efs`, `efs_backup`, `modem_userdata` and `persist` against the backup, as M0.1, after the night's sessions and resets). -**Stock's clock, tried (twenty-fourth try):** Google's zuma CMU table (`cmucal-vclk.c`, `div_clk_hsi0_usix_12mhz_lut_params` = div 1, mux 1) makes USI3's 12 MHz from OSCCLK / 2 (12.288 MHz, a 3.07 MHz SPI clock). A test module set exactly that (mux to OSCCLK, divider held at /2, 8-bit, delay 0). Framing broke as in the other OSCCLK try: Kepler resent one frame (`68 43 00 20 01 00 0a ...`) for seconds, and every copy arrived shifted by the same 4 bits across many separate reads, then by 5, then 6. So Kepler's bit counter runs on across chip-select cycles, and on OSCCLK it gains or loses clocks; on the 399.36 MHz parent (baseline, 6.24 MHz) the frames stay at bit 0 and only single bytes are misread. A clk-zumapro change that lets USI3 reach OSCCLK / 2 is drafted (`~/android/mainline/wt-spi-word`, not built) but not worth a kernel until the slip is understood; it would reproduce this test. The palmtop is on the baseline again. +**Parked (2026-10-29, the owner's decision):** no logic analyzer, and no more module-level guessing. The two kernel changes stay (kernel PR #135); the as-ported gnssif and gnss_spi run on the palmtop. GNSS resumes when either a stock capture of SPI21's timing or a new idea about the first byte of a back-to-back block turns up. ### Suspend with the modem on (2026-10-27, early morning, same kernel) From 3bc0c74e33a999ad7a82fbd10462f33ff7a42edf Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 10:01:52 -0647 Subject: [PATCH 12/26] device/tegu NOTES: the two resets at about 34 s after Bluetooth started They came before any GNSS step on the night of 10-29, so they belong in NOTES rather than inside MODEM-PLAN's GNSS section, where the maintainer found them hard to find. --- device/tegu/NOTES.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/device/tegu/NOTES.md b/device/tegu/NOTES.md index 31ad87f8e..e39a6974a 100644 --- a/device/tegu/NOTES.md +++ b/device/tegu/NOTES.md @@ -13,6 +13,17 @@ hash/build ID; this dirty release is not a published kernel package. `[V]` marks verified observations; `[I]` marks an inference still to test. Raw captures, recordings, backups and vendor files remain off repository. +## 2026-10-29: two resets at about 34 s, right after Bluetooth started + +[V] During the night's GNSS G3 tries (kernel +`7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty`, gn3 DTB), two +boots reset at about 34 s of uptime, right after Bluetooth started (01:41 +and 03:03), before any GNSS step. The cause was not seen. The night's other +resets came from the modem side (the CP link hang after Kepler's watchdog +resets) and are in [MODEM-PLAN](MODEM-PLAN.md) under "G3, twenty-fourth to +thirty-fourth tries" and "The CP link hang". Not a GNSS matter: if a boot +with nothing but Bluetooth starting resets again at that time, start here. + ## 2026-10-26: audio (speakers, microphones, A2DP) with omamobile-audio 0.5.0 Kernel `7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty`: the private From 1d4055bb2b6036a6f81bc82fc9f09bf08d868abb Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 10:15:36 -0647 Subject: [PATCH 13/26] device/tegu MODEM-PLAN: the partition check after the GNSS night M0.1's checksum check, run after the night's modem sessions and resets: all six protected partitions match the 10-28 backup, read-only and unmounted. Also how the test DTBs reached slot B. --- device/tegu/MODEM-PLAN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/tegu/MODEM-PLAN.md b/device/tegu/MODEM-PLAN.md index 2c17709b2..bf232b1bb 100644 --- a/device/tegu/MODEM-PLAN.md +++ b/device/tegu/MODEM-PLAN.md @@ -759,7 +759,7 @@ So with the clock and the cut right, what is left is one byte per back-to-back c **The night's test code and the partition check** (the maintainer's points 4 and 5 on #138): - bring-up branch: (the `gnss_spi.ko` builds with the `fb_delay`, `realign`, `rx_cpha`, `hold`, `osc` and `div` parameters, the module that registered `pdma1` and ran the PL330 memcpy, the module that set USI3's mux and divider behind the clock framework, the per-transfer `spi->mode` switch, the DTBs with the `pdma1` node and with auto CS, and how each test DTB reached slot B). -- partition check: (`efs`, `efs_backup`, `modem_userdata` and `persist` against the backup, as M0.1, after the night's sessions and resets). +- partition check (2026-10-29 10:20, after the night's sessions and resets, release `7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty`): `efs`, `efs_backup`, `modem_userdata`, `persist`, `modem_a` and `modem_b`, each found by `PARTNAME` and read with `sha256sum` only, all match the 10-28 read-only backup (`tegu-protected-post-android-20261028T174253Z`, off-repo), all `ro=1`, none mounted. The night's test DTBs reached slot B through `bin/omamobile push` (the kit's `repo-push`: `dd` into the `_b` partitions, sha256-verified, then `reboot-to omamobile`), never through fastboot. **Parked (2026-10-29, the owner's decision):** no logic analyzer, and no more module-level guessing. The two kernel changes stay (kernel PR #135); the as-ported gnssif and gnss_spi run on the palmtop. GNSS resumes when either a stock capture of SPI21's timing or a new idea about the first byte of a back-to-back block turns up. From e7b7feb45f47a4a1d7c22c175e1dcc305133acd7 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 10:29:30 -0647 Subject: [PATCH 14/26] device/tegu MODEM-PLAN: the GNSS kernel changes are linux-omarchy-mobile#138 now Kernel #135 went up without a sign-off and is replaced by #138 with the same two commits; the parked paragraph links the live one. --- device/tegu/MODEM-PLAN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/tegu/MODEM-PLAN.md b/device/tegu/MODEM-PLAN.md index bf232b1bb..c34c35d55 100644 --- a/device/tegu/MODEM-PLAN.md +++ b/device/tegu/MODEM-PLAN.md @@ -761,7 +761,7 @@ So with the clock and the cut right, what is left is one byte per back-to-back c - bring-up branch: (the `gnss_spi.ko` builds with the `fb_delay`, `realign`, `rx_cpha`, `hold`, `osc` and `div` parameters, the module that registered `pdma1` and ran the PL330 memcpy, the module that set USI3's mux and divider behind the clock framework, the per-transfer `spi->mode` switch, the DTBs with the `pdma1` node and with auto CS, and how each test DTB reached slot B). - partition check (2026-10-29 10:20, after the night's sessions and resets, release `7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty`): `efs`, `efs_backup`, `modem_userdata`, `persist`, `modem_a` and `modem_b`, each found by `PARTNAME` and read with `sha256sum` only, all match the 10-28 read-only backup (`tegu-protected-post-android-20261028T174253Z`, off-repo), all `ro=1`, none mounted. The night's test DTBs reached slot B through `bin/omamobile push` (the kit's `repo-push`: `dd` into the `_b` partitions, sha256-verified, then `reboot-to omamobile`), never through fastboot. -**Parked (2026-10-29, the owner's decision):** no logic analyzer, and no more module-level guessing. The two kernel changes stay (kernel PR #135); the as-ported gnssif and gnss_spi run on the palmtop. GNSS resumes when either a stock capture of SPI21's timing or a new idea about the first byte of a back-to-back block turns up. +**Parked (2026-10-29, the owner's decision):** no logic analyzer, and no more module-level guessing. The two kernel changes stay ([linux-omarchy-mobile#138](https://github.com/derekross/linux-omarchy-mobile/pull/138), the signed-off replacement of #135); the as-ported gnssif and gnss_spi run on the palmtop. GNSS resumes when either a stock capture of SPI21's timing or a new idea about the first byte of a back-to-back block turns up. ### Suspend with the modem on (2026-10-27, early morning, same kernel) From cf9ff1c162e65e0fcced452847e301261d18bedd Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 10:31:02 -0647 Subject: [PATCH 15/26] device/tegu MODEM-PLAN: the GNSS night's test code is public Every variant that ran during G3's tries is now a commit on the owner's fork of the kernel (linux-omarchy-mobile#137, a draft), linked by commit from the plan so each try can be read next to its code. --- device/tegu/MODEM-PLAN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device/tegu/MODEM-PLAN.md b/device/tegu/MODEM-PLAN.md index c34c35d55..931eadebf 100644 --- a/device/tegu/MODEM-PLAN.md +++ b/device/tegu/MODEM-PLAN.md @@ -758,7 +758,7 @@ The next step is the clock itself, in the kernel: let spi-s3c64xx reach 12.5 MHz So with the clock and the cut right, what is left is one byte per back-to-back chip-select cycle in mode 1, or a half-bit sampling margin in mode 0, which is exactly the kind of question a logic analyzer on SPI21's SCLK, CS and MISO answers in a minute and software guessing does not. The palmtop runs the new kernel with the as-ported modules. The resets during this morning's sessions were mostly the curated startup's 150 s dead-man after its own false-positive fault check (an `OF: overlay: WARNING` line), rebooting through `reboot-to bootloader`; a few hard resets with no record in pstore remain unexplained (`logs/morning-20261029.md` item 7). **The night's test code and the partition check** (the maintainer's points 4 and 5 on #138): -- bring-up branch: (the `gnss_spi.ko` builds with the `fb_delay`, `realign`, `rx_cpha`, `hold`, `osc` and `div` parameters, the module that registered `pdma1` and ran the PL330 memcpy, the module that set USI3's mux and divider behind the clock framework, the per-transfer `spi->mode` switch, the DTBs with the `pdma1` node and with auto CS, and how each test DTB reached slot B). +- bring-up branch: [linux-omarchy-mobile#137](https://github.com/derekross/linux-omarchy-mobile/pull/137) (draft, `tegu-gnss-spi-bringup` on the owner's fork, head 8d77391d9, on top of the two kernel fixes): the gnssif_spi driver as ported (bb9999570), then one commit per variant in the order of the tries: 32-byte reads (401016f37), spi_mode and speed_hz (21cea1dd0), 32-bit words (45b492116), 60-byte pieces (7eec92532), w32p32 (c5223f5fc), the `fb_delay`/`cs_setup_us`/`osc` parameters with the USI3 mux write (cc78f333d), 8-bit words (840cac155), `hs` (e497c8be0, f8013d08b), the USI3 divider hold of the twenty-fourth try (b587e76f4), `rx_cpha`, the per-transfer `spi->mode` switch (f2dcd5241), `hold` (e8d4d64e2), `realign` 1-3 and `txshift` (b5229f35d, ff0eadd34, dacf3e304, a0877abc3), and the morning's `piece`, `carry`, `rx_gap_us`, the byte dump, `tx_gap_us`, padded writes, `psr` and `cs_hold_us` (dae13a1f9 to b8c423dda); the pdma1 ID probe and the runtime PL330 memcpy module (5f786c818, 288a87ecc); the feedback-delay-0, auto-CS, pdma1 and pdma1-swapped overlays (4d5548b4d); the g7 scripts and the offline CRC and bit-offset checks (8d77391d9). There was no separate USI3 mux-and-divider module: the mux write is the `osc` parameter and the divider hold the `div` parameter inside gnss_spi. Each test DTB reached slot B through the kit's `omamobile images` and `omamobile push`. - partition check (2026-10-29 10:20, after the night's sessions and resets, release `7.3.0-rc6-omamobile-tegu-s2mpg15-m1-g991042e2eff3-dirty`): `efs`, `efs_backup`, `modem_userdata`, `persist`, `modem_a` and `modem_b`, each found by `PARTNAME` and read with `sha256sum` only, all match the 10-28 read-only backup (`tegu-protected-post-android-20261028T174253Z`, off-repo), all `ro=1`, none mounted. The night's test DTBs reached slot B through `bin/omamobile push` (the kit's `repo-push`: `dd` into the `_b` partitions, sha256-verified, then `reboot-to omamobile`), never through fastboot. **Parked (2026-10-29, the owner's decision):** no logic analyzer, and no more module-level guessing. The two kernel changes stay ([linux-omarchy-mobile#138](https://github.com/derekross/linux-omarchy-mobile/pull/138), the signed-off replacement of #135); the as-ported gnssif and gnss_spi run on the palmtop. GNSS resumes when either a stock capture of SPI21's timing or a new idea about the first byte of a back-to-back block turns up. From aafd1f4c2c115cfc39c785228579f5fa3583823b Mon Sep 17 00:00:00 2001 From: Roboto Saith Date: Thu, 29 Oct 2026 18:00:01 +0000 Subject: [PATCH 16/26] device-raven 0.1.27, tools: haptics through feedbackd on the CS40L25A (#113) * device-raven, tools: haptics through feedbackd on the CS40L25A The kernel side is derekross/linux-omarchy-mobile#114 (cs40l25-vibra, its binding and raven's node). This is the rest: - device/raven/kernel.config builds cs40l25-vibra as a module. - extract-vendor-firmware -d raven stages the CS40L25A's files from the owner's factory image: the CLAB RAM firmware and the default wavetable, which the driver loads, and the CLAB configuration (braking), not loaded yet. - device-raven's 72-omamobile-feedbackd.rules makes the motor a feedbackd vibra, as cheetah's CS40L26. The motor's input device appears only once its firmware has loaded, about 5 s into the boot, and feedbackd (D-Bus activated) only looks for it when it starts, so on a boot where something asked for feedback first there were no haptics until feedbackd was restarted. The motor's arrival now starts omamobile-feedbackd-rescan.service, which stops a running feedbackd; the next request starts it again with the motor. HAPTICS-TORCH-PLAN records H5 and the boot race. Co-Authored-By: Claude Opus 5.5 * device-raven 0.1.27: the haptics version bump Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 Co-authored-by: Derek Ross --- device/raven/HAPTICS-TORCH-PLAN.md | 153 +++++++++++++++++- device/raven/kernel.config | 11 +- packages/omamobile-device-raven/test/all | 11 ++ .../system/omamobile-feedbackd-rescan.service | 11 ++ .../udev/rules.d/72-omamobile-feedbackd.rules | 10 ++ packages/omamobile-device-raven/version | 2 +- tools/extract-vendor-firmware | 7 +- 7 files changed, 198 insertions(+), 7 deletions(-) create mode 100644 packages/omamobile-device-raven/vendor/systemd/system/omamobile-feedbackd-rescan.service create mode 100644 packages/omamobile-device-raven/vendor/udev/rules.d/72-omamobile-feedbackd.rules diff --git a/device/raven/HAPTICS-TORCH-PLAN.md b/device/raven/HAPTICS-TORCH-PLAN.md index 4e62590de..b9211f199 100644 --- a/device/raven/HAPTICS-TORCH-PLAN.md +++ b/device/raven/HAPTICS-TORCH-PLAN.md @@ -3,7 +3,9 @@ Status (2026-10-15): **the torch works** (kernel `gd2521ee96675`, branch `omamobile-gs101-torch`); the owner tested the LED and the quick-settings -tile. **Haptics: not started** (a CS40L25A, where cheetah has a CS40L26A). +tile. **Haptics work** (2026-10-28): the CS40L25A B1 (cheetah has a +CS40L26A) through `cs40l25-vibra` (kernel derekross/linux-omarchy-mobile#114) +and feedbackd; key presses tick (section 2, H5). Cheetah's plan: [device/cheetah/HAPTICS-TORCH-PLAN.md](../cheetah/HAPTICS-TORCH-PLAN.md). ## 1. Torch: TI LM3644TT @@ -35,3 +37,152 @@ gpa6, with its own codec node on the AoC card's haptics back end `cs40l25a_clab.wmfw`, `cs40l25a_par.wmfw` and their `.bin` files. Mainline has no CS40L25A driver; cheetah's CS40L26 work is the starting point (both are Cirrus haptic DSPs, different register maps). + +**H0 (2026-10-27, `g64b532aaf7e8`, read-only):** stock's `hsi2c_8` is +`i2c@10970000`, which our DT already enables (`i2c-1`, a camera EEPROM at +0x50); there's no node at 0x43 yet. The reset line `gpp24-0` is an output +driven high (the bootloader leaves the chip out of reset), the trigger +`gpp24-3` an output low. Two reads over I2C (32-bit registers at 32-bit +addresses, `i2ctransfer -f -y 1 w4@0x43 0 0 0 r4`): `DEVID` (0x0) +`0x0040A25A`, a CS40L25A; `REVID` (0x4) `0xB1`. The vendor image's +`/firmware` has `cs40l25a_cal`, `_clab` and `_par` (`.wmfw` and `.bin`) +and `cs40l20.bin`; `extract-vendor-firmware -d raven` doesn't stage them +yet. Stock's node (`gs101-raviole-audio.dtsi`): IRQ gpa6-5, reset gpp24-0, +trigger gpp24-3, boost 1000 nH / 4 uF / 4500 mA peak, 7.5 V (CLAB 7.5 V), +OVP 12 V, f0 153 Hz (140-165), `fw-id-remap` 0x1400CB. + +**Next:** a driver. Nothing in our tree or mainline supports the +CS40L25 (cs40l26-vibra and mainline's cs40l50 are the newer Halo-core +parts); Google's GPL `cs40l2x` (its raviole kernel's amplifiers modules) is +the citable reference for the boot, firmware and wavetable interface. +Read alongside Google's GPL `cs40l2x` (Cirrus Logic's driver in Google's +raviole kernel, `kernel/google-modules/amplifiers`, branch +`android-gs-raviole-mainline`, `cs40l25/`; GPL-2.0; local reference copy +in `~/android/google/amplifiers-raviole`, never committed). + +**H0b (the same day, read-only, the boot checks Google's probe makes):** +`IRQ1_STATUS4` (0x1001C) 0x3, OTP boot done; `IRQ1_STATUS3` (0x10018) +0x2000002f, no OTP error (bit 31 clear); `BASIC_AMP_STATUS` (0x280018C) +0x1, basic-mode boot done; `BASIC_HALO_HEARTBEAT` (0x2800158) 0x4bace, +0x4bb9e 200 ms later, about 1 kHz. So the bootloader leaves the chip in +basic mode with its ROM firmware running, which is what Google's probe +expects. The B1 core is Halo, as the CS40L26's, so mainline `cs_dsp` +covers its DSP. + +**What Google's probe does on a CS40L25A B1** (`cs40l2x_part_num_resolve` +and the `B1ROM` paths): wait for OTP boot; read DEVID and REVID; exit +basic mode (`cs40l2x_basic_mode_exit`: wait for basic boot done and a +moving heartbeat, then hand the chip to the driver); apply and sequence +the B0 errata. On a CS40L25A the firmware ID is the DT's remap (stock: +`CLAB`, 0x1400CB; `B1ROM` 0x1400BA is refused as a remap), and probe +always ends by loading that RAM firmware (`cs40l25a_clab.wmfw` and its +coefficient files). The ROM heartbeat seen in H0b is basic mode, a +stand-alone ROM program the handover shuts down: nothing plays until the +RAM firmware runs. (An earlier version of this plan said the B1 could play +from ROM; it can't, through this driver's path.) A waveform plays by writing its index to the firmware's mailbox +(`MBOX_TRIGGERINDEX`, DSP virtual mailbox 1): 0 the vibration, 0x1-0x7FFF +clicks, 0x8000-0xFFF6 continuous; `MBOX_POWERCONTROL` (mailbox 4) wakes +and hibernates it. + +**Runbook (each step gated; read-only first; a step that writes is the +human's call):** + +| Step | What | Writes | Pass | Stop | Risk | +| --- | --- | --- | --- | --- | --- | +| H1 | a driver probe that reads only: IDs, OTP and basic-mode status, the heartbeat | none | `CS40L25A revision B1`, heartbeat moving | any read error | low | +| H2 | reset pulse, basic-mode handover and the B0 errata, as Google's probe | reset, the handover, the errata | state machine SHUTDOWN, no OTP or amplifier error, the basic-mode heartbeat stopped | any error flag, no acknowledge (rollback: a reset pulse returns basic mode) | low-medium | +| H3 | the RAM firmware (`cs40l25a_clab.wmfw` and coefficients) through `cs_dsp`, as stock | firmware | firmware ID 0x1400CB, heartbeat moving, DSP scratch 0 | load error, scratch non-zero | medium | +| H4 | boost from stock's DT (1000 nH, 4 uF, 4.5 A peak, 7.5 V), one short click at a low gain | boost, gain, one mailbox write | one tick felt, no fault IRQ | a fault IRQ, a buzz that doesn't stop (rollback: reset pulse) | medium | +| H5 | FF_RUMBLE through the input layer, feedbackd's udev rule as cheetah's | as H4 | the shell's haptic feedback | as H4 | low | + +**H1 result (2026-10-27, `g64b532aaf7e8`):** passed. The read-only probe +(`omamobile-gs101-haptics`, NOT FOR MERGE `cs40l25-h1`, an out-of-tree +module bound by hand through `new_device`) logged `devid 0x40a25a revid +0xb1, OTP boot done, basic mode booted, heartbeat 420111 -> 420133 in 20 +ms`; unbound and unloaded afterwards. + +**H2 result (the same day, `g64b532aaf7e8`):** passed (`cs40l25-h2`, the +same branch, bound the same way; `libgpiod` installed on the phone first +so a reset pulse on gpp24-0 can undo it). `basic mode shut down (state +4), no error flags; revert and errata written (trim12 0x002f0065, trim13 +0x00002b4f); basic-mode heartbeat stopped`. Read by hand after it: state +4, `BASIC_AMP_STATUS` 0x1, the heartbeat still 0xadacb 200 ms later. +`IRQ1_STATUS3` went 0x2000002f to 0x2000003f: bit 4, PLL unlock in the +CS35L41's layout of the same block, latched by the PLL errata (no error +bit). (Later the same day: the PLL errata keep the lock; what unlocks the +PLL is the revert's `PWR_CTRL1` = 0, global enable off; see H3.) The +chip stays shut down until a reset. + +**H3 and H4 (the same day, `g64b532aaf7e8`): the firmware runs and the +motor buzzes.** `cs40l25-h3` (the same branch; the owner's +`cs40l25a_clab.wmfw` and the wavetable `cs40l20.bin` from the factory +image, copied to the phone's `/usr/lib/firmware/updates/` for the test, +never into the repo), in this order, as Google's probe: + +1. the basic-mode handover and B0 errata (H2); +2. `cs40l2x_init()`: stock's boost (K1/K2 0x24, slope 0x75, peak 0x4a, + 7.5 V 0x64, OVP 0x130) and its short test (passed, `IRQ1_STATUS1` + 0x01c00000), the PCM routing, wake sources 0x98 (I2C SDA and GPIO1); +3. the firmware through `cs_dsp` (the CS40L50's Halo memory map, system + info at 0x25e0000): `Firmware: 1400cb vendor: 0x2 v10.7.9, 2 + algorithms`, `cs40l20.bin (v2): v10.3.2`; +4. in `pre_run`, `cs40l2x_dsp_pre_config()`'s controls (an empty power-on + sequence, GPIO1 button detection, GPIO1 and events off, the IRQ2 mask + sequence and valid), the DSP errata, memory-ready and global enable. + +`HALO_STATE` settles at **201**, not the 203 the cs40l2x tables give +(Google's mainline and Android 14 branches alike), and stays there. What +took a while: the firmware drops global enable itself, and the PLL, +locked to the MCLK on GPIO2 (`PLL_CLK_CTRL` 0x15: MCLK, enabled, 32 kHz; +locked in basic mode, so the clock is wired and running), unlocks with +it. So 201 is the firmware's idle state on this setup, not a hang; +neither `lock_regions`, the power-on sequence nor any other control +changed it. + +H4: with the firmware idle, index 1 written to the trigger mailbox +(`MBOX_TRIGGERINDEX`, 0x13020) was taken within 5 ms; the firmware set +global enable, the PLL locked, no error flag came up (`IRQ1_STATUS1` +unchanged), and the owner felt **a strong vibration for about half a +second**, until the test's reset pulse 0.5 s later. So index 1 may not be +a short click in this wavetable, or nothing stopped it; and it played at +the firmware's default gain. Next: the waveform list and lengths +(`NUMBEROFWAVES`, the wavetable header), a stop, a low gain, then a short +click; then FF_RUMBLE. + +The firmware files stay off the repo: `extract-vendor-firmware -d raven` +gets them from the owner's factory image when H3 needs them. + +**H5 (2026-10-27/28, `g97f09c8cfada` and `g3ba8c15c89b8`): passed.** The +bring-up probes became one driver, `cs40l25-vibra` (kernel +`omamobile-gs101-haptics`, upstream as derekross/linux-omarchy-mobile#114, +with its binding and raven's node), which probes at boot from the DT and +exposes FF_RUMBLE through ff-memless: + +- a start plays the continuous effect (index 0) through the trigger + mailbox, a stop writes ENDPLAYBACK; +- the strength sets the firmware's trigger gain, mapped onto -8 to -18 dB; +- themes ask for 7-12 ms clicks, shorter than the actuator needs to build + up, so a stop is held back to 30 ms (`min_on_ms`). + +feedbackd drives it through `72-omamobile-feedbackd.rules` (FEEDBACKD_TYPE +vibra, as cheetah's CS40L26). The owner confirmed key-press haptics on +the on-screen keyboard. + +**H5 again (2026-10-28/29, `ge1e6adb69bbf`): passed** on the reworked driver +that lands with #114 (reset active low, boost from the DT): the CS40L25A +(revision B1) probes at boot with firmware 0x1400cb running, and key +presses on the on-screen keyboard still tick. + +**The boot race:** the motor's input device appears only once its +firmware has loaded, about 5 s into the boot. feedbackd, started by D-Bus, +only looks for haptics devices when it starts, so a boot where something +asked for feedback first ran without haptics until feedbackd was restarted +by hand. The rule now also starts `omamobile-feedbackd-rescan.service` +when the motor appears, which stops a running feedbackd; the next request +starts it again with the motor. Checked on the phone by replaying the +motor's arrival (`udevadm trigger --action=add`): feedbackd was stopped, +the next request started a new one, and it buzzed. + +Not yet: the IRQ, hibernation, braking (the CLAB configuration +`cs40l25a_clab.bin` is extracted but not loaded), calibration and the codec +path. diff --git a/device/raven/kernel.config b/device/raven/kernel.config index a546553f8..308c76c67 100644 --- a/device/raven/kernel.config +++ b/device/raven/kernel.config @@ -4,16 +4,19 @@ # about a symbol a kernel doesn't have, so the published kernel still builds: # the AoC (omamobile-gs101-aoc), the modem's SPI boot device # (omamobile-gs101-cpif), the panel (omamobile-gs101-display), the touch -# transport (kernel #8) and the thermal sensors (kernel #7). +# transport (kernel #8), the thermal sensors (kernel #7) and the haptic +# driver (kernel #114). # The AoC drivers against gs101's firmware interface (AUDIO-PLAN.md R0). CONFIG_GOOGLE_AOC_GS101=y # The modem (S5123) takes its first boot stage over SPI bus 9 before its PCIe # link (device/raven/MODEM-PLAN.md section 2). Cheetah's CPIF options come # from kernel/configs/omamobile.config; this adds the SPI boot device. CONFIG_BOOT_DEVICE_SPI=m -# Raven's own hardware, as modules (BRINGUP-M1.md, DISPLAY-PLAN.md): the -# S6SY79x touchscreen through s6sy761, the S6E3HC3 panel and the gs101 -# thermal sensors through ACPM. +# Raven's own hardware, as modules (BRINGUP-M1.md, DISPLAY-PLAN.md, +# HAPTICS-TORCH-PLAN.md): the S6SY79x touchscreen through s6sy761, the +# S6E3HC3 panel, the gs101 thermal sensors through ACPM and the CS40L25A +# haptics. CONFIG_TOUCHSCREEN_S6SY761=m CONFIG_DRM_PANEL_SAMSUNG_S6E3HC3=m CONFIG_GS101_ACPM_THERMAL=m +CONFIG_INPUT_CS40L25_VIBRA=m diff --git a/packages/omamobile-device-raven/test/all b/packages/omamobile-device-raven/test/all index 78ad63341..c38535f76 100755 --- a/packages/omamobile-device-raven/test/all +++ b/packages/omamobile-device-raven/test/all @@ -44,6 +44,7 @@ for f in usr/bin/omamobile-bootctl usr/bin/reboot-to usr/bin/omamobile-boot-succ usr/lib/systemd/system/sddm.service.d/omamobile-raven-bluetooth.conf \ usr/lib/modprobe.d/omamobile-raven.conf usr/lib/modprobe.d/omamobile-charger.conf \ usr/lib/tmpfiles.d/omamobile-raven-cpufreq.conf usr/bin/omamobile-charge-guard \ + usr/lib/udev/rules.d/72-omamobile-feedbackd.rules usr/lib/systemd/system/omamobile-feedbackd-rescan.service \ usr/lib/udev/rules.d/20-omamobile-display.rules \ usr/lib/NetworkManager/conf.d/omamobile-raven-wifi-powersave.conf \ usr/bin/omamobile-sleep usr/bin/omamobile-sleepd usr/lib/systemd/user/omamobile-sleepd.service \ @@ -106,3 +107,13 @@ for m in pcie_gs201_cp cpif shm_ipc boot_device_spi; do grep -qx "blacklist $m" vendor/modprobe.d/omamobile-raven-modem.conf || fail "$m stays blacklisted (modem bring-up)" done pass "the modem's drivers never load at boot" + +# Haptics: feedbackd only finds the motor when it starts, and the motor +# appears ~5 s into the boot (its firmware): the rule restarts a feedbackd +# that came first. +rule=vendor/udev/rules.d/72-omamobile-feedbackd.rules +grep -q 'ATTRS{name}=="cs40l25_vibra".*ENV{FEEDBACKD_TYPE}="vibra"' "$rule" || fail "the motor is a feedbackd vibra" +grep -q 'ENV{SYSTEMD_WANTS}+="omamobile-feedbackd-rescan.service"' "$rule" || fail "the motor's arrival restarts feedbackd" +grep -qx 'ExecStart=-/usr/bin/pkill -x feedbackd' vendor/systemd/system/omamobile-feedbackd-rescan.service \ + || fail "the rescan stops only feedbackd, and no feedbackd is not an error" +pass "feedbackd picks up the haptics motor" diff --git a/packages/omamobile-device-raven/vendor/systemd/system/omamobile-feedbackd-rescan.service b/packages/omamobile-device-raven/vendor/systemd/system/omamobile-feedbackd-rescan.service new file mode 100644 index 000000000..aba3c86b4 --- /dev/null +++ b/packages/omamobile-device-raven/vendor/systemd/system/omamobile-feedbackd-rescan.service @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: MIT +# Started by 72-omamobile-feedbackd.rules when the haptics motor's input +# device appears. feedbackd only looks for it when it starts, and it is +# D-Bus activated: stopping a running one makes the next request start it +# again with the motor. No feedbackd running: nothing to do. +[Unit] +Description=Omarchy Mobile: let feedbackd pick up the haptics motor + +[Service] +Type=oneshot +ExecStart=-/usr/bin/pkill -x feedbackd diff --git a/packages/omamobile-device-raven/vendor/udev/rules.d/72-omamobile-feedbackd.rules b/packages/omamobile-device-raven/vendor/udev/rules.d/72-omamobile-feedbackd.rules new file mode 100644 index 000000000..1d87316ae --- /dev/null +++ b/packages/omamobile-device-raven/vendor/udev/rules.d/72-omamobile-feedbackd.rules @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: MIT +# Omarchy Mobile: let feedbackd drive the Cirrus Logic CS40L25A haptics +# (cs40l25-vibra), in the same form as feedbackd's own 72-feedbackd.rules. +# The motor's input device appears only once its firmware has loaded, about +# 5 s into the boot; a feedbackd that started before it never picks it up +# (no haptics until feedbackd restarts). omamobile-feedbackd-rescan stops a +# running feedbackd then, and D-Bus starts it again on the next request. +ACTION=="remove", GOTO="omamobile_feedbackd_end" +SUBSYSTEM=="input", KERNEL=="event*", ENV{ID_INPUT}=="1", SUBSYSTEMS=="input", ATTRS{name}=="cs40l25_vibra", TAG+="uaccess", ENV{FEEDBACKD_TYPE}="vibra", TAG+="systemd", ENV{SYSTEMD_WANTS}+="omamobile-feedbackd-rescan.service" +LABEL="omamobile_feedbackd_end" diff --git a/packages/omamobile-device-raven/version b/packages/omamobile-device-raven/version index 7db267292..a2e1aa9d9 100644 --- a/packages/omamobile-device-raven/version +++ b/packages/omamobile-device-raven/version @@ -1 +1 @@ -0.1.26 +0.1.27 diff --git a/tools/extract-vendor-firmware b/tools/extract-vendor-firmware index b0d0d7d14..0ab86770d 100755 --- a/tools/extract-vendor-firmware +++ b/tools/extract-vendor-firmware @@ -112,7 +112,9 @@ case $DEVICE_OPT in # protection firmware and the AoC's sensor registry (device/raven/WIFI-PLAN.md, # AUDIO-PLAN.md). The _ROW # NVRAM and CLM are the global model's (SKU GLU0G). Raven's vendor has no - # fast_switch tunings, and its haptics (cs40l25a_*) are not mapped yet. + # fast_switch tunings. The haptics: cs40l25-vibra loads the CLAB RAM + # firmware and the default wavetable; the CLAB configuration (braking) + # isn't loaded yet (device/raven/HAPTICS-TORCH-PLAN.md). BOARD="google,gs101-raven" DEVICE="raven" MAP=( @@ -124,6 +126,9 @@ case $DEVICE_OPT in "firmware/cs35l41-dsp1-spk-prot.wmfw|cirrus/cs35l41-dsp1-spk-prot-$DEVICE.wmfw" "firmware/cs35l41-dsp1-spk-prot.bin|cirrus/cs35l41-dsp1-spk-prot-$DEVICE-top.bin" "firmware/R-cs35l41-dsp1-spk-prot.bin|cirrus/cs35l41-dsp1-spk-prot-$DEVICE-bottom.bin" + "firmware/cs40l25a_clab.wmfw|cs40l25a_clab.wmfw" + "firmware/cs40l20.bin|cs40l20.bin" + "firmware/cs40l25a_clab.bin|cs40l25a_clab.bin" ) ;; *) die "unknown device $DEVICE_OPT (cheetah or raven)" ;; esac From c04addfa21970263dae0411f24ea8fe80ad61302 Mon Sep 17 00:00:00 2001 From: Derek Ross Date: Thu, 29 Oct 2026 14:51:46 -0400 Subject: [PATCH 17/26] docs/review: lessons from review round 29 (#160) Twenty-six lessons (L-318 to L-343) from the round 29 omamobile-reviewer runs, and three corrections: C-20, our kernel #109 advice that the Pixel 7's SPI controller DMAs the touch report (it polls; gs201's spi_0 has no dmas); C-21, asking for FT3658=m in panther's device kernel.config against RELEASES; C-22, a Bluetooth address in kernel #98's thread that the first review missed. Five candidates were dropped as already covered. Co-authored-by: Claude Opus 5.5 --- docs/review/LESSONS.md | 236 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 236 insertions(+) diff --git a/docs/review/LESSONS.md b/docs/review/LESSONS.md index 9d09b1214..7cd8bd66f 100644 --- a/docs/review/LESSONS.md +++ b/docs/review/LESSONS.md @@ -18,6 +18,62 @@ never change, so reviews can cite them. ## Safety model (AGENTS.md section 1) +- **L-324. A review reads the PR thread for identifiers, not only the diff.** + A contributor's evidence comments on kernel #98 quoted `bluetoothctl show` + with the phone's public Bluetooth address twice, and `tools/pr-check` sees + commits only. *Check:* every round, run the MAC pattern + (`[0-9A-Fa-f]{2}(:[0-9A-Fa-f]{2}){5}`) and the serial and IMEI patterns over + `gh pr view N --json comments,reviews` and the inline review comments, and + ask for an edit. Extends L-29; see C-22. *From:* kernel #98, round 29. +- **L-323. A device that drops its forked init for the shared one also changes + its `INITRAMFS_INIT` to an absolute value.** A value without a leading `/` + is relative to `device//`, so #111's unchanged `initramfs/init` + pointed at the file the same push deleted; `tests/boot-method` passed + because `images` stops at "build the kernel first" before the initramfs. + *Check:* `grep INITRAMFS_INIT device//device.conf`, then `git cat-file -e + :device//`, or run `bin/omamobile initramfs` with a scratch + `KERNEL_OUT` (it dies at the init check before any download). Extends L-134. + *From:* #111, round 29. +- **L-322. Accepting a new `BOOT_METHOD` in `bin/omamobile` opens `flash` and + `push` too, and `flash` switches the slot.** On Qualcomm A/B, `fastboot + --set-active` hands slot state to ABL, which (as we understand it) resets + the successful flag; with the GPT mark allowed only by hand under a §3.1 + entry, `flash` forces the next GPT write or a fallback. *Check:* for a new + method, list what each of `images`, `flash` and `push` does on that + bootloader, and refuse the ones whose follow-up isn't approved. Extends + L-284. *From:* #111, round 29. +- **L-321. "The shared init covers this device" is checked against the LUNs on + any non-Pixel UFS.** `initramfs/init` leaves allowlisted partitions writable + only on `sda`, `boot_arch` finds `userdata` only there, and `cmd_push` finds + slot B's images only there. Pixels keep them on LUN 0; multi-LUN Qualcomm + layouts may not. The no-USB-host `sysrq c` fallback is a Tensor-era + assumption too. *Check:* ask for the read-only `PARTNAME` to `sdX` map of + every `UFS_RW` entry from sysfs before accepting "push updates `boot_b`", + and ask what a panic does on that bootloader. Extends L-1 and L-232. *From:* + #111, round 29. +- **L-320. A one-boot helper a PR adds needs install, enable and removal steps + in its runbook.** #136's H5 created the early read's marker, but no step + installed or enabled the unit, so the run's main reading would silently not + happen. *Check:* for each script or unit a PR adds under `device//`, find + the runbook line that copies it and runs `systemctl enable`, and the one + that undoes it. *From:* #136, round 29. +- **L-319. A meter check or stop rule written for one reset applies to every + reset that reaches the same state.** #136's "VBUS still up two minutes after + the reset" was attached to H5's planned `echo b`, but H4's swap timer and a + forced restart with the drive attached are the same crash with host mode on. + *Check:* for each stop rule that depends on hardware state, list the other + ways the runbook can reach that state (timers, dead-man, forced restart) and + state the rule once, at the top. Extends L-296 and L-133. *From:* #136, + round 29. +- **L-318. A step that swaps the cable while no Type-C driver owns the port + can't expect its link back.** #136's H5 boots with a USB drive on the port + and the boost module blacklisted, so the charger and the TCPC defer and + nothing owns the MAX77779, which opens its USB data switch when the drive is + unplugged. The runbook said "put the laptop back in" as if SSH would return. + *Check:* for every step that ends with a cable swap, list which Type-C + driver is bound at that moment; if none, the Expect says "no link" and the + way back is a restart with the laptop attached. Extends L-81 and AGENTS + "USB". *From:* #136, round 29. - **L-298. A retry path is exercised on the phone by holding its dependency down, not by breaking hardware.** #99's screen-on retry can be forced by keeping neard stopped across a screen-on. *Check:* first confirm the daemon @@ -314,6 +370,40 @@ never change, so reviews can cite them. ## Shared code and the reference device +- **L-328. Moving a CPIF watcher from open-per-poll to a held fd changes the + node's open count for the CP's lifetime; read open and release before + calling it neutral.** On our CPIF, `bootdump_open` runs `init_comm` (which + returns at once for SIT), `terminate_comm` is NULL, release purges the rx + queue on cbd's close, and a holder that never reads takes none of cbd's + frames, so #148 is neutral there by source. It still changes every phone's + modem profile, so cheetah gets a maintainer run first. *Check:* the iod's + open, release, poll and rx paths, and every reader of `iod->opened`. Extends + L-206. *From:* #148, round 29. +- **L-327. A new `VENDOR_LIBS` entry in `extract-vendor-chroot` is unverified + until the extractor has run on a real image.** Every entry's NEEDED closure + is walked and any unresolved soname aborts the whole profile, so a GNSS-only + addition could take a phone's modem chroot down with it; #141's libraries + were copied by hand. *Check:* ask for one extractor run (its `==>` lines and + the new MANIFEST paths), or run it on a factory image we have; binder + clients often need `STUB_LIBS`. Extends L-29. *From:* #141, round 29. +- **L-326. A "read-only, no-op on cheetah" `clk_get_rate()` on an ACPM clock + is a firmware call.** clk-acpm registers the gs101, gs201 and zumapro clocks + with `CLK_GET_RATE_NOCACHE`, so kernel #116's MIF restore adds one ACPM DVFS + GET on cheetah at every drop from 120 Hz, though it never writes there (MIF + is already at its top rate). *Check:* before calling a new `clk_get_rate()` + on a shared path free, read the provider's `flags` and `recalc_rate`, and + put the call count in the cheetah table. Extends L-111. *From:* kernel #116, + round 29. +- **L-325. "Shares the register map" isn't "shares the device type": a PMIC + change gated on `device_type` is checked against the reference phone's MFD + data, not its registers.** rtc-s5m gives the S2MPG12 the S2MPG10's + `s2mpg10_rtc_regs`, but sec-acpm's `s2mpg12_data` keeps `device_type = + S2MPG12`, so kernel #132's `== S2MPG10` steps skip cheetah although the + registers are the same; a condition on the regs pointer would have reached + it. *Check:* for each new condition in a shared PMIC driver, read what it + tests (type, regs, compatible), find cheetah's value in the MFD match data + and probe, and confirm with the compare's immediate in the object. Extends + L-206 and L-230. *From:* kernel #132, round 29. - **L-301. A shared-driver branch gated on what callers send counts as match data under CONTRIBUTING §6.2 only if no reference-phone consumer sends it, on the base and on `omamobile-int`.** Kernel #125's DCS-read path runs only @@ -640,6 +730,42 @@ never change, so reviews can cite them. ## Kernel (linux-omarchy-mobile) +- **L-332. A delayed "auto-off" work in a driver is checked for re-arm, cancel + and remove order.** Kernel #126's LHBM timer used `schedule_delayed_work()`, + a no-op while the work is pending, and never cancelled it on off, so an + off-on within 3 s was cut short; its `remove()` cancelled before removing + the sysfs attribute that queues the work, and could leave a lit circle with + no timer. *Check:* off cancels, on uses `mod_delayed_work()`, and remove + goes attributes away, state off, cancel sync, detach. The Pixel 7 Pro's + s6e3hc4 LHBM on `omamobile-int` is the local precedent. *From:* kernel #126, + round 29. +- **L-331. A fixed sleep between NCI commands while the controller resets is + checked against the core's request pairing.** Kernel #131 sends + PROP_NFC_MODE_SET, sleeps 200 ms, then sends CORE_INIT. The core's + `nci_core_reset_ntf_packet()` completes the pending request unconditionally, + so a late CORE_RESET_NTF completes whatever is pending, and every later + request takes the previous one's response; the vendor HAL waits for the + notification, with a 500 ms timer. *Check:* for any `msleep` between NCI + commands, find which notification the vendor HAL waits for there and whether + the core completes requests from it (`ntf.c`, `rsp.c`); prefer leaving the + request pending until the notification arrives. Extends L-61. *From:* kernel + #131, round 29. +- **L-330. A board that reuses a shared pin group for a different part + inherits the reference phone's pulls.** Panther's touch node uses gs201's + `ts_irq` (`PULL_NONE`, cheetah's), while Google's `gs201-panther-touch.dtsi` + overrides `&ts_irq` to pull-up for the FT3658. *Check:* for each shared + pinctrl label a board PR references, `grep -n '&