diff --git a/AGENTS.md b/AGENTS.md index 11a3000..1405ee8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -176,7 +176,7 @@ Keep this file short. Full details live in `README.md`, `MANUAL.md`, `SDK.md`, ` keypad udev/Xorg rules, BusyBox applet lists, and `scripts/set-bananarchy-hostname.sh`. - The Power menu label is **Reboot to loader** and still calls `sxmo_power.sh bootloader`; `Logout` is removed from `dmenu.c`, `dmenu.so`, `sxmo_appmenu.sh`, and `sxmo_hook_contextmenu.sh`. Keep the compact Power menu layout synchronized. -- Keep `quagr` (`quagr.so` / `xquagr`) receiver autostart strictly gated on `autostart_rx=1` plus a valid Rx passphrase or 64-char hex key, closed-flip `QUAGR` cover alerts dismissing on any side button (`scripts/test-quagr.py`), `msm8905-cam.c` 180-degree rotation enabled for `nokia,beatles`, `nokia,sparkler`, and `nokia,leo` alongside cached `row_buf` RAW10 demosaic; keep `patches/kernel/0013-msm8909-early-scm-smp-cpufreq.patch` (4-core SMP + `cpufreq` up to `1.267 GHz`), `patches/kernel/0014-input-core-keypad-debouncer.patch` (ABI-preserving `input_core` `/sys/module/input_core/parameters/key_debounce_ms` debouncer without editing `include/linux/input.h`, `pm8941-pwrkey` chatter holdoff, `col-scan-delay-us = <0x32>` across all 6 DTS/DTBs, `xset r rate 300 25`, `scripts/test-keypad-debouncer.py`), `patches/kernel/0015-msm8909-wcd-digital-interpolator-cajon-analog.patch` (`REGCACHE_FLAT` 97-register `0x00` `.reg_defaults` without `.volatile_reg` + unconditional `regmap_write_bits` in `probe`/`hw_params`/`enable_interpolator`/`enable_dec` + `msm8916_wcd_digital_force_sync_ctl()` `.use_pmdown_time = 0` `48 kHz` programming in `msm8916-wcd-digital.c`, ADSP `< 2.7` `AFE_PORT_ID_PRIMARY_MI2S_RX` `INT_DIGITAL_CDC_CLK` retention in `q6afe.c` + `q6core_query_versions_locked()` in `q6core.c`, PM8909 `CAJON_2_0` `CDC_A_PERPH_SUBTYPE == 0x0a` non-boost Class-D `0x69`/`0xE9` PA, HPH DAC/PA sequencing, `NCP_FBCTRL = 0xA8`, `NCP_VCTRL = 0xA4`/`0xA7`, `RX_HPH_BIAS_PA = 0xFA`, `SPKR_ANA_BIAS_SET = 0x41`, `s2` wakeup restore without clobbering `SPK DAC Switch`, MBHC `DIG_CLK_CTL_D_MBHC_CLK_EN` + `CDC_A_MASTER_BIAS_CTL = 0x30` idle retention, and `CDC_A_MBHC_RESULT_2` 3/4-pole detection in `msm8916-wcd-analog.c`), WirePlumber `create-item.lua` + `msm8916-s16le.conf` `item.features.mono = true` (`[ MONO ]` `PortConfig` with `channelmix.normalize = true`) Speaker/Earpiece stereo-to-mono downmix and `/etc/pipewire/{client,pipewire-pulse}.conf.d/10-bananarchy-audio.conf` (`channelmix.normalize = true`, `dither.method = "triangular"`), `<= 84` (`0 dB`) ALSA digital output ceiling with `card0` PipeWire unity sync + `bananarchy-soundmonitor` initial internal sink sync & `iface=CARD` / `drain_jack_events()` coalescing (`scripts/test-audio-quality.py`), disabled `vibrator@c000` + volume-independent calibrated `157.0 Hz` haptic audio (`sxmo_vibrate.c`, `libpulse` + `SND_PCM_FORMAT_FLOAT_LE`, `HAPTIC_REF_RX3_VOL = 84`), Sparkler/Leo `157 Hz` LRA media filtering (`highpass=f=260` + `bandreject=f=157` on Speaker + non-speaker `RX3` zeroing in `music.so`, `files.so`, `ringtones.so`, `sxmo_audio.sh`, and Sparkler-only `/etc/mpv/mpv.conf` via `apply-bananarchy-overlay.sh`), `DEFAULT_USB_TIMEOUT_MS = 30000` (`--usb-timeout`), and `sxmo_timer.sh` / `dmenu.c` keypad cancellation (`scripts/test-timer.py`, `scripts/test-sparkler-port.py`, `scripts/test-edl-firehose-read.py`, `scripts/test-quagr.py`). +- Keep `quagr` (`quagr.so` / `xquagr`) receiver autostart strictly gated on `autostart_rx=1` plus a valid Rx passphrase or 64-char hex key, closed-flip `QUAGR` cover alerts dismissing on any side button (`scripts/test-quagr.py`), `msm8905-cam.c` 180-degree rotation enabled for `nokia,beatles`, `nokia,sparkler`, and `nokia,leo` alongside cached `row_buf` RAW10 demosaic; keep `patches/kernel/0013-msm8909-early-scm-smp-cpufreq.patch` (4-core SMP + `cpufreq` up to `1.267 GHz`), `patches/kernel/0014-input-core-keypad-debouncer.patch` (ABI-preserving `input_core` `/sys/module/input_core/parameters/key_debounce_ms` debouncer without editing `include/linux/input.h`, `pm8941-pwrkey` chatter holdoff, `col-scan-delay-us = <0x32>` across all 6 DTS/DTBs, `xset r rate 300 25`, `scripts/test-keypad-debouncer.py`), `patches/kernel/0015-msm8909-wcd-digital-interpolator-cajon-analog.patch` (`REGCACHE_FLAT` 97-register `0x00` `.reg_defaults` without `.volatile_reg` + unconditional `regmap_write_bits` in `probe`/`hw_params`/`enable_interpolator`/`enable_dec` + full stateful `msm8916_wcd_digital_reg_defaults` syncing in `msm8916_wcd_digital_force_sync_ctl()` `.use_pmdown_time = 0` `48 kHz` programming in `msm8916-wcd-digital.c`, ADSP `< 2.7` `AFE_PORT_ID_PRIMARY_MI2S_RX` `INT_DIGITAL_CDC_CLK` retention in `q6afe.c` + `q6core_query_versions_locked()` in `q6core.c`, PM8909 `CDC_A_RX_COM_OCP_CTL = 0x12` + unlocked `SEC_ACCESS` `PERPH_RESET_CTL4` `1 -> 0` reset + non-boost Class-D `0x69`/`0xE9` PA + `s2` wakeup restore without clobbering `SPK DAC Switch` split across `CONGA` (`CDC_D_PERPH_SUBTYPE == 0x02`, `NCP_FBCTRL = 0x28`, omitting `CAJON`-only `RX_HPH_TEST_CAJON_CFG`/`NCP_VCTRL`/`RX_HPH_BIAS_PA`) and `CAJON_2_0` (`CDC_A_PERPH_SUBTYPE == 0x0a`, `NCP_FBCTRL = 0xA8`, `NCP_VCTRL = 0xA4`/`0xA7`, `RX_HPH_BIAS_PA = 0xFA`, `SPKR_ANA_BIAS_SET = 0x41`), HPH DAC/PA sequencing, MBHC `DIG_CLK_CTL_D_MBHC_CLK_EN` + `CDC_A_MASTER_BIAS_CTL = 0x30` idle retention, and `CDC_A_MBHC_RESULT_2` 3/4-pole detection in `msm8916-wcd-analog.c`), WirePlumber `create-item.lua` + `msm8916-s16le.conf` `item.features.mono = true` (`[ MONO ]` `PortConfig` with `channelmix.normalize = true`) Speaker/Earpiece stereo-to-mono downmix and `/etc/pipewire/{client,pipewire-pulse}.conf.d/10-bananarchy-audio.conf` (`channelmix.normalize = true`, `dither.method = "triangular"`), `<= 84` (`0 dB`) ALSA digital output ceiling with `card0` PipeWire unity sync + `bananarchy-soundmonitor` initial internal sink sync & `iface=CARD` / `drain_jack_events()` coalescing (`scripts/test-audio-quality.py`), disabled `vibrator@c000` + volume-independent calibrated `157.0 Hz` haptic audio (`sxmo_vibrate.c`, `libpulse` + `SND_PCM_FORMAT_FLOAT_LE`, `HAPTIC_REF_RX3_VOL = 84`), Sparkler/Leo `157 Hz` LRA media filtering (`highpass=f=260` + `bandreject=f=157` on Speaker + non-speaker `RX3` zeroing in `music.so`, `files.so`, `ringtones.so`, `sxmo_audio.sh`, and Sparkler-only `/etc/mpv/mpv.conf` via `apply-bananarchy-overlay.sh`), `DEFAULT_USB_TIMEOUT_MS = 30000` (`--usb-timeout`), and `sxmo_timer.sh` / `dmenu.c` keypad cancellation (`scripts/test-timer.py`, `scripts/test-sparkler-port.py`, `scripts/test-edl-firehose-read.py`, `scripts/test-quagr.py`). - Bluetooth HOGP config and plugin load are verified, but full hardware sign-off still needs a wake-up paired keyboard and **Connect Device** to confirm real HID key events. diff --git a/CHANGELOG.md b/CHANGELOG.md index 23a6ab3..bfc6c5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,9 +16,9 @@ Release versions follow the `
` 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 +### Audio playback quality (`0015` WCD `48 kHz` interpolators, PM8909 `CONGA` / `CAJON_2_0` analog codec, PipeWire downmix & unity gain staging) across all targets -- **48 kHz WCD digital interpolators/decimators, MBHC wired jack autodetection, & 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 previously 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()`, while placing non-zero operating values directly in `.reg_defaults` would let `regcache_mark_dirty()` / `no_sync_defaults` skip re-writing `RX1/2/3_B5_CTL` after MSM8905 `INT_DIGITAL_CDC_CLK` resets, and marking `.volatile_reg` would expose unclocked `0x0771c000` LPASS AHB debugfs reads) by adding complete 97-register `0x00` hardware-reset `msm8916_wcd_digital_reg_defaults[]` with `valid_reg` (without `.volatile_reg`), `probe()` non-zero POR writes via `regmap_write_bits()`, unconditional `regmap_write_bits()` (`force=true`) in `hw_params()` (`RX1/2/3_B5_CTL = (rx_fs_rate << 5) | BIT(3)`, `TX1/2_CLK_FS_CTL = tx_fs_rate`), `enable_interpolator()`, and `enable_dec()`, plus `msm8916_wcd_digital_force_sync_ctl()` across `startup()`/`runtime_resume()` and `.use_pmdown_time = 0`; fixed MSM8905 (`Q6_ADSP_VERSION_2_6`) `q6afe.c` and `q6core.c` clock/version handling by passing explicit `AFE_PORT_ID_PRIMARY_MI2S_RX` (`0x1000`) in `q6afe_set_param_v2()` for `Q6AFE_LPASS_CLK_ID_INTERNAL_DIGITAL_CODEC_CORE` on ADSP `< 2.7`, retaining `afe->digital_cdc_clk_freq` across `q6afe_port_stop(PRIMARY_MI2S_RX)` until runtime suspend disables `mclk`, and falling back to `q6core_get_svc_versions()` in `q6core_query_versions_locked()` without latching `Q6_ADSP_VERSION_UNKNOWN` on early APR timeouts; 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), added `CAJON_2_0` `HPHL DAC`/`HPHR DAC`/`HPH PA` DAPM sequencing and `+6 dB` analog `EAR PA` headroom (`RX_EAR_CTL BIT(5)`), and fixed `0012` MBHC jack autodetection starvation by preserving `DIG_CLK_CTL_D_MBHC_CLK_EN` (`0xf04A BIT(3)`) and `CDC_A_MASTER_BIAS_CTL = 0x30` while gating the `100 uA` button ISRC (`CDC_A_MBHC_FSM_CTL`), `MICB_1_INT_TX2_INT_RBIAS`, button IRQs, and Linux `pm8909_s2` regulator vote off at unplugged idle, reading `CDC_A_MBHC_RESULT_2` (`0xf159 BIT(4)` `SWCH_LEVEL_REMOVE`) in `probe()`, `set_jack()`, and `pm8916_mbhc_switch_irq_handler()` (`phys_ins != waiting_ins` clear-edge guard), and distinguishing 3-pole TRS vs 4-pole TRRS headsets via `MBHC_BUTTON_PRESS_DET` after FSM settle. Verified initial `0015` build live on connected `nokia-sparkler` (`Nokia 8000 4G`): `050/070/090 = 0x68`, `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`; verified updated `0015` build live on connected `nokia-beatles` (`Nokia 2720 Flip`): `050/070/090 = 0x00000068` and `198/290/2b0 = 0x00000003` safely readable at idle, during playback, and after `2.5 s` idle suspend without AHB hangs, alongside idle MBHC readiness (`f04a = 0x08`, `f146 = 0x30`, `f147 = 0xb4`, `f150 = 0xf1`, `f151 = 0x00`, `f015 = 0x80`, `f159 = 0x10`) and `pm8909_s2` `state=disabled` / `num_users=0`. +- **48 kHz WCD digital interpolators/decimators, MBHC wired jack autodetection, & PM8909 `CONGA` / `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 previously 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()`, while placing non-zero operating values directly in `.reg_defaults` would let `regcache_mark_dirty()` / `no_sync_defaults` skip re-writing `RX1/2/3_B5_CTL` after MSM8905 `INT_DIGITAL_CDC_CLK` resets, and marking `.volatile_reg` would expose unclocked `0x0771c000` LPASS AHB debugfs reads) by adding complete 97-register `0x00` hardware-reset `msm8916_wcd_digital_reg_defaults[]` with `valid_reg` (without `.volatile_reg`), `probe()` non-zero POR writes via `regmap_write_bits()`, unconditional `regmap_write_bits()` (`force=true`) in `hw_params()` (`RX1/2/3_B5_CTL = (rx_fs_rate << 5) | BIT(3)`, `TX1/2_CLK_FS_CTL = tx_fs_rate`), `enable_interpolator()`, and `enable_dec()`, plus full stateful `msm8916_wcd_digital_reg_defaults[]` syncing in `msm8916_wcd_digital_force_sync_ctl()` across `startup()`/`runtime_resume()` and `.use_pmdown_time = 0`; fixed MSM8905 (`Q6_ADSP_VERSION_2_6`) `q6afe.c` and `q6core.c` clock/version handling by passing explicit `AFE_PORT_ID_PRIMARY_MI2S_RX` (`0x1000`) in `q6afe_set_param_v2()` for `Q6AFE_LPASS_CLK_ID_INTERNAL_DIGITAL_CODEC_CORE` on ADSP `< 2.7`, retaining `afe->digital_cdc_clk_freq` across `q6afe_port_stop(PRIMARY_MI2S_RX)` until runtime suspend disables `mclk`, and falling back to `q6core_get_svc_versions()` in `q6core_query_versions_locked()` without latching `Q6_ADSP_VERSION_UNKNOWN` on early APR timeouts; set `CDC_A_RX_COM_OCP_CTL = 0x12` (`350 mA` limit instead of `0xD1`) and unlocked `CDC_D_SEC_ACCESS` / `CDC_A_SEC_ACCESS` (`0xA5`) around `PERPH_RESET_CTL4` `1 -> 0` reset in `pm8916_wcd_analog_probe()`; split PM8909 `CONGA` (`CDC_D_PERPH_SUBTYPE == 0x02`, `wcd_reg_defaults_conga` `NCP_FBCTRL = 0x28`, omitting `CAJON`-only `RX_HPH_TEST_CAJON_CFG` `0x80` / `NCP_VCTRL` / `RX_HPH_BIAS_PA` / `RX_HPH_BIAS_CNP` / `RX_HPH_CNP_EN_PU_MASK` writes that silenced `HPHR` right-channel headphone output on `nokia-sparkler`) from `CAJON_2_0` (`CDC_A_PERPH_SUBTYPE == 0x0a`, `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 restored defaults across `s2` standby gating without clobbering `SPK DAC Switch`, configured non-boost Class-D `SPK PA` (`SPKR_DRV_CTL = 0x69`/`0xE9`), `HPHL DAC`/`HPHR DAC`/`HPH PA` DAPM sequencing, and `+6 dB` analog `EAR PA` headroom (`RX_EAR_CTL BIT(5)`) for PM8909; and fixed `0012` MBHC jack autodetection starvation by preserving `DIG_CLK_CTL_D_MBHC_CLK_EN` (`0xf04A BIT(3)`) and `CDC_A_MASTER_BIAS_CTL = 0x30` while gating the `100 uA` button ISRC (`CDC_A_MBHC_FSM_CTL`), `MICB_1_INT_TX2_INT_RBIAS`, button IRQs, and Linux `pm8909_s2` regulator vote off at unplugged idle, reading `CDC_A_MBHC_RESULT_2` (`0xf159 BIT(4)` `SWCH_LEVEL_REMOVE`) in `probe()`, `set_jack()`, and `pm8916_mbhc_switch_irq_handler()` (`phys_ins != waiting_ins` clear-edge guard), and distinguishing 3-pole TRS vs 4-pole TRRS headsets via `MBHC_BUTTON_PRESS_DET` after FSM settle. Verified live on connected `nokia-sparkler` (`PMIC REV: 0 CODEC Version: 2 (CONGA)` with full stereo `997 Hz` L / `2113 Hz` R headphone output matching within `0.07 dB` on `HiFi__Headset__source` and audible Left/Right/Both confirmation), and previously verified on `nokia-beatles` (`CAJON_2_0`, `050/070/090 = 0x00000068`, `198/290/2b0 = 0x00000003`, idle MBHC readiness, `pm8909_s2` `state=disabled`). - **Lossless PipeWire stereo-to-mono downmix, TPDF dithering, `<= 0 dB` unity gain staging, and jack autodetection (`create-item.lua`, `msm8916-s16le.conf`, `10-bananarchy-audio.conf`, `UCM2`, `sxmo_audio.sh`, `sxmo_modemaudio.sh`, `sxmo_hook_statusbar.sh`, `bananarchy-soundmonitor`, `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`, `bananarchy_set_sink_volume` covering `@DEFAULT_AUDIO_SINK@`, sink ID fallback, and `pactl @DEFAULT_SINK@`, plus 500 ms `alsa_output.platform-7702000.sound.HiFi__*__sink` readiness wait in `sync_pipewire_profile` and initial `has_internal_sink()` / `internal_synced` jack-aware sync in `bananarchy-soundmonitor`); fixed `bananarchy-soundmonitor.c`, `sxmo_audio.sh`, `sxmo_modemaudio.sh`, and `sxmo_hook_statusbar.sh` jack autodetection (`iface=CARD,name='Headphone Jack'`/`'Mic Jack'` queries, `50 ms` `drain_jack_events()` coalescing into one atomic `sxmo_audio.sh device set` switch, stale persisted `Headphones`/`Headset` boot fallback when unplugged, call handoff Mic/Headset preservation, and dark-screen statusbar volume updates); 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]`, `0.5 * FL + 0.5 * FR` DFT, `sxmo_vibrate` `vib_rc=0`) and on `nokia-beatles` boot with stale `~/.config/sxmo/audio_out_device = Headphones` (`/tmp/sxmo_audio_out_device = Speaker`, `wpctl` `Built-in Audio Speaker playback [vol: 1.00]`, `Active Profile: HiFi (Mic1, Speaker)`). ### Cellular PS attach, Dual-SIM QMI WDS subscription binding (`libmm-wds-bind.so`), and mobile data (`wwan0`) fixes across all targets @@ -49,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`: `5df590a5c0a74a1594882e3d83a81c7691bdd3bfc396a320eb6e84e27f41b356` - - `images/bananarchy-nokia-beatles.img`: `55cb9c17347735ff066f9a88f3b3e5c574281296ff78ac796cf79e2bbd0c2b81` - - `images/boot-bananarchy-nokia-beatles.img`: `4500324c8c875588b60063befb9f852069ce5a84b70c92025708c412ddc9a30e` - - `images/bananarchy-nokia-coconut.img`: `5d629a64b6c82b0ce46af7135e2eff8620142043903c2e65f27a7163a9b21b32` - - `images/boot-bananarchy-nokia-coconut.img`: `c6c1d3fe3ad8eae39cc0ec6eeae14de136fd7524430976cb39ba79255a5dd9c2` - - `images/bananarchy-nokia-sparkler.img`: `efd541291277e702f67b18b9bf90a7571e459c87c124a705d6dad265dc032be8` - - `images/boot-bananarchy-nokia-sparkler.img`: `ba922d89ad0a778086ef6a400d48b816125ad017d24d5bd81ad601d77293342e` + - `images/bananarchy-nokia-argon.img`: `34490465fe0f6ec89283495d0c1afc754205cfc8b6048895d8452ab4e677048e` + - `images/bananarchy-nokia-beatles.img`: `c77b1fbfff31a08ce34d28ee950ea04211074bf7a2d45c97b7d24dabad178c4` + - `images/boot-bananarchy-nokia-beatles.img`: `e42f548a025a1b902995333dedd1b5807a7bf750e758c8aa0ab8843cf45a3227` + - `images/bananarchy-nokia-coconut.img`: `b2189eb9f3be83af33770abce61574047d3232a49760aac4894600f9e5d2b8cd` + - `images/boot-bananarchy-nokia-coconut.img`: `379fd1ca70671505520609d4a2745b4eb1784152bbc2dca2d80b438b3d65e382` + - `images/bananarchy-nokia-sparkler.img`: `3ebd73a99f63a849282f84f4aeba08cf499346a600b5adedb66633d1588414db` + - `images/boot-bananarchy-nokia-sparkler.img`: `d00909d3b970af8cd93a7e53d3ef6a291b5ed55518ba858aae034439fa2acf02` --- diff --git a/overlay/rootfs/boot/vmlinuz b/overlay/rootfs/boot/vmlinuz index db51156..ed5ac47 100755 Binary files a/overlay/rootfs/boot/vmlinuz and b/overlay/rootfs/boot/vmlinuz differ diff --git a/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/sound/soc/codecs/snd-soc-msm8916-analog.ko.zst b/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/sound/soc/codecs/snd-soc-msm8916-analog.ko.zst index 583edd3..335f245 100644 Binary files a/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/sound/soc/codecs/snd-soc-msm8916-analog.ko.zst and b/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/sound/soc/codecs/snd-soc-msm8916-analog.ko.zst differ diff --git a/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/sound/soc/codecs/snd-soc-msm8916-digital.ko.zst b/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/sound/soc/codecs/snd-soc-msm8916-digital.ko.zst index c2a2fbb..ef446d4 100644 Binary files a/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/sound/soc/codecs/snd-soc-msm8916-digital.ko.zst and b/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/sound/soc/codecs/snd-soc-msm8916-digital.ko.zst differ diff --git a/patches/kernel/0015-msm8909-wcd-digital-interpolator-cajon-analog.patch b/patches/kernel/0015-msm8909-wcd-digital-interpolator-cajon-analog.patch index 14adac4..8e2cd69 100644 --- a/patches/kernel/0015-msm8909-wcd-digital-interpolator-cajon-analog.patch +++ b/patches/kernel/0015-msm8909-wcd-digital-interpolator-cajon-analog.patch @@ -1,16 +1,17 @@ diff --git a/sound/soc/codecs/msm8916-wcd-analog.c b/sound/soc/codecs/msm8916-wcd-analog.c -index 257f780..f820437 100644 +index 257f780..5ae2e09 100644 --- a/sound/soc/codecs/msm8916-wcd-analog.c +++ b/sound/soc/codecs/msm8916-wcd-analog.c -@@ -82,6 +82,7 @@ +@@ -82,6 +82,8 @@ #define CDC_A_REVISION4 (0xf103) #define CDC_A_PERPH_TYPE (0xf104) #define CDC_A_PERPH_SUBTYPE (0xf105) ++#define CDC_D_PERPH_SUBTYPE_CONGA 0x02 +#define CDC_A_PERPH_SUBTYPE_CAJON 0x0a #define CDC_A_INT_RT_STS (0xf110) #define CDC_A_INT_SET_TYPE (0xf111) #define CDC_A_INT_POLARITY_HIGH (0xf112) -@@ -191,6 +192,8 @@ +@@ -191,6 +193,8 @@ CDC_A_MBHC_BTN_VREF_FINE_MASK) #define CDC_A_MBHC_RESULT_1 (0xf158) #define CDC_A_MBHC_RESULT_1_BTN_RESULT_MASK GENMASK(4, 0) @@ -19,7 +20,7 @@ index 257f780..f820437 100644 #define CDC_A_TX_1_EN (0xf160) #define CDC_A_TX_2_EN (0xf161) #define CDC_A_TX_1_2_TEST_CTL_1 (0xf162) -@@ -220,20 +223,28 @@ +@@ -220,20 +224,28 @@ #define CDC_A_RX_HPH_BIAS_LDO_OCP (0xf195) #define CDC_A_RX_HPH_BIAS_CNP (0xf196) #define CDC_A_RX_HPH_CNP_EN (0xf197) @@ -48,7 +49,7 @@ index 257f780..f820437 100644 #define CDC_A_SPKR_DAC_CTL (0xf1B0) #define SPKR_DAC_CTL_DAC_RESET_MASK BIT(4) -@@ -249,10 +260,13 @@ +@@ -249,10 +261,13 @@ #define SPKR_DRV_BOOST_SET BIT(2) #define SPKR_DRV_CMFB_SET BIT(1) #define SPKR_DRV_GAIN_SET BIT(0) @@ -62,16 +63,24 @@ index 257f780..f820437 100644 #define CDC_A_SPKR_OCP_CTL (0xf1B4) #define CDC_A_SPKR_PWRSTG_CTL (0xf1B5) #define SPKR_PWRSTG_CTL_DAC_EN_MASK BIT(0) -@@ -314,6 +328,8 @@ struct pm8916_wcd_analog_priv { +@@ -314,8 +329,16 @@ struct pm8916_wcd_analog_priv { bool audio_active; bool jack_inserted; bool s2_enabled; + bool is_cajon; ++ bool is_conga; + int jack_report; }; ++static inline bool pm8916_wcd_is_pm8909(const struct pm8916_wcd_analog_priv *priv) ++{ ++ return priv->is_cajon || priv->is_conga; ++} ++ static const char *const adc2_mux_text[] = { "ZERO", "INP2", "INP3" }; -@@ -435,6 +451,36 @@ static int pm8916_wcd_analog_enable_micbias2(struct snd_soc_dapm_widget *w, + static const char *const rdac2_mux_text[] = { "RX1", "RX2" }; + static const char *const hph_text[] = { "ZERO", "Switch", }; +@@ -435,6 +458,36 @@ static int pm8916_wcd_analog_enable_micbias2(struct snd_soc_dapm_widget *w, } @@ -108,12 +117,12 @@ index 257f780..f820437 100644 static int pm8916_wcd_analog_update_power_locked(struct snd_soc_component *component) { struct pm8916_wcd_analog_priv *priv = snd_soc_component_get_drvdata(component); -@@ -446,19 +492,31 @@ static int pm8916_wcd_analog_update_power_locked(struct snd_soc_component *compo +@@ -446,19 +499,31 @@ static int pm8916_wcd_analog_update_power_locked(struct snd_soc_component *compo if (!ret) { priv->s2_enabled = true; usleep_range(1000, 1500); - snd_soc_component_write(component, CDC_A_MASTER_BIAS_CTL, 0x30); -+ if (priv->is_cajon) ++ if (pm8916_wcd_is_pm8909(priv)) + pm8916_wcd_analog_apply_defaults(component, true); + else + snd_soc_component_write(component, CDC_A_MASTER_BIAS_CTL, 0x30); @@ -147,7 +156,7 @@ index 257f780..f820437 100644 regulator_disable(priv->supplies[1].consumer); priv->s2_enabled = false; } -@@ -698,37 +756,81 @@ static int pm8916_wcd_analog_enable_spk_pa(struct snd_soc_dapm_widget *w, +@@ -698,37 +763,81 @@ static int pm8916_wcd_analog_enable_spk_pa(struct snd_soc_dapm_widget *w, int event) { struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); @@ -164,7 +173,7 @@ index 257f780..f820437 100644 - SPKR_PWRSTG_CTL_BBM_EN | - SPKR_PWRSTG_CTL_HBRDGE_EN | - SPKR_PWRSTG_CTL_CLAMP_EN); -+ if (priv->is_cajon) { ++ if (pm8916_wcd_is_pm8909(priv)) { + snd_soc_component_update_bits(component, CDC_A_SPKR_PWRSTG_CTL, + SPKR_PWRSTG_CTL_DAC_EN_MASK, + SPKR_PWRSTG_CTL_DAC_EN); @@ -197,7 +206,7 @@ index 257f780..f820437 100644 - snd_soc_component_update_bits(component, CDC_A_SPKR_DRV_CTL, - SPKR_DRV_CTL_DEF_MASK, - SPKR_DRV_CTL_DEF_VAL); -+ if (priv->is_cajon) { ++ if (pm8916_wcd_is_pm8909(priv)) { + usleep_range(1000, 1100); + snd_soc_component_update_bits(component, CDC_A_SPKR_DAC_CTL, + SPKR_DAC_CTL_DAC_RESET_MASK, @@ -216,7 +225,7 @@ index 257f780..f820437 100644 SPKR_DRV_CLASSD_PA_EN_ENABLE); break; + case SND_SOC_DAPM_PRE_PMD: -+ if (priv->is_cajon) { ++ if (pm8916_wcd_is_pm8909(priv)) { + snd_soc_component_update_bits(component, CDC_A_SPKR_DAC_CTL, + SPKR_DAC_CTL_DAC_RESET_MASK, + SPKR_DAC_CTL_DAC_RESET_MASK); @@ -230,7 +239,7 @@ index 257f780..f820437 100644 - SPKR_PWRSTG_CTL_BBM_MASK | - SPKR_PWRSTG_CTL_HBRDGE_EN_MASK | - SPKR_PWRSTG_CTL_CLAMP_EN_MASK, 0); -+ if (priv->is_cajon) { ++ if (pm8916_wcd_is_pm8909(priv)) { + snd_soc_component_update_bits(component, CDC_A_SPKR_PWRSTG_CTL, + SPKR_PWRSTG_CTL_MASK, 0); + usleep_range(1000, 1100); @@ -246,7 +255,7 @@ index 257f780..f820437 100644 snd_soc_component_update_bits(component, CDC_A_SPKR_DAC_CTL, SPKR_DAC_CTL_DAC_RESET_MASK, -@@ -745,11 +847,15 @@ static int pm8916_wcd_analog_enable_ear_pa(struct snd_soc_dapm_widget *w, +@@ -745,11 +854,15 @@ static int pm8916_wcd_analog_enable_ear_pa(struct snd_soc_dapm_widget *w, int event) { struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); @@ -257,19 +266,19 @@ index 257f780..f820437 100644 snd_soc_component_update_bits(component, CDC_A_RX_EAR_CTL, - RX_EAR_CTL_PA_SEL_MASK, RX_EAR_CTL_PA_SEL); + RX_EAR_CTL_PA_SEL_MASK | -+ (priv->is_cajon ? RX_EAR_CTL_PA_GAIN_POS_6_DB_MASK : 0), ++ (pm8916_wcd_is_pm8909(priv) ? RX_EAR_CTL_PA_GAIN_POS_6_DB_MASK : 0), + RX_EAR_CTL_PA_SEL | -+ (priv->is_cajon ? RX_EAR_CTL_PA_GAIN_POS_6_DB : 0)); ++ (pm8916_wcd_is_pm8909(priv) ? RX_EAR_CTL_PA_GAIN_POS_6_DB : 0)); break; case SND_SOC_DAPM_POST_PMU: snd_soc_component_update_bits(component, CDC_A_RX_EAR_CTL, -@@ -762,7 +868,114 @@ static int pm8916_wcd_analog_enable_ear_pa(struct snd_soc_dapm_widget *w, +@@ -762,14 +875,127 @@ static int pm8916_wcd_analog_enable_ear_pa(struct snd_soc_dapm_widget *w, /* Delay to reduce ear turn off pop */ usleep_range(7000, 7100); snd_soc_component_update_bits(component, CDC_A_RX_EAR_CTL, - RX_EAR_CTL_PA_SEL_MASK, 0); + RX_EAR_CTL_PA_SEL_MASK | -+ (priv->is_cajon ? RX_EAR_CTL_PA_GAIN_POS_6_DB_MASK : 0), ++ (pm8916_wcd_is_pm8909(priv) ? RX_EAR_CTL_PA_GAIN_POS_6_DB_MASK : 0), + 0); + break; + } @@ -297,11 +306,13 @@ index 257f780..f820437 100644 + RX_HPH_TEST_CAJON_CFG); + snd_soc_component_update_bits(component, CDC_A_RX_HPH_CNP_EN, + CDC_A_RX_HPH_CNP_EN_PU_MASK, 0); ++ snd_soc_component_update_bits(component, CDC_A_NCP_VCTRL, ++ 0x07, 0x07); ++ } ++ if (pm8916_wcd_is_pm8909(priv)) { + snd_soc_component_update_bits(component, CDC_A_RX_EAR_CTL, + RX_EAR_CTL_PA_GAIN_POS_6_DB_MASK, + RX_EAR_CTL_PA_GAIN_POS_6_DB); -+ snd_soc_component_update_bits(component, CDC_A_NCP_VCTRL, -+ 0x07, 0x07); + } + snd_soc_component_update_bits(component, CDC_A_RX_HPH_L_PA_DAC_CTL, + RX_HPA_L_PA_DAC_CTL_DATA_RESET_MASK, @@ -312,9 +323,11 @@ index 257f780..f820437 100644 + RX_HPA_L_PA_DAC_CTL_DATA_RESET_MASK, 0); + break; + case SND_SOC_DAPM_POST_PMD: -+ if (priv->is_cajon) { ++ if (pm8916_wcd_is_pm8909(priv)) { + snd_soc_component_update_bits(component, CDC_A_RX_EAR_CTL, + RX_EAR_CTL_PA_GAIN_POS_6_DB_MASK, 0); ++ } ++ if (priv->is_cajon) { + snd_soc_component_update_bits(component, CDC_A_NCP_VCTRL, + 0x07, 0x04); + } @@ -351,7 +364,7 @@ index 257f780..f820437 100644 + struct pm8916_wcd_analog_priv *priv = snd_soc_component_get_drvdata(component); + unsigned int test_reg = (w->shift == 5) ? CDC_A_RX_HPH_L_TEST : CDC_A_RX_HPH_R_TEST; + -+ if (!priv->is_cajon) ++ if (!pm8916_wcd_is_pm8909(priv)) + return 0; + + switch (event) { @@ -369,22 +382,32 @@ index 257f780..f820437 100644 + case SND_SOC_DAPM_PRE_PMD: + snd_soc_component_update_bits(component, test_reg, + RX_HPH_TEST_PA_EN, 0); -+ snd_soc_component_update_bits(component, CDC_A_RX_HPH_BIAS_CNP, -+ 0xF0, 0x30); ++ if (priv->is_cajon) ++ snd_soc_component_update_bits(component, CDC_A_RX_HPH_BIAS_CNP, ++ 0xF0, 0x30); + break; + case SND_SOC_DAPM_POST_PMD: -+ snd_soc_component_update_bits(component, CDC_A_RX_HPH_BIAS_CNP, -+ 0xF0, 0x20); ++ if (priv->is_cajon) ++ snd_soc_component_update_bits(component, CDC_A_RX_HPH_BIAS_CNP, ++ 0xF0, 0x20); + usleep_range(5000, 5200); break; } return 0; -@@ -787,10 +1000,59 @@ static const struct reg_default wcd_reg_defaults_2_0[] = { + } + + static const struct reg_default wcd_reg_defaults_2_0[] = { +- {CDC_A_RX_COM_OCP_CTL, 0xD1}, ++ {CDC_A_RX_COM_OCP_CTL, 0x12}, + {CDC_A_RX_COM_OCP_COUNT, 0xFF}, + {CDC_D_SEC_ACCESS, 0xA5}, + {CDC_D_PERPH_RESET_CTL3, 0x0F}, +@@ -787,10 +1013,83 @@ static const struct reg_default wcd_reg_defaults_2_0[] = { {CDC_A_MASTER_BIAS_CTL, 0x30}, }; +static const struct reg_default wcd_reg_defaults_cajon_2_0[] = { -+ {CDC_A_RX_COM_OCP_CTL, 0xD1}, ++ {CDC_A_RX_COM_OCP_CTL, 0x12}, + {CDC_A_RX_COM_OCP_COUNT, 0xFF}, + {CDC_D_SEC_ACCESS, 0xA5}, + {CDC_D_PERPH_RESET_CTL3, 0x0F}, @@ -403,15 +426,39 @@ index 257f780..f820437 100644 + {CDC_A_MASTER_BIAS_CTL, 0x30}, +}; + ++static const struct reg_default wcd_reg_defaults_conga[] = { ++ {CDC_A_RX_COM_OCP_CTL, 0x12}, ++ {CDC_A_RX_COM_OCP_COUNT, 0xFF}, ++ {CDC_D_SEC_ACCESS, 0xA5}, ++ {CDC_D_PERPH_RESET_CTL3, 0x0F}, ++ {CDC_A_SEC_ACCESS, 0xA5}, ++ {CDC_A_PERPH_RESET_CTL3, 0x0F}, ++ {CDC_A_TX_1_2_OPAMP_BIAS, 0x4C}, ++ {CDC_A_NCP_FBCTRL, 0x28}, ++ {CDC_A_SPKR_DRV_CTL, 0x69}, ++ {CDC_A_SPKR_DRV_DBG, 0x01}, ++ {CDC_A_SPKR_DAC_CTL, 0x03}, ++ {CDC_A_SPKR_OCP_CTL, 0xE1}, ++ {CDC_A_MASTER_BIAS_CTL, 0x30}, ++}; ++ +static void pm8916_wcd_analog_apply_defaults(struct snd_soc_component *component, + bool preserve_switch) +{ + struct pm8916_wcd_analog_priv *priv = snd_soc_component_get_drvdata(component); -+ const struct reg_default *defs = priv->is_cajon ? -+ wcd_reg_defaults_cajon_2_0 : wcd_reg_defaults_2_0; -+ size_t count = priv->is_cajon ? -+ ARRAY_SIZE(wcd_reg_defaults_cajon_2_0) : -+ ARRAY_SIZE(wcd_reg_defaults_2_0); ++ const struct reg_default *defs; ++ size_t count; ++ ++ if (priv->is_conga) { ++ defs = wcd_reg_defaults_conga; ++ count = ARRAY_SIZE(wcd_reg_defaults_conga); ++ } else if (priv->is_cajon) { ++ defs = wcd_reg_defaults_cajon_2_0; ++ count = ARRAY_SIZE(wcd_reg_defaults_cajon_2_0); ++ } else { ++ defs = wcd_reg_defaults_2_0; ++ count = ARRAY_SIZE(wcd_reg_defaults_2_0); ++ } + size_t i; + + for (i = 0; i < count; i++) { @@ -440,21 +487,31 @@ index 257f780..f820437 100644 err = regulator_bulk_enable(ARRAY_SIZE(priv->supplies), priv->supplies); if (err != 0) { -@@ -806,16 +1068,17 @@ static int pm8916_wcd_analog_probe(struct snd_soc_component *component) +@@ -806,16 +1105,27 @@ static int pm8916_wcd_analog_probe(struct snd_soc_component *component) snd_soc_component_set_drvdata(component, priv); priv->pmic_rev = snd_soc_component_read(component, CDC_D_REVISION1); priv->codec_version = snd_soc_component_read(component, CDC_D_PERPH_SUBTYPE); -+ priv->is_cajon = (snd_soc_component_read(component, CDC_A_PERPH_SUBTYPE) == ++ priv->is_conga = (priv->codec_version == CDC_D_PERPH_SUBTYPE_CONGA); ++ priv->is_cajon = !priv->is_conga && ++ (snd_soc_component_read(component, CDC_A_PERPH_SUBTYPE) == + CDC_A_PERPH_SUBTYPE_CAJON); - dev_info(component->dev, "PMIC REV: %d\t CODEC Version: %d\n", - priv->pmic_rev, priv->codec_version); + dev_info(component->dev, "PMIC REV: %d\t CODEC Version: %d%s\n", + priv->pmic_rev, priv->codec_version, -+ priv->is_cajon ? " (CAJON)" : ""); ++ priv->is_conga ? " (CONGA)" : (priv->is_cajon ? " (CAJON)" : "")); ++ snd_soc_component_write(component, CDC_D_SEC_ACCESS, 0xA5); snd_soc_component_write(component, CDC_D_PERPH_RESET_CTL4, 0x01); ++ snd_soc_component_write(component, CDC_A_SEC_ACCESS, 0xA5); snd_soc_component_write(component, CDC_A_PERPH_RESET_CTL4, 0x01); ++ usleep_range(500, 1000); ++ snd_soc_component_write(component, CDC_D_SEC_ACCESS, 0xA5); ++ snd_soc_component_write(component, CDC_D_PERPH_RESET_CTL4, 0x00); ++ snd_soc_component_write(component, CDC_A_SEC_ACCESS, 0xA5); ++ snd_soc_component_write(component, CDC_A_PERPH_RESET_CTL4, 0x00); ++ usleep_range(500, 1000); - for (reg = 0; reg < ARRAY_SIZE(wcd_reg_defaults_2_0); reg++) - snd_soc_component_write(component, wcd_reg_defaults_2_0[reg].reg, @@ -463,7 +520,7 @@ index 257f780..f820437 100644 priv->component = component; -@@ -824,24 +1087,21 @@ static int pm8916_wcd_analog_probe(struct snd_soc_component *component) +@@ -824,24 +1134,21 @@ static int pm8916_wcd_analog_probe(struct snd_soc_component *component) RST_CTL_DIG_SW_RST_N_REMOVE_RESET); pm8916_wcd_setup_mbhc(priv); @@ -501,7 +558,7 @@ index 257f780..f820437 100644 return 0; } -@@ -981,14 +1241,27 @@ static const struct snd_soc_dapm_widget pm8916_wcd_analog_dapm_widgets[] = { +@@ -981,14 +1288,27 @@ static const struct snd_soc_dapm_widget pm8916_wcd_analog_dapm_widgets[] = { SND_SOC_DAPM_MUX("EAR_S", SND_SOC_NOPM, 0, 0, &ear_mux), SND_SOC_DAPM_SUPPLY("EAR CP", CDC_A_NCP_EN, 4, 0, NULL, 0), @@ -535,7 +592,7 @@ index 257f780..f820437 100644 SND_SOC_DAPM_MIXER("SPK DAC", SND_SOC_NOPM, 0, 0, spkr_switch, ARRAY_SIZE(spkr_switch)), -@@ -1094,6 +1367,14 @@ static int pm8916_wcd_analog_set_jack(struct snd_soc_component *component, +@@ -1094,6 +1414,14 @@ static int pm8916_wcd_analog_set_jack(struct snd_soc_component *component, } wcd->jack = jack; @@ -550,7 +607,7 @@ index 257f780..f820437 100644 return 0; } -@@ -1164,9 +1445,14 @@ static int pm8916_wcd_analog_switch_check(struct pm8916_wcd_analog_priv *priv, b +@@ -1164,9 +1492,14 @@ static int pm8916_wcd_analog_switch_check(struct pm8916_wcd_analog_priv *priv, b CDC_A_MBHC_DET_CTL_MECH_DET_TYPE_MASK, (!ins << CDC_A_MBHC_DET_CTL_MECH_DET_TYPE_SHIFT)); @@ -566,7 +623,7 @@ index 257f780..f820437 100644 mutex_lock(&priv->power_lock); priv->jack_inserted = true; -@@ -1176,33 +1462,56 @@ static int pm8916_wcd_analog_switch_check(struct pm8916_wcd_analog_priv *priv, b +@@ -1176,33 +1509,56 @@ static int pm8916_wcd_analog_switch_check(struct pm8916_wcd_analog_priv *priv, b snd_soc_component_update_bits(component, CDC_D_CDC_DIG_CLK_CTL, DIG_CLK_CTL_D_MBHC_CLK_EN_MASK, DIG_CLK_CTL_D_MBHC_CLK_EN); @@ -635,7 +692,7 @@ index 257f780..f820437 100644 report = 0; priv->detect_accessory_type = true; priv->mbhc_btn0_released = false; -@@ -1210,8 +1519,10 @@ static int pm8916_wcd_analog_switch_check(struct pm8916_wcd_analog_priv *priv, b +@@ -1210,8 +1566,10 @@ static int pm8916_wcd_analog_switch_check(struct pm8916_wcd_analog_priv *priv, b snd_soc_component_write(component, CDC_D_INT_EN_CLR, MBHC_BUTTON_PRESS_DET | MBHC_BUTTON_RELEASE_DET); @@ -646,7 +703,7 @@ index 257f780..f820437 100644 pm8916_wcd_analog_update_power_locked(component); mutex_unlock(&priv->power_lock); } -@@ -1223,15 +1534,22 @@ static irqreturn_t pm8916_mbhc_switch_irq_handler(int irq, void *arg) +@@ -1223,15 +1581,22 @@ static irqreturn_t pm8916_mbhc_switch_irq_handler(int irq, void *arg) { struct pm8916_wcd_analog_priv *priv = arg; struct snd_soc_component *component = priv->component; @@ -676,7 +733,7 @@ index 257f780..f820437 100644 return IRQ_HANDLED; } diff --git a/sound/soc/codecs/msm8916-wcd-digital.c b/sound/soc/codecs/msm8916-wcd-digital.c -index 81d1134..fc2520e 100644 +index 81d1134..074a319 100644 --- a/sound/soc/codecs/msm8916-wcd-digital.c +++ b/sound/soc/codecs/msm8916-wcd-digital.c @@ -85,6 +85,9 @@ @@ -860,38 +917,16 @@ index 81d1134..fc2520e 100644 break; default: dev_err(dai->dev, "%s: wrong format selected\n", __func__); -@@ -1071,6 +1112,30 @@ static const struct snd_soc_dapm_route msm8916_wcd_digital_audio_map[] = { +@@ -1071,6 +1112,8 @@ static const struct snd_soc_dapm_route msm8916_wcd_digital_audio_map[] = { }; -+static void msm8916_wcd_digital_force_sync_ctl(struct regmap *map) -+{ -+ static const unsigned int ctl_regs[] = { -+ LPASS_CDC_CLK_RX_I2S_CTL, -+ LPASS_CDC_CLK_TX_I2S_CTL, -+ LPASS_CDC_CLK_OTHR_CTL, -+ LPASS_CDC_RX1_B5_CTL, -+ LPASS_CDC_RX2_B5_CTL, -+ LPASS_CDC_RX3_B5_CTL, -+ LPASS_CDC_TOP_CTL, -+ LPASS_CDC_IIR1_CTL, -+ LPASS_CDC_IIR2_CTL, -+ LPASS_CDC_TX1_CLK_FS_CTL, -+ LPASS_CDC_TX2_CLK_FS_CTL, -+ }; -+ unsigned int val; -+ size_t i; -+ -+ for (i = 0; i < ARRAY_SIZE(ctl_regs); i++) { -+ if (regmap_read(map, ctl_regs[i], &val) == 0) -+ regmap_write_bits(map, ctl_regs[i], ~0U, val); -+ } -+} ++static void msm8916_wcd_digital_force_sync_ctl(struct regmap *map); + static int msm8916_wcd_digital_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { -@@ -1079,29 +1144,30 @@ static int msm8916_wcd_digital_startup(struct snd_pcm_substream *substream, +@@ -1079,29 +1122,30 @@ static int msm8916_wcd_digital_startup(struct snd_pcm_substream *substream, unsigned long mclk_rate; msm8916_wcd = snd_soc_component_get_drvdata(component); @@ -934,7 +969,7 @@ index 81d1134..fc2520e 100644 return 0; } -@@ -1155,15 +1221,139 @@ static const struct snd_soc_component_driver msm8916_wcd_digital = { +@@ -1155,18 +1199,168 @@ static const struct snd_soc_component_driver msm8916_wcd_digital = { .dapm_routes = msm8916_wcd_digital_audio_map, .num_dapm_routes = ARRAY_SIZE(msm8916_wcd_digital_audio_map), .idle_bias_on = 0, @@ -1075,7 +1110,36 @@ index 81d1134..fc2520e 100644 .cache_type = REGCACHE_FLAT, }; -@@ -1195,7 +1385,11 @@ static int msm8916_wcd_digital_runtime_resume(struct device *dev) ++static void msm8916_wcd_digital_force_sync_ctl(struct regmap *map) ++{ ++ unsigned int val; ++ size_t i; ++ ++ for (i = 0; i < ARRAY_SIZE(msm8916_wcd_digital_reg_defaults); i++) { ++ unsigned int reg = msm8916_wcd_digital_reg_defaults[i].reg; ++ ++ switch (reg) { ++ case LPASS_CDC_CLK_RX_RESET_CTL: ++ case LPASS_CDC_CLK_TX_RESET_B1_CTL: ++ case LPASS_CDC_CLK_OTHR_RESET_B1_CTL: ++ case LPASS_CDC_TOP_GAIN_UPDATE: ++ case LPASS_CDC_IIR1_COEF_B1_CTL: ++ case LPASS_CDC_IIR1_COEF_B2_CTL: ++ case LPASS_CDC_IIR2_COEF_B1_CTL: ++ case LPASS_CDC_IIR2_COEF_B2_CTL: ++ continue; ++ default: ++ if (regmap_read(map, reg, &val) == 0) ++ regmap_write_bits(map, reg, ~0U, val); ++ break; ++ } ++ } ++} ++ + static int msm8916_wcd_digital_runtime_suspend(struct device *dev) + { + struct msm8916_wcd_digital_priv *priv = dev_get_drvdata(dev); +@@ -1195,7 +1389,11 @@ static int msm8916_wcd_digital_runtime_resume(struct device *dev) } regcache_cache_only(priv->regmap, false); @@ -1088,7 +1152,7 @@ index 81d1134..fc2520e 100644 } static const struct dev_pm_ops msm8916_wcd_digital_pm_ops = { -@@ -1209,7 +1403,6 @@ static int msm8916_wcd_digital_probe(struct platform_device *pdev) +@@ -1209,7 +1407,6 @@ static int msm8916_wcd_digital_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; void __iomem *base; struct regmap *digital_map; @@ -1096,7 +1160,7 @@ index 81d1134..fc2520e 100644 int ret; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); -@@ -1244,8 +1437,17 @@ static int msm8916_wcd_digital_probe(struct platform_device *pdev) +@@ -1244,8 +1441,17 @@ static int msm8916_wcd_digital_probe(struct platform_device *pdev) goto err_clk; } diff --git a/prebuilt/kernel-6.12.1-msm8916/codecs/snd-soc-msm8916-analog.ko b/prebuilt/kernel-6.12.1-msm8916/codecs/snd-soc-msm8916-analog.ko index 550821c..054dda3 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/codecs/snd-soc-msm8916-analog.ko and b/prebuilt/kernel-6.12.1-msm8916/codecs/snd-soc-msm8916-analog.ko differ diff --git a/prebuilt/kernel-6.12.1-msm8916/codecs/snd-soc-msm8916-analog.ko.zst b/prebuilt/kernel-6.12.1-msm8916/codecs/snd-soc-msm8916-analog.ko.zst index 583edd3..335f245 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/codecs/snd-soc-msm8916-analog.ko.zst and b/prebuilt/kernel-6.12.1-msm8916/codecs/snd-soc-msm8916-analog.ko.zst differ diff --git a/prebuilt/kernel-6.12.1-msm8916/codecs/snd-soc-msm8916-digital.ko b/prebuilt/kernel-6.12.1-msm8916/codecs/snd-soc-msm8916-digital.ko index b34f1eb..9eda5e9 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/codecs/snd-soc-msm8916-digital.ko and b/prebuilt/kernel-6.12.1-msm8916/codecs/snd-soc-msm8916-digital.ko differ diff --git a/prebuilt/kernel-6.12.1-msm8916/codecs/snd-soc-msm8916-digital.ko.zst b/prebuilt/kernel-6.12.1-msm8916/codecs/snd-soc-msm8916-digital.ko.zst index c2a2fbb..ef446d4 100644 Binary files a/prebuilt/kernel-6.12.1-msm8916/codecs/snd-soc-msm8916-digital.ko.zst and b/prebuilt/kernel-6.12.1-msm8916/codecs/snd-soc-msm8916-digital.ko.zst differ diff --git a/prebuilt/kernel-6.12.1-msm8916/vmlinuz b/prebuilt/kernel-6.12.1-msm8916/vmlinuz index db51156..ed5ac47 100755 Binary files a/prebuilt/kernel-6.12.1-msm8916/vmlinuz and b/prebuilt/kernel-6.12.1-msm8916/vmlinuz differ diff --git a/scripts/check-rebuild.sh b/scripts/check-rebuild.sh index 6d702b8..23750c9 100755 --- a/scripts/check-rebuild.sh +++ b/scripts/check-rebuild.sh @@ -564,15 +564,15 @@ fi echo "[check] Known-good flashable image set..." for pair in \ - "5df590a5c0a74a1594882e3d83a81c7691bdd3bfc396a320eb6e84e27f41b356 images/bananarchy-nokia-argon.img" \ - "55cb9c17347735ff066f9a88f3b3e5c574281296ff78ac796cf79e2bbd0c2b81 images/bananarchy-nokia-beatles.img" \ - "4500324c8c875588b60063befb9f852069ce5a84b70c92025708c412ddc9a30e images/boot-bananarchy-nokia-beatles.img" \ + "34490465fe0f6ec89283495d0c1afc754205cfc8b6048895d8452ab4e677048e images/bananarchy-nokia-argon.img" \ + "c77b1fbfff31a08ce34d28ee950ea04211074bf07a2d45c97b7d24dabad178c4 images/bananarchy-nokia-beatles.img" \ + "e42f548a025a1b902995333dedd1b5807a7bf750e758c8aa0ab8843cf45a3227 images/boot-bananarchy-nokia-beatles.img" \ "f13db705a714aaebd2d8fcc2e0f7266d0e40268c0a276208117dfdf9d8f45351 images/boot-lk2nd-nokia-beatles-display.img" \ - "5d629a64b6c82b0ce46af7135e2eff8620142043903c2e65f27a7163a9b21b32 images/bananarchy-nokia-coconut.img" \ - "c6c1d3fe3ad8eae39cc0ec6eeae14de136fd7524430976cb39ba79255a5dd9c2 images/boot-bananarchy-nokia-coconut.img" \ + "b2189eb9f3be83af33770abce61574047d3232a49760aac4894600f9e5d2b8cd images/bananarchy-nokia-coconut.img" \ + "379fd1ca70671505520609d4a2745b4eb1784152bbc2dca2d80b438b3d65e382 images/boot-bananarchy-nokia-coconut.img" \ "9a5bd2da6cfd95c745d9c1acb2e3bc61afa339824810e3d160bf079e17b23192 images/boot-lk2nd-nokia-coconut-display.img" \ - "efd541291277e702f67b18b9bf90a7571e459c87c124a705d6dad265dc032be8 images/bananarchy-nokia-sparkler.img" \ - "ba922d89ad0a778086ef6a400d48b816125ad017d24d5bd81ad601d77293342e images/boot-bananarchy-nokia-sparkler.img" \ + "3ebd73a99f63a849282f84f4aeba08cf499346a600b5adedb66633d1588414db images/bananarchy-nokia-sparkler.img" \ + "d00909d3b970af8cd93a7e53d3ef6a291b5ed55518ba858aae034439fa2acf02 images/boot-bananarchy-nokia-sparkler.img" \ "120ade81bc5416263a1afd95a29981675358b98516e105e5ed611edf258a29f7 images/boot-lk2nd-nokia-sparkler-display.img"; do set -- $pair want=$1 diff --git a/scripts/test-audio-quality.py b/scripts/test-audio-quality.py index 635415d..2b051bc 100755 --- a/scripts/test-audio-quality.py +++ b/scripts/test-audio-quality.py @@ -189,6 +189,11 @@ def check_patch_0015(): "q6core_query_versions_locked", "core->adsp_version != Q6_ADSP_VERSION_UNKNOWN", "wcd_reg_defaults_cajon_2_0", + "wcd_reg_defaults_conga", + "pm8916_wcd_is_pm8909", + "CDC_D_PERPH_SUBTYPE_CONGA", + "{CDC_A_RX_COM_OCP_CTL, 0x12}", + "{CDC_A_NCP_FBCTRL, 0x28}", "{CDC_A_NCP_FBCTRL, 0xA8}", "{CDC_A_NCP_VCTRL, 0xA4}", "{CDC_A_RX_HPH_BIAS_PA, 0xFA}", @@ -200,6 +205,9 @@ def check_patch_0015(): "pm8916_wcd_analog_enable_hphr_dac", "pm8916_wcd_analog_enable_hph_pa", "pm8916_wcd_analog_apply_defaults(component, true);", + "snd_soc_component_write(component, CDC_D_PERPH_RESET_CTL4, 0x00);", + "snd_soc_component_write(component, CDC_A_PERPH_RESET_CTL4, 0x00);", + "ARRAY_SIZE(msm8916_wcd_digital_reg_defaults)", "CDC_A_MBHC_RESULT_2_SWCH_LEVEL_REMOVE", "pm8916_mbhc_plug_present", "DIG_CLK_CTL_D_MBHC_CLK_EN", @@ -214,6 +222,8 @@ def check_patch_0015(): analog_diff = txt.split("diff --git a/sound/soc/codecs/msm8916-wcd-digital.c")[0] if "+ snd_soc_component_write(component, CDC_A_MASTER_BIAS_CTL, 0x00);" in analog_diff: return fail("0015 must not zero CDC_A_MASTER_BIAS_CTL on s2 idle gating") + if "+\t{CDC_A_RX_COM_OCP_CTL, 0xD1}" in analog_diff: + return fail("0015 must use 0x12 (350 mA) RX_COM_OCP_CTL default, not 0xD1") if ".volatile_reg" in txt: return fail("0015 patch must not set .volatile_reg on msm8916_codec_regmap_config")