Fix WCD 48 kHz interpolators, CAJON analog codec, PipeWire mono downmix, and gain staging for a1125 (ampere)

- Add patches/kernel/0015-msm8909-wcd-digital-interpolator-cajon-analog.patch
  and rebuild kernel + audio codec modules (prebuilt/ + overlay/rootfs/)
  so REGCACHE_FLAT keeps 48 kHz POR interpolator/decimator defaults
  (RX1/2/3_B5_CTL=0x68, TX1/2_CLK_FS_CTL=0x03) and PM8909 CAJON_2_0
  analog defaults, non-boost Class-D SPK PA, HPH DAC/PA sequencing,
  EAR +6 dB headroom, and pm8909_s2 wakeup restore apply cleanly.
- Add WirePlumber create-item.lua item.features.mono = true support and
  PipeWire client drop-ins so Speaker and Earpiece present a positioned
  [ MONO ] PortConfig (0.5 * FL + 0.5 * FR with channelmix.normalize = true
  and triangular TPDF dithering) over 2 ch 48 kHz S16LE hardware while
  keeping Headphones and Bluetooth A2DP sinks stereo.
- Sync unity 100% PipeWire software sink volume when card0 is present
  and cap UCM2/plugin digital ALSA playback ceiling at <= 84 (0 dB).
- Add scripts/test-audio-quality.py wired into scripts/check-rebuild.sh,
  pin all 7 rebuilt a1125 (ampere) image SHA-256 hashes, and update
  CHANGELOG.md, MANUAL.md, and AGENTS.md.
This commit is contained in:
Luxferre committed 2026-11-23 19:53:06 +02:00
1 parent 1a229b0587
commit 4f73c28e5e
39 files changed
+1398 -55

No files matched your search

+12 -7
View File
@@ -16,6 +16,11 @@ Release versions follow the `<year-letter><MM><DD>` format (where `2026` is `a`,
Upcoming release build (`a1125` / `ampere` via `scripts/version.sh`) targeting **Nokia 8110 4G (`nokia-argon`)**, **Nokia 2720 Flip (`nokia-beatles`)**, **Nokia 800 Tough (`nokia-coconut`)**, and **Nokia 8000 4G (`nokia-sparkler`)** while keeping `a1120` (`cocojamboo`) as the current published release.
### Audio playback quality (`0015` WCD `48 kHz` interpolators, PM8909 `CAJON_2_0` analog codec, PipeWire downmix & unity gain staging) across all targets
- **48 kHz WCD digital interpolators/decimators & PM8909 `CAJON_2_0` analog codec (`patches/kernel/0015-msm8909-wcd-digital-interpolator-cajon-analog.patch`, `scripts/build-kernel-audio.sh`)**: fixed `REGCACHE_FLAT` in `msm8916-wcd-digital.c` missing `.reg_defaults` (which zeroed `LPASS_CDC_RX1/2/3_B5_CTL` POR `0x68` (`48 kHz`) to `0x00` (`8 kHz` narrowband HSP filter), `TX1/2_CLK_FS_CTL` POR `0x03` to `0x00`, and `LPASS_CDC_CLK_OTHR_CTL` POR `0x04` to `0x00` on `regcache_sync()`) by adding complete `reg_defaults`, `valid_reg`/`volatile_reg` callbacks, non-zero POR writes on probe, and dynamic `hw_params` programming of `RX1/2/3_B5_CTL` (`(rx_fs_rate << 5) | BIT(3)`) and `TX1/2_CLK_FS_CTL` (`tx_fs_rate`); detected PM8909 `CAJON_2_0` (`CDC_A_PERPH_SUBTYPE == 0x0a`) in `msm8916-wcd-analog.c` to apply Qualcomm `cajon2p0` defaults (`NCP_FBCTRL = 0xA8`, `NCP_VCTRL = 0xA4`/`0xA7`, `RX_HPH_BIAS_PA = 0xFA`, `SPKR_ANA_BIAS_SET = 0x41`, `TX_1_2_OPAMP_BIAS = 0x4C`, `RX_EAR_STATUS = 0x10`) and restore them across `s2` standby gating without clobbering `SPK DAC Switch`, configured the non-boost Class-D `SPK PA` (`SPKR_DRV_CTL = 0x69`/`0xE9` without nonexistent 5 V `BOOST_SET`/`CMFB_SET` bits), and added `CAJON_2_0` `HPHL DAC`/`HPHR DAC`/`HPH PA` DAPM sequencing and `+6 dB` analog `EAR PA` headroom (`RX_EAR_CTL BIT(5)`). Verified live on connected `nokia-sparkler` (`Nokia 8000 4G`): `050/070/090 = 0x68` (`48 kHz` halfband interpolators), `290/2b0 = 0x03`, `198 = 0x03`, `CAJON_2_0` analog regmap `f146 = 0x30`, `f165 = 0x4c`, `f183 = 0xa8`, `f185 = 0xa4`, `f194 = 0xfa`, `f1b3 = 0x41`, `f1b0 = 0x83`, `f1b2 = 0xe9`, `f1b5 = 0xff`, and idle `pm8909_s2` `state=disabled` / `use_count=0`.
- **Lossless PipeWire stereo-to-mono downmix, TPDF dithering, and `<= 0 dB` unity gain staging (`create-item.lua`, `msm8916-s16le.conf`, `10-bananarchy-audio.conf`, `UCM2`, `sxmo_audio.sh`, `sxmo_hook_ring.sh`, `xdrawer.cpp`, `callscreen_plugin.cpp`, `files_plugin.cpp`, `ringtones_plugin.cpp`, `scripts/test-audio-quality.py`)**: added per-node `item.features.mono` support in `overlay/rootfs/usr/share/wireplumber/scripts/node/create-item.lua` to replace unpositioned `[ FC, AUX0 ]` mapping (where WirePlumber 0.5 `si_audio_adapter_find_format` marks `AUX*` nodes `0x1000..0x1fff` as `item.node.unpositioned = "true"`, causing `si-standard-link` to skip `PortConfig` downmixing and route `output_FL -> playback_AUX0` while leaving positioned `playback_FC` unlinked and Speaker silent), and updated all four `msm8916-s16le.conf` copies to lock `audio.rate = 48000` and `dither.method = "triangular"` across internal ALSA nodes while enabling `item.features.mono = true` (`[ MONO ]` `PortConfig` keeping hardware `hw:0,0` in `2 ch` `48 kHz` `S16_LE` while keeping `Headphones` and Bluetooth A2DP sinks in full `2 ch` `[ FL, FR ]` stereo) and `channelmix.normalize = true` on `HiFi__Speaker__sink` and `HiFi__Earpiece__sink`, paired with `/etc/pipewire/{client,pipewire-pulse}.conf.d/10-bananarchy-audio.conf` (`channelmix.normalize = true`, `dither.method = "triangular"`) so stereo music sums `0.5 * FL + 0.5 * FR` without discarding `FR` or halving `sxmo_vibrate` amplitude; kept PipeWire's software sink at `100%` unity (`0.0 dB`) whenever `/proc/asound/card0` is present (`bananarchy_sync_internal_pw_vol`) and capped ALSA hardware digital playback mappings (`Speaker`/`Earpiece` `52..84`, `Headphones` `51..83`, UCM2 initial `80`/`84`) at `<= 84` (`0 dB` unity) to eliminate `+4..+8 dB` 16-bit digital clipping; added `scripts/test-audio-quality.py` wired into `scripts/check-rebuild.sh`. Verified live on `nokia-sparkler`: `mpv:output_MONO -> HiFi__Speaker__sink:playback_MONO [active]` with `pcm0p/sub0` `RUNNING`, `0.5 * FL + 0.5 * FR` confirmed via `parecord` monitor DFT (`440 Hz = 6979.1`, `660 Hz = 7746.8`), and `sxmo_vibrate` `vib_rc=0`.
### Cellular PS attach, Dual-SIM QMI WDS subscription binding (`libmm-wds-bind.so`), and mobile data (`wwan0`) fixes across all targets
- **QMI `WDS` subscription binding (`src/bananarchy-daemons/mm-wds-bind.c`, `libmm-wds-bind.so`, `/etc/init.d/modemmanager`)**: added a lightweight C `LD_PRELOAD` library preloaded by `ModemManager` and `msm-modem-uim-selection` (`run_wds_qmicli`) that hooks `qmi_device_allocate_client_finish()`, `qmi_client_wds_bind_mux_data_port()`, and `qmi_client_wds_bind_data_port()` to serialize `QMI_SUBSCRIPTION_TYPE_PRIMARY` (`1`, overrideable via `BANANARCHY_WDS_SUBSCRIPTION`) binding on every `QMI_SERVICE_WDS` (`1`) client both at allocation and after `Bind Mux Data Port` (`0x00A2`) / `Bind Data Port` (`0x0089`), preventing sticky KaiOS `SECONDARY` EFS `DDS` state (`QMI_DSD 0x004F == 2`) from resetting or routing `WDS Start Network` or `3gpp` profile lookups to the unprovisioned secondary subscription.
@@ -44,13 +49,13 @@ Upcoming release build (`a1125` / `ampere` via `scripts/version.sh`) targeting *
- **microSD PM8909 `l11` static `200 mA` load removal & `sdhci-msm` probe/active HPM + standby LPM `set_load` (`patches/kernel/0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch`, `devices/*/*.dts`, `prebuilt/kernel-6.12.1-msm8916/`)**: removed static `regulator-system-load = <0x30d40>;` from PM8909 `l11` across all 6 DTS files while extending `sdhci-msm.c` (`sdhci_msm_register_vreg()`, `sdhci_msm_set_vmmc()`, `msm_toggle_vqmmc()`, `sdhci_msm_runtime_resume()`, `sdhci_msm_runtime_suspend()`) and rebuilding `vmlinuz`/modules/DTBs so microSD probe and UHS-I tuning receive full `200 mA` / `20 mA` HPM without brownout (`-5`/`-110`) and idle runtime suspend drops `vmmc`/`vqmmc` to `2 mA`/`0 mA` PM8909 LPM.
- **Offline verification (`scripts/test-imsd-volte.py`, `scripts/test-standby-power-policy.py`, `scripts/check-rebuild.sh`, `BATTERY-OPTIMIZATION-ANALYSIS.md`)**: added host regression tests for Combined EPS/IMSI (`cs_attach=1`), `searching_lte`, and 0-packet `2.2 s` QRTR idle silence in `test-imsd-volte.py`; added host tests for `CPU_GOV_PATH` + idempotent `screenoff`/`screenon` across dark/cover-lit/open, `standby.mode`/`rat_timer.pid`, `bananarchy-dsds --sig-hysteresis` QMI `0x0045`/`0x0050` wire framing over `AF_UNIX` `SOCK_SEQPACKET`, and `30-bananarchy-network-status.sh` dark gating in `test-standby-power-policy.py`; guarded DTS/DTBs against `regulator-system-load` in `check-rebuild.sh`; and documented Section 24 in `BATTERY-OPTIMIZATION-ANALYSIS.md`.
- **Rebuilt local `a1125` (`ampere`) image SHA-256 checksums (`--mkinitfs`, no release `.zip` archives built yet)**:
- `images/bananarchy-nokia-argon.img`: `2ba4620680a981a87fa8adf7a2fb6ab98d932c73f9de9be1c69981edc096d2a8`
- `images/bananarchy-nokia-beatles.img`: `23d1fdd6598bf0c5497b1e41a16888d966ad4ac3f4eee3aa04623b339c896c59`
- `images/boot-bananarchy-nokia-beatles.img`: `0459151f37c746963dc734539a4284a0524b1b8ad777cd8690a87f928d2cec58`
- `images/bananarchy-nokia-coconut.img`: `1f47b0f6b96c1637e1febaa6b5d150c2dd661ba9d200286315cb0400ca61a6a0`
- `images/boot-bananarchy-nokia-coconut.img`: `81695b3242403ebbd8631957a0ca67128b9791199e8121f58ed5e8f32ea2cc77`
- `images/bananarchy-nokia-sparkler.img`: `7e6b7bdc1ac96f748c46c6fde0f7debe2ae5562d0c2feb1f5ddfc274fd22717e`
- `images/boot-bananarchy-nokia-sparkler.img`: `5fde23c229bcfcec276bfa064308a37736dc9f34bcb80c6f5b6c16400417adfa`
- `images/bananarchy-nokia-argon.img`: `e15e0fff0e68d059000caf28f73a061170a9da62368531499c6d82b275821903`
- `images/bananarchy-nokia-beatles.img`: `64fcf14fbe8863490d8a3b2838e66baa9e9b5712450526ca0b9e3bed5d724437`
- `images/boot-bananarchy-nokia-beatles.img`: `7c6aec20941b074cd36c856f62cb9b51b4ad2fe111c4f43f68844e07b828fb84`
- `images/bananarchy-nokia-coconut.img`: `753029acf664a78b6990d799c060ee29ccb8b464bc0a4c40c1909b1a1a5dbfcb`
- `images/boot-bananarchy-nokia-coconut.img`: `948c44097e069624d60cf952de065961b38e9d45c77bcee958684b96d86dbb7c`
- `images/bananarchy-nokia-sparkler.img`: `36e3a663de0d2586422aa5303a18ce2a70f05274d4d2ff7e377cf5dad243c777`
- `images/boot-bananarchy-nokia-sparkler.img`: `f40757646fb9a5c0c489df370f59a97a5638d36bda037042a98be894b47bcf8e`
---