Fix MSM8905 WCD 48 kHz interpolators, ADSP clock retention, and boot audio sync
Ensure LPASS_CDC_RX1/2/3_B5_CTL and TX1/2_CLK_FS_CTL are always reprogrammed for 48 kHz on MSM8905 (Q6_ADSP_VERSION_2_6) targets (nokia-beatles, nokia-argon, nokia-coconut), preserve INT_DIGITAL_CDC_CLK on ADSP < 2.7, eliminate unclocked debugfs AHB reads, harden PipeWire boot sink/unity sync, and update rebuilt a1125 (ampere) image checksums.
This commit is contained in:
1 parent
4f73c28e5e
commit
aba38a58f2
21 files changed
+568
-104
No files matched your search
@@ -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` `.reg_defaults` `0x050/0x070/0x090 = 0x68` + `hw_params` `RXn_B5_CTL` / `TXn_CLK_FS_CTL` `48 kHz` programming in `msm8916-wcd-digital.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`, and `s2` wakeup restore without clobbering `SPK DAC Switch` 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 (`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` + `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`, and `s2` wakeup restore without clobbering `SPK DAC Switch` 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 (`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.
|
||||
|
||||
|
||||
+9
-9
@@ -18,8 +18,8 @@ Upcoming release build (`a1125` / `ampere` via `scripts/version.sh`) targeting *
|
||||
|
||||
### 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`.
|
||||
- **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 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), 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 initial `0015` build 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` (live MSM8905 `nokia-beatles` verification pending reboot/reflash after the updated `0015` build).
|
||||
- **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`, `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`) 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
|
||||
|
||||
@@ -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`: `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`
|
||||
- `images/bananarchy-nokia-argon.img`: `6279d2b99600aee7751f501257ac48d485eaeee3b3f31c0f98a2b8522400bcd1`
|
||||
- `images/bananarchy-nokia-beatles.img`: `f067a130984d7fe6f79fdf46b3ff657bbe19fe12400e5db1e6ebd4cac24d1e6c`
|
||||
- `images/boot-bananarchy-nokia-beatles.img`: `d32c7a38ac85df7faa71d2649d7c6ead1adcef0af39c3e91f08993965ddd44b9`
|
||||
- `images/bananarchy-nokia-coconut.img`: `4d6733b633ca78ec7fe5de93e1ed0564a3aa116088aee3634147759a414af2c7`
|
||||
- `images/boot-bananarchy-nokia-coconut.img`: `fdad08c8501de6b53c6ac76b7886849834fc8840ffec289b41a5c58e924ac803`
|
||||
- `images/bananarchy-nokia-sparkler.img`: `068f4fa606bee9c63ac6044902e04a28d596b04edcd230d9703a2687951ee4bb`
|
||||
- `images/boot-bananarchy-nokia-sparkler.img`: `026852df5acc871738322ff1de3febf91c097f0f1d745fbbe71f22661023b0e2`
|
||||
|
||||
---
|
||||
|
||||
|
||||
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -573,8 +573,19 @@ bananarchy_set_sink_volume() {
|
||||
export XDG_RUNTIME_DIR
|
||||
fi
|
||||
if command -v wpctl >/dev/null 2>&1; then
|
||||
sink="$(wpctl status 2>/dev/null | sed -n '/Sinks:/,/Sources:/p' \
|
||||
| sed -n 's/^[^0-9]*\([0-9][0-9]*\)\..*/\1/p' | head -n 1)"
|
||||
wpctl set-volume @DEFAULT_AUDIO_SINK@ "${pct}%" >/dev/null 2>&1 || true
|
||||
if [ "$pct" -le 0 ]; then
|
||||
wpctl set-mute @DEFAULT_AUDIO_SINK@ 1 >/dev/null 2>&1 || true
|
||||
else
|
||||
wpctl set-mute @DEFAULT_AUDIO_SINK@ 0 >/dev/null 2>&1 || true
|
||||
fi
|
||||
sinks_sec="$(wpctl status 2>/dev/null | sed -n '/Sinks:/,/Sources:/p')"
|
||||
sink="$(printf '%s\n' "$sinks_sec" \
|
||||
| sed -n 's/^[^0-9*]*\*[[:space:]]*\([0-9][0-9]*\)\..*/\1/p' | head -n 1)"
|
||||
if [ -z "$sink" ]; then
|
||||
sink="$(printf '%s\n' "$sinks_sec" \
|
||||
| sed -n 's/^[^0-9]*\([0-9][0-9]*\)\..*/\1/p' | head -n 1)"
|
||||
fi
|
||||
if [ -n "$sink" ]; then
|
||||
wpctl set-volume "$sink" "${pct}%" >/dev/null 2>&1 || true
|
||||
if [ "$pct" -le 0 ]; then
|
||||
@@ -582,10 +593,14 @@ bananarchy_set_sink_volume() {
|
||||
else
|
||||
wpctl set-mute "$sink" 0 >/dev/null 2>&1 || true
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
pactl set-sink-volume @DEFAULT_SINK@ "${pct}%" >/dev/null 2>&1 || true
|
||||
if [ "$pct" -le 0 ]; then
|
||||
pactl set-sink-mute @DEFAULT_SINK@ 1 >/dev/null 2>&1 || true
|
||||
else
|
||||
pactl set-sink-mute @DEFAULT_SINK@ 0 >/dev/null 2>&1 || true
|
||||
fi
|
||||
}
|
||||
|
||||
apply_vol_out() {
|
||||
@@ -880,6 +895,16 @@ sync_pipewire_profile() {
|
||||
else
|
||||
rm -f /tmp/sxmo_bt_connecting 2>/dev/null || true
|
||||
sink_name="alsa_output.platform-7702000.sound.HiFi__${out_dev}__sink"
|
||||
if [ -d /proc/asound/card0 ] && command -v pactl >/dev/null 2>&1; then
|
||||
_sw=0
|
||||
while [ "$_sw" -lt 10 ]; do
|
||||
if pactl list short sinks 2>/dev/null | grep -Fq "$sink_name"; then
|
||||
break
|
||||
fi
|
||||
sleep 0.05
|
||||
_sw=$(( _sw + 1 ))
|
||||
done
|
||||
fi
|
||||
pactl set-default-sink "$sink_name" >/dev/null 2>&1 || true
|
||||
move_streams_to_sink "$sink_name"
|
||||
fi
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
diff --git a/sound/soc/codecs/msm8916-wcd-analog.c b/sound/soc/codecs/msm8916-wcd-analog.c
|
||||
index 257f780..457b552 100644
|
||||
--- a/sound/soc/codecs/msm8916-wcd-analog.c
|
||||
+++ b/sound/soc/codecs/msm8916-wcd-analog.c
|
||||
@@ -82,6 +82,7 @@
|
||||
@@ -51,7 +53,7 @@
|
||||
#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 +326,7 @@
|
||||
@@ -314,6 +326,7 @@ struct pm8916_wcd_analog_priv {
|
||||
bool audio_active;
|
||||
bool jack_inserted;
|
||||
bool s2_enabled;
|
||||
@@ -59,7 +61,7 @@
|
||||
};
|
||||
|
||||
static const char *const adc2_mux_text[] = { "ZERO", "INP2", "INP3" };
|
||||
@@ -435,6 +448,9 @@
|
||||
@@ -435,6 +448,9 @@ static int pm8916_wcd_analog_enable_micbias2(struct snd_soc_dapm_widget *w,
|
||||
|
||||
}
|
||||
|
||||
@@ -69,7 +71,7 @@
|
||||
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,7 +462,10 @@
|
||||
@@ -446,7 +462,10 @@ static int pm8916_wcd_analog_update_power_locked(struct snd_soc_component *compo
|
||||
if (!ret) {
|
||||
priv->s2_enabled = true;
|
||||
usleep_range(1000, 1500);
|
||||
@@ -81,7 +83,7 @@
|
||||
} else {
|
||||
dev_err(component->dev, "failed to enable vdd-cdc-tx-rx-cx (%d)\n", ret);
|
||||
}
|
||||
@@ -698,37 +717,81 @@
|
||||
@@ -698,37 +717,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);
|
||||
@@ -180,7 +182,7 @@
|
||||
|
||||
snd_soc_component_update_bits(component, CDC_A_SPKR_DAC_CTL,
|
||||
SPKR_DAC_CTL_DAC_RESET_MASK,
|
||||
@@ -745,11 +808,15 @@
|
||||
@@ -745,11 +808,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);
|
||||
@@ -197,7 +199,7 @@
|
||||
break;
|
||||
case SND_SOC_DAPM_POST_PMU:
|
||||
snd_soc_component_update_bits(component, CDC_A_RX_EAR_CTL,
|
||||
@@ -762,7 +829,114 @@
|
||||
@@ -762,7 +829,114 @@ 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,
|
||||
@@ -313,7 +315,7 @@
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
@@ -787,10 +961,59 @@
|
||||
@@ -787,10 +961,59 @@ static const struct reg_default wcd_reg_defaults_2_0[] = {
|
||||
{CDC_A_MASTER_BIAS_CTL, 0x30},
|
||||
};
|
||||
|
||||
@@ -374,7 +376,7 @@
|
||||
|
||||
err = regulator_bulk_enable(ARRAY_SIZE(priv->supplies), priv->supplies);
|
||||
if (err != 0) {
|
||||
@@ -806,16 +1029,17 @@
|
||||
@@ -806,16 +1029,17 @@ 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);
|
||||
@@ -397,7 +399,7 @@
|
||||
|
||||
priv->component = component;
|
||||
|
||||
@@ -981,14 +1205,27 @@
|
||||
@@ -981,14 +1205,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),
|
||||
|
||||
@@ -431,6 +433,8 @@
|
||||
SND_SOC_DAPM_MIXER("SPK DAC", SND_SOC_NOPM, 0, 0,
|
||||
spkr_switch, ARRAY_SIZE(spkr_switch)),
|
||||
|
||||
diff --git a/sound/soc/codecs/msm8916-wcd-digital.c b/sound/soc/codecs/msm8916-wcd-digital.c
|
||||
index 81d1134..fc2520e 100644
|
||||
--- a/sound/soc/codecs/msm8916-wcd-digital.c
|
||||
+++ b/sound/soc/codecs/msm8916-wcd-digital.c
|
||||
@@ -85,6 +85,9 @@
|
||||
@@ -451,46 +455,261 @@
|
||||
#define LPASS_CDC_TX1_DMIC_CTL (0x294)
|
||||
#define LPASS_CDC_TX2_DMIC_CTL (0x2B4)
|
||||
#define TXN_DMIC_CTL_CLK_SEL_MASK GENMASK(2, 0)
|
||||
@@ -895,10 +899,29 @@
|
||||
@@ -236,6 +240,12 @@ static const unsigned long rx_gain_reg[] = {
|
||||
LPASS_CDC_RX3_VOL_CTL_B2_CTL,
|
||||
};
|
||||
|
||||
+static const unsigned long rx_b5_reg[] = {
|
||||
+ LPASS_CDC_RX1_B5_CTL,
|
||||
+ LPASS_CDC_RX2_B5_CTL,
|
||||
+ LPASS_CDC_RX3_B5_CTL,
|
||||
+};
|
||||
+
|
||||
static const unsigned long tx_gain_reg[] = {
|
||||
LPASS_CDC_TX1_VOL_CTL_GAIN,
|
||||
LPASS_CDC_TX2_VOL_CTL_GAIN,
|
||||
@@ -580,19 +590,26 @@ static int msm8916_wcd_digital_enable_interpolator(
|
||||
int event)
|
||||
{
|
||||
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
||||
+ struct msm8916_wcd_digital_priv *priv = snd_soc_component_get_drvdata(component);
|
||||
|
||||
switch (event) {
|
||||
+ case SND_SOC_DAPM_PRE_PMU:
|
||||
+ regmap_write_bits(priv->regmap, rx_b5_reg[w->shift], ~0U,
|
||||
+ snd_soc_component_read(component, rx_b5_reg[w->shift]));
|
||||
+ break;
|
||||
case SND_SOC_DAPM_POST_PMU:
|
||||
/* apply the digital gain after the interpolator is enabled */
|
||||
usleep_range(10000, 10100);
|
||||
+ regmap_write_bits(priv->regmap, rx_b5_reg[w->shift], ~0U,
|
||||
+ snd_soc_component_read(component, rx_b5_reg[w->shift]));
|
||||
snd_soc_component_write(component, rx_gain_reg[w->shift],
|
||||
snd_soc_component_read(component, rx_gain_reg[w->shift]));
|
||||
break;
|
||||
case SND_SOC_DAPM_POST_PMD:
|
||||
- snd_soc_component_update_bits(component, LPASS_CDC_CLK_RX_RESET_CTL,
|
||||
- 1 << w->shift, 1 << w->shift);
|
||||
- snd_soc_component_update_bits(component, LPASS_CDC_CLK_RX_RESET_CTL,
|
||||
- 1 << w->shift, 0x0);
|
||||
+ regmap_write_bits(priv->regmap, LPASS_CDC_CLK_RX_RESET_CTL,
|
||||
+ BIT(w->shift), BIT(w->shift));
|
||||
+ regmap_write_bits(priv->regmap, LPASS_CDC_CLK_RX_RESET_CTL,
|
||||
+ BIT(w->shift), 0);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
@@ -603,6 +620,7 @@ static int msm8916_wcd_digital_enable_dec(struct snd_soc_dapm_widget *w,
|
||||
int event)
|
||||
{
|
||||
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
||||
+ struct msm8916_wcd_digital_priv *priv = snd_soc_component_get_drvdata(component);
|
||||
unsigned int decimator = w->shift + 1;
|
||||
u16 dec_reset_reg, tx_vol_ctl_reg, tx_mux_ctl_reg;
|
||||
u8 dec_hpf_cut_of_freq;
|
||||
@@ -647,9 +665,9 @@ static int msm8916_wcd_digital_enable_dec(struct snd_soc_dapm_widget *w,
|
||||
TX_MUX_CTL_HPF_BP_SEL_BYPASS);
|
||||
break;
|
||||
case SND_SOC_DAPM_POST_PMD:
|
||||
- snd_soc_component_update_bits(component, dec_reset_reg, 1 << w->shift,
|
||||
- 1 << w->shift);
|
||||
- snd_soc_component_update_bits(component, dec_reset_reg, 1 << w->shift, 0x0);
|
||||
+ regmap_write_bits(priv->regmap, dec_reset_reg, BIT(w->shift),
|
||||
+ BIT(w->shift));
|
||||
+ regmap_write_bits(priv->regmap, dec_reset_reg, BIT(w->shift), 0);
|
||||
snd_soc_component_update_bits(component, tx_mux_ctl_reg,
|
||||
TX_MUX_CTL_HPF_BP_SEL_MASK,
|
||||
TX_MUX_CTL_HPF_BP_SEL_BYPASS);
|
||||
@@ -741,13 +759,16 @@ static const struct snd_soc_dapm_widget msm8916_wcd_digital_dapm_widgets[] = {
|
||||
/* Interpolator */
|
||||
SND_SOC_DAPM_MIXER_E("RX1 INT", LPASS_CDC_CLK_RX_B1_CTL, 0, 0, NULL,
|
||||
0, msm8916_wcd_digital_enable_interpolator,
|
||||
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
|
||||
+ SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
|
||||
+ SND_SOC_DAPM_POST_PMD),
|
||||
SND_SOC_DAPM_MIXER_E("RX2 INT", LPASS_CDC_CLK_RX_B1_CTL, 1, 0, NULL,
|
||||
0, msm8916_wcd_digital_enable_interpolator,
|
||||
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
|
||||
+ SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
|
||||
+ SND_SOC_DAPM_POST_PMD),
|
||||
SND_SOC_DAPM_MIXER_E("RX3 INT", LPASS_CDC_CLK_RX_B1_CTL, 2, 0, NULL,
|
||||
0, msm8916_wcd_digital_enable_interpolator,
|
||||
- SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
|
||||
+ SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
|
||||
+ SND_SOC_DAPM_POST_PMD),
|
||||
SND_SOC_DAPM_MUX("RX1 MIX1 INP1", SND_SOC_NOPM, 0, 0,
|
||||
&rx_mix1_inp1_mux),
|
||||
SND_SOC_DAPM_MUX("RX1 MIX1 INP2", SND_SOC_NOPM, 0, 0,
|
||||
@@ -865,6 +886,7 @@ static int msm8916_wcd_digital_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
+ struct msm8916_wcd_digital_priv *priv = snd_soc_component_get_drvdata(dai->component);
|
||||
u8 tx_fs_rate;
|
||||
u8 rx_fs_rate;
|
||||
|
||||
@@ -893,12 +915,31 @@ static int msm8916_wcd_digital_hw_params(struct snd_pcm_substream *substream,
|
||||
|
||||
switch (substream->stream) {
|
||||
case SNDRV_PCM_STREAM_CAPTURE:
|
||||
snd_soc_component_update_bits(dai->component, LPASS_CDC_CLK_TX_I2S_CTL,
|
||||
TX_I2S_CTL_TX_I2S_FS_RATE_MASK, tx_fs_rate);
|
||||
+ snd_soc_component_update_bits(dai->component, LPASS_CDC_TX1_CLK_FS_CTL,
|
||||
+ TXn_CLK_FS_CTL_FS_RATE_MASK, tx_fs_rate);
|
||||
+ snd_soc_component_update_bits(dai->component, LPASS_CDC_TX2_CLK_FS_CTL,
|
||||
+ TXn_CLK_FS_CTL_FS_RATE_MASK, tx_fs_rate);
|
||||
- snd_soc_component_update_bits(dai->component, LPASS_CDC_CLK_TX_I2S_CTL,
|
||||
- TX_I2S_CTL_TX_I2S_FS_RATE_MASK, tx_fs_rate);
|
||||
+ regmap_write_bits(priv->regmap, LPASS_CDC_CLK_TX_I2S_CTL,
|
||||
+ TX_I2S_CTL_TX_I2S_FS_RATE_MASK, tx_fs_rate);
|
||||
+ regmap_write_bits(priv->regmap, LPASS_CDC_TX1_CLK_FS_CTL,
|
||||
+ TXn_CLK_FS_CTL_FS_RATE_MASK, tx_fs_rate);
|
||||
+ regmap_write_bits(priv->regmap, LPASS_CDC_TX2_CLK_FS_CTL,
|
||||
+ TXn_CLK_FS_CTL_FS_RATE_MASK, tx_fs_rate);
|
||||
break;
|
||||
case SNDRV_PCM_STREAM_PLAYBACK:
|
||||
snd_soc_component_update_bits(dai->component, LPASS_CDC_CLK_RX_I2S_CTL,
|
||||
RX_I2S_CTL_RX_I2S_FS_RATE_MASK, rx_fs_rate);
|
||||
+ snd_soc_component_update_bits(dai->component, LPASS_CDC_RX1_B5_CTL,
|
||||
+ RXn_B5_CTL_INTERP_FS_RATE_MASK |
|
||||
+ RXn_B5_CTL_INTERP_HALFBAND_EN,
|
||||
+ (rx_fs_rate << RXn_B5_CTL_INTERP_FS_RATE_SHIFT) |
|
||||
+ RXn_B5_CTL_INTERP_HALFBAND_EN);
|
||||
+ snd_soc_component_update_bits(dai->component, LPASS_CDC_RX2_B5_CTL,
|
||||
+ RXn_B5_CTL_INTERP_FS_RATE_MASK |
|
||||
+ RXn_B5_CTL_INTERP_HALFBAND_EN,
|
||||
+ (rx_fs_rate << RXn_B5_CTL_INTERP_FS_RATE_SHIFT) |
|
||||
+ RXn_B5_CTL_INTERP_HALFBAND_EN);
|
||||
+ snd_soc_component_update_bits(dai->component, LPASS_CDC_RX3_B5_CTL,
|
||||
+ RXn_B5_CTL_INTERP_FS_RATE_MASK |
|
||||
+ RXn_B5_CTL_INTERP_HALFBAND_EN,
|
||||
+ (rx_fs_rate << RXn_B5_CTL_INTERP_FS_RATE_SHIFT) |
|
||||
+ RXn_B5_CTL_INTERP_HALFBAND_EN);
|
||||
- snd_soc_component_update_bits(dai->component, LPASS_CDC_CLK_RX_I2S_CTL,
|
||||
- RX_I2S_CTL_RX_I2S_FS_RATE_MASK, rx_fs_rate);
|
||||
+ regmap_write_bits(priv->regmap, LPASS_CDC_CLK_RX_I2S_CTL,
|
||||
+ RX_I2S_CTL_RX_I2S_FS_RATE_MASK, rx_fs_rate);
|
||||
+ regmap_write_bits(priv->regmap, LPASS_CDC_RX1_B5_CTL,
|
||||
+ RXn_B5_CTL_INTERP_FS_RATE_MASK |
|
||||
+ RXn_B5_CTL_INTERP_HALFBAND_EN,
|
||||
+ (rx_fs_rate << RXn_B5_CTL_INTERP_FS_RATE_SHIFT) |
|
||||
+ RXn_B5_CTL_INTERP_HALFBAND_EN);
|
||||
+ regmap_write_bits(priv->regmap, LPASS_CDC_RX2_B5_CTL,
|
||||
+ RXn_B5_CTL_INTERP_FS_RATE_MASK |
|
||||
+ RXn_B5_CTL_INTERP_HALFBAND_EN,
|
||||
+ (rx_fs_rate << RXn_B5_CTL_INTERP_FS_RATE_SHIFT) |
|
||||
+ RXn_B5_CTL_INTERP_HALFBAND_EN);
|
||||
+ regmap_write_bits(priv->regmap, LPASS_CDC_RX3_B5_CTL,
|
||||
+ RXn_B5_CTL_INTERP_FS_RATE_MASK |
|
||||
+ RXn_B5_CTL_INTERP_HALFBAND_EN,
|
||||
+ (rx_fs_rate << RXn_B5_CTL_INTERP_FS_RATE_SHIFT) |
|
||||
+ RXn_B5_CTL_INTERP_HALFBAND_EN);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
@@ -1159,11 +1182,145 @@
|
||||
@@ -906,21 +947,21 @@ static int msm8916_wcd_digital_hw_params(struct snd_pcm_substream *substream,
|
||||
|
||||
switch (params_format(params)) {
|
||||
case SNDRV_PCM_FORMAT_S16_LE:
|
||||
- snd_soc_component_update_bits(dai->component, LPASS_CDC_CLK_TX_I2S_CTL,
|
||||
- TX_I2S_CTL_TX_I2S_MODE_MASK,
|
||||
- TX_I2S_CTL_TX_I2S_MODE_16);
|
||||
- snd_soc_component_update_bits(dai->component, LPASS_CDC_CLK_RX_I2S_CTL,
|
||||
- RX_I2S_CTL_RX_I2S_MODE_MASK,
|
||||
- RX_I2S_CTL_RX_I2S_MODE_16);
|
||||
+ regmap_write_bits(priv->regmap, LPASS_CDC_CLK_TX_I2S_CTL,
|
||||
+ TX_I2S_CTL_TX_I2S_MODE_MASK,
|
||||
+ TX_I2S_CTL_TX_I2S_MODE_16);
|
||||
+ regmap_write_bits(priv->regmap, LPASS_CDC_CLK_RX_I2S_CTL,
|
||||
+ RX_I2S_CTL_RX_I2S_MODE_MASK,
|
||||
+ RX_I2S_CTL_RX_I2S_MODE_16);
|
||||
break;
|
||||
|
||||
case SNDRV_PCM_FORMAT_S32_LE:
|
||||
- snd_soc_component_update_bits(dai->component, LPASS_CDC_CLK_TX_I2S_CTL,
|
||||
- TX_I2S_CTL_TX_I2S_MODE_MASK,
|
||||
- TX_I2S_CTL_TX_I2S_MODE_32);
|
||||
- snd_soc_component_update_bits(dai->component, LPASS_CDC_CLK_RX_I2S_CTL,
|
||||
- RX_I2S_CTL_RX_I2S_MODE_MASK,
|
||||
- RX_I2S_CTL_RX_I2S_MODE_32);
|
||||
+ regmap_write_bits(priv->regmap, LPASS_CDC_CLK_TX_I2S_CTL,
|
||||
+ TX_I2S_CTL_TX_I2S_MODE_MASK,
|
||||
+ TX_I2S_CTL_TX_I2S_MODE_32);
|
||||
+ regmap_write_bits(priv->regmap, LPASS_CDC_CLK_RX_I2S_CTL,
|
||||
+ RX_I2S_CTL_RX_I2S_MODE_MASK,
|
||||
+ RX_I2S_CTL_RX_I2S_MODE_32);
|
||||
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[] = {
|
||||
|
||||
};
|
||||
|
||||
+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 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,
|
||||
unsigned long mclk_rate;
|
||||
|
||||
msm8916_wcd = snd_soc_component_get_drvdata(component);
|
||||
- snd_soc_component_update_bits(component, LPASS_CDC_CLK_MCLK_CTL,
|
||||
- MCLK_CTL_MCLK_EN_MASK,
|
||||
- MCLK_CTL_MCLK_EN_ENABLE);
|
||||
- snd_soc_component_update_bits(component, LPASS_CDC_CLK_PDM_CTL,
|
||||
- LPASS_CDC_CLK_PDM_CTL_PDM_CLK_SEL_MASK,
|
||||
- LPASS_CDC_CLK_PDM_CTL_PDM_CLK_SEL_FB);
|
||||
+ regmap_write_bits(msm8916_wcd->regmap, LPASS_CDC_CLK_MCLK_CTL,
|
||||
+ MCLK_CTL_MCLK_EN_MASK,
|
||||
+ MCLK_CTL_MCLK_EN_ENABLE);
|
||||
+ regmap_write_bits(msm8916_wcd->regmap, LPASS_CDC_CLK_PDM_CTL,
|
||||
+ LPASS_CDC_CLK_PDM_CTL_PDM_CLK_SEL_MASK,
|
||||
+ LPASS_CDC_CLK_PDM_CTL_PDM_CLK_SEL_FB);
|
||||
|
||||
mclk_rate = clk_get_rate(msm8916_wcd->mclk);
|
||||
switch (mclk_rate) {
|
||||
case 12288000:
|
||||
- snd_soc_component_update_bits(component, LPASS_CDC_TOP_CTL,
|
||||
- TOP_CTL_DIG_MCLK_FREQ_MASK,
|
||||
- TOP_CTL_DIG_MCLK_FREQ_F_12_288MHZ);
|
||||
+ regmap_write_bits(msm8916_wcd->regmap, LPASS_CDC_TOP_CTL,
|
||||
+ TOP_CTL_DIG_MCLK_FREQ_MASK,
|
||||
+ TOP_CTL_DIG_MCLK_FREQ_F_12_288MHZ);
|
||||
break;
|
||||
case 9600000:
|
||||
- snd_soc_component_update_bits(component, LPASS_CDC_TOP_CTL,
|
||||
- TOP_CTL_DIG_MCLK_FREQ_MASK,
|
||||
- TOP_CTL_DIG_MCLK_FREQ_F_9_6MHZ);
|
||||
+ regmap_write_bits(msm8916_wcd->regmap, LPASS_CDC_TOP_CTL,
|
||||
+ TOP_CTL_DIG_MCLK_FREQ_MASK,
|
||||
+ TOP_CTL_DIG_MCLK_FREQ_F_9_6MHZ);
|
||||
break;
|
||||
default:
|
||||
dev_err(component->dev, "Invalid mclk rate %ld\n", mclk_rate);
|
||||
break;
|
||||
}
|
||||
+ msm8916_wcd_digital_force_sync_ctl(msm8916_wcd->regmap);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1155,15 +1221,139 @@ 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,
|
||||
- .use_pmdown_time = 1,
|
||||
+ .use_pmdown_time = 0,
|
||||
.endianness = 1,
|
||||
};
|
||||
|
||||
+static const struct reg_default msm8916_wcd_digital_reg_defaults[] = {
|
||||
+ { LPASS_CDC_CLK_RX_RESET_CTL, 0x00 },
|
||||
+ { LPASS_CDC_CLK_TX_RESET_B1_CTL, 0x00 },
|
||||
+ { LPASS_CDC_CLK_DMIC_B1_CTL, 0x00 },
|
||||
+ { LPASS_CDC_CLK_RX_I2S_CTL, 0x13 },
|
||||
+ { LPASS_CDC_CLK_TX_I2S_CTL, 0x13 },
|
||||
+ { LPASS_CDC_CLK_RX_I2S_CTL, 0x00 },
|
||||
+ { LPASS_CDC_CLK_TX_I2S_CTL, 0x00 },
|
||||
+ { LPASS_CDC_CLK_OTHR_RESET_B1_CTL, 0x00 },
|
||||
+ { LPASS_CDC_CLK_TX_CLK_EN_B1_CTL, 0x00 },
|
||||
+ { LPASS_CDC_CLK_OTHR_CTL, 0x04 },
|
||||
+ { LPASS_CDC_CLK_OTHR_CTL, 0x00 },
|
||||
+ { LPASS_CDC_CLK_RX_B1_CTL, 0x00 },
|
||||
+ { LPASS_CDC_CLK_MCLK_CTL, 0x00 },
|
||||
+ { LPASS_CDC_CLK_PDM_CTL, 0x00 },
|
||||
@@ -499,7 +718,7 @@
|
||||
+ { LPASS_CDC_RX1_B2_CTL, 0x00 },
|
||||
+ { LPASS_CDC_RX1_B3_CTL, 0x00 },
|
||||
+ { LPASS_CDC_RX1_B4_CTL, 0x00 },
|
||||
+ { LPASS_CDC_RX1_B5_CTL, 0x68 },
|
||||
+ { LPASS_CDC_RX1_B5_CTL, 0x00 },
|
||||
+ { LPASS_CDC_RX1_B6_CTL, 0x00 },
|
||||
+ { LPASS_CDC_RX1_VOL_CTL_B1_CTL, 0x00 },
|
||||
+ { LPASS_CDC_RX1_VOL_CTL_B2_CTL, 0x00 },
|
||||
@@ -507,7 +726,7 @@
|
||||
+ { LPASS_CDC_RX2_B2_CTL, 0x00 },
|
||||
+ { LPASS_CDC_RX2_B3_CTL, 0x00 },
|
||||
+ { LPASS_CDC_RX2_B4_CTL, 0x00 },
|
||||
+ { LPASS_CDC_RX2_B5_CTL, 0x68 },
|
||||
+ { LPASS_CDC_RX2_B5_CTL, 0x00 },
|
||||
+ { LPASS_CDC_RX2_B6_CTL, 0x00 },
|
||||
+ { LPASS_CDC_RX2_VOL_CTL_B1_CTL, 0x00 },
|
||||
+ { LPASS_CDC_RX2_VOL_CTL_B2_CTL, 0x00 },
|
||||
@@ -515,12 +734,12 @@
|
||||
+ { LPASS_CDC_RX3_B2_CTL, 0x00 },
|
||||
+ { LPASS_CDC_RX3_B3_CTL, 0x00 },
|
||||
+ { LPASS_CDC_RX3_B4_CTL, 0x00 },
|
||||
+ { LPASS_CDC_RX3_B5_CTL, 0x68 },
|
||||
+ { LPASS_CDC_RX3_B5_CTL, 0x00 },
|
||||
+ { LPASS_CDC_RX3_B6_CTL, 0x00 },
|
||||
+ { LPASS_CDC_RX3_VOL_CTL_B1_CTL, 0x00 },
|
||||
+ { LPASS_CDC_RX3_VOL_CTL_B2_CTL, 0x00 },
|
||||
+ { LPASS_CDC_TOP_GAIN_UPDATE, 0x00 },
|
||||
+ { LPASS_CDC_TOP_CTL, 0x01 },
|
||||
+ { LPASS_CDC_TOP_CTL, 0x00 },
|
||||
+ { LPASS_CDC_DEBUG_DESER1_CTL, 0x00 },
|
||||
+ { LPASS_CDC_DEBUG_DESER2_CTL, 0x00 },
|
||||
+ { LPASS_CDC_DEBUG_B1_CTL_CFG, 0x00 },
|
||||
@@ -534,8 +753,10 @@
|
||||
+ { LPASS_CDC_IIR1_GAIN_B6_CTL, 0x00 },
|
||||
+ { LPASS_CDC_IIR1_GAIN_B7_CTL, 0x00 },
|
||||
+ { LPASS_CDC_IIR1_GAIN_B8_CTL, 0x00 },
|
||||
+ { LPASS_CDC_IIR1_CTL, 0x40 },
|
||||
+ { LPASS_CDC_IIR1_CTL, 0x00 },
|
||||
+ { LPASS_CDC_IIR1_GAIN_TIMER_CTL, 0x00 },
|
||||
+ { LPASS_CDC_IIR1_COEF_B1_CTL, 0x00 },
|
||||
+ { LPASS_CDC_IIR1_COEF_B2_CTL, 0x00 },
|
||||
+ { LPASS_CDC_IIR2_GAIN_B1_CTL, 0x00 },
|
||||
+ { LPASS_CDC_IIR2_GAIN_B2_CTL, 0x00 },
|
||||
+ { LPASS_CDC_IIR2_GAIN_B3_CTL, 0x00 },
|
||||
@@ -544,8 +765,10 @@
|
||||
+ { LPASS_CDC_IIR2_GAIN_B6_CTL, 0x00 },
|
||||
+ { LPASS_CDC_IIR2_GAIN_B7_CTL, 0x00 },
|
||||
+ { LPASS_CDC_IIR2_GAIN_B8_CTL, 0x00 },
|
||||
+ { LPASS_CDC_IIR2_CTL, 0x40 },
|
||||
+ { LPASS_CDC_IIR2_CTL, 0x00 },
|
||||
+ { LPASS_CDC_IIR2_GAIN_TIMER_CTL, 0x00 },
|
||||
+ { LPASS_CDC_IIR2_COEF_B1_CTL, 0x00 },
|
||||
+ { LPASS_CDC_IIR2_COEF_B2_CTL, 0x00 },
|
||||
+ { LPASS_CDC_CONN_RX1_B1_CTL, 0x00 },
|
||||
+ { LPASS_CDC_CONN_RX1_B2_CTL, 0x00 },
|
||||
+ { LPASS_CDC_CONN_RX1_B3_CTL, 0x00 },
|
||||
@@ -568,13 +791,13 @@
|
||||
+ { LPASS_CDC_TX1_VOL_CTL_GAIN, 0x00 },
|
||||
+ { LPASS_CDC_TX1_VOL_CTL_CFG, 0x00 },
|
||||
+ { LPASS_CDC_TX1_MUX_CTL, 0x00 },
|
||||
+ { LPASS_CDC_TX1_CLK_FS_CTL, 0x03 },
|
||||
+ { LPASS_CDC_TX1_CLK_FS_CTL, 0x00 },
|
||||
+ { LPASS_CDC_TX1_DMIC_CTL, 0x00 },
|
||||
+ { LPASS_CDC_TX2_VOL_CTL_TIMER, 0x00 },
|
||||
+ { LPASS_CDC_TX2_VOL_CTL_GAIN, 0x00 },
|
||||
+ { LPASS_CDC_TX2_VOL_CTL_CFG, 0x00 },
|
||||
+ { LPASS_CDC_TX2_MUX_CTL, 0x00 },
|
||||
+ { LPASS_CDC_TX2_CLK_FS_CTL, 0x03 },
|
||||
+ { LPASS_CDC_TX2_CLK_FS_CTL, 0x00 },
|
||||
+ { LPASS_CDC_TX2_DMIC_CTL, 0x00 },
|
||||
+};
|
||||
+
|
||||
@@ -597,22 +820,6 @@
|
||||
+ return false;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static bool msm8916_wcd_digital_volatile_reg(struct device *dev, unsigned int 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_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:
|
||||
+ return true;
|
||||
+ default:
|
||||
+ return false;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static const struct regmap_config msm8916_codec_regmap_config = {
|
||||
.reg_bits = 32,
|
||||
@@ -621,13 +828,25 @@
|
||||
.max_register = LPASS_CDC_TX2_DMIC_CTL,
|
||||
+ .readable_reg = msm8916_wcd_digital_valid_reg,
|
||||
+ .writeable_reg = msm8916_wcd_digital_valid_reg,
|
||||
+ .volatile_reg = msm8916_wcd_digital_volatile_reg,
|
||||
+ .reg_defaults = msm8916_wcd_digital_reg_defaults,
|
||||
+ .num_reg_defaults = ARRAY_SIZE(msm8916_wcd_digital_reg_defaults),
|
||||
.cache_type = REGCACHE_FLAT,
|
||||
};
|
||||
|
||||
@@ -1209,7 +1366,6 @@
|
||||
@@ -1195,7 +1385,11 @@ static int msm8916_wcd_digital_runtime_resume(struct device *dev)
|
||||
}
|
||||
|
||||
regcache_cache_only(priv->regmap, false);
|
||||
- return regcache_sync(priv->regmap);
|
||||
+ ret = regcache_sync(priv->regmap);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ msm8916_wcd_digital_force_sync_ctl(priv->regmap);
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
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)
|
||||
struct device *dev = &pdev->dev;
|
||||
void __iomem *base;
|
||||
struct regmap *digital_map;
|
||||
@@ -635,20 +854,170 @@
|
||||
int ret;
|
||||
|
||||
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
||||
@@ -1244,7 +1400,14 @@
|
||||
@@ -1244,8 +1437,17 @@ static int msm8916_wcd_digital_probe(struct platform_device *pdev)
|
||||
goto err_clk;
|
||||
}
|
||||
|
||||
- for (reg = 0; reg <= LPASS_CDC_TX2_DMIC_CTL; reg += 4)
|
||||
- regmap_read(digital_map, reg, &val);
|
||||
+ regmap_write(digital_map, LPASS_CDC_CLK_OTHR_CTL, 0x04);
|
||||
+ regmap_write(digital_map, LPASS_CDC_RX1_B5_CTL, 0x68);
|
||||
+ regmap_write(digital_map, LPASS_CDC_RX2_B5_CTL, 0x68);
|
||||
+ regmap_write(digital_map, LPASS_CDC_RX3_B5_CTL, 0x68);
|
||||
+ regmap_write(digital_map, LPASS_CDC_TOP_CTL, 0x01);
|
||||
+ regmap_write(digital_map, LPASS_CDC_IIR1_CTL, 0x40);
|
||||
+ regmap_write(digital_map, LPASS_CDC_IIR2_CTL, 0x40);
|
||||
+ regmap_write(digital_map, LPASS_CDC_TX1_CLK_FS_CTL, 0x03);
|
||||
+ regmap_write(digital_map, LPASS_CDC_TX2_CLK_FS_CTL, 0x03);
|
||||
+ regmap_write_bits(digital_map, LPASS_CDC_CLK_RX_I2S_CTL, ~0U, 0x13);
|
||||
+ regmap_write_bits(digital_map, LPASS_CDC_CLK_TX_I2S_CTL, ~0U, 0x13);
|
||||
+ regmap_write_bits(digital_map, LPASS_CDC_CLK_OTHR_CTL, ~0U, 0x04);
|
||||
+ regmap_write_bits(digital_map, LPASS_CDC_RX1_B5_CTL, ~0U, 0x68);
|
||||
+ regmap_write_bits(digital_map, LPASS_CDC_RX2_B5_CTL, ~0U, 0x68);
|
||||
+ regmap_write_bits(digital_map, LPASS_CDC_RX3_B5_CTL, ~0U, 0x68);
|
||||
+ regmap_write_bits(digital_map, LPASS_CDC_TOP_CTL, ~0U, 0x01);
|
||||
+ regmap_write_bits(digital_map, LPASS_CDC_IIR1_CTL, ~0U, 0x40);
|
||||
+ regmap_write_bits(digital_map, LPASS_CDC_IIR2_CTL, ~0U, 0x40);
|
||||
+ regmap_write_bits(digital_map, LPASS_CDC_TX1_CLK_FS_CTL, ~0U, 0x03);
|
||||
+ regmap_write_bits(digital_map, LPASS_CDC_TX2_CLK_FS_CTL, ~0U, 0x03);
|
||||
|
||||
dev_set_drvdata(dev, priv);
|
||||
|
||||
diff --git a/sound/soc/qcom/qdsp6/q6afe.c b/sound/soc/qcom/qdsp6/q6afe.c
|
||||
index a5b0c48..08f6b28 100644
|
||||
--- a/sound/soc/qcom/qdsp6/q6afe.c
|
||||
+++ b/sound/soc/qcom/qdsp6/q6afe.c
|
||||
@@ -373,6 +373,7 @@ struct q6afe {
|
||||
wait_queue_head_t wait;
|
||||
struct list_head port_list;
|
||||
spinlock_t port_list_lock;
|
||||
+ unsigned int digital_cdc_clk_freq;
|
||||
};
|
||||
|
||||
struct afe_port_cmd_device_start {
|
||||
@@ -1032,13 +1033,12 @@ static int q6afe_port_set_param(struct q6afe_port *port, void *data,
|
||||
}
|
||||
|
||||
static int q6afe_set_param_v2(struct q6afe *afe, struct q6afe_port *port,
|
||||
- void *data, int param_id, int module_id, int psize,
|
||||
- int token)
|
||||
+ u16 port_id, void *data, int param_id,
|
||||
+ int module_id, int psize, int token)
|
||||
{
|
||||
struct afe_port_cmd_set_param_v2 *param;
|
||||
struct afe_port_param_data_v2 *pdata;
|
||||
struct apr_pkt *pkt;
|
||||
- u16 port_id = port ? port->id : 0;
|
||||
int ret, pkt_size;
|
||||
void *p, *pl;
|
||||
|
||||
@@ -1083,8 +1083,8 @@ static int q6afe_set_param_v2(struct q6afe *afe, struct q6afe_port *port,
|
||||
static int q6afe_port_set_param_v2(struct q6afe_port *port, void *data,
|
||||
int param_id, int module_id, int psize)
|
||||
{
|
||||
- return q6afe_set_param_v2(port->afe, port, data, param_id, module_id,
|
||||
- psize, port->token);
|
||||
+ return q6afe_set_param_v2(port->afe, port, port->id, data, param_id,
|
||||
+ module_id, psize, port->token);
|
||||
}
|
||||
|
||||
static int q6afe_port_set_lpass_clock(struct q6afe_port *port,
|
||||
@@ -1120,6 +1120,7 @@ int q6afe_set_lpass_clock(struct device *dev, int clk_id, int attri,
|
||||
|
||||
if (q6core_get_adsp_version() < Q6_ADSP_VERSION_2_7) {
|
||||
struct afe_digital_clk_cfg dcfg = {0,};
|
||||
+ int ret;
|
||||
|
||||
switch (clk_id) {
|
||||
/*
|
||||
@@ -1130,11 +1131,18 @@ int q6afe_set_lpass_clock(struct device *dev, int clk_id, int attri,
|
||||
dcfg.i2s_cfg_minor_version = AFE_API_VERSION_I2S_CONFIG;
|
||||
dcfg.clk_val = freq;
|
||||
dcfg.clk_root = 5;
|
||||
- return q6afe_set_param_v2(afe, NULL, &dcfg,
|
||||
- AFE_PARAM_ID_INT_DIGITAL_CDC_CLK_CONFIG,
|
||||
- AFE_MODULE_AUDIO_DEV_INTERFACE,
|
||||
- sizeof(dcfg),
|
||||
- AFE_CLK_TOKEN);
|
||||
+ if (freq == 0)
|
||||
+ afe->digital_cdc_clk_freq = 0;
|
||||
+ ret = q6afe_set_param_v2(afe, NULL,
|
||||
+ AFE_PORT_ID_PRIMARY_MI2S_RX,
|
||||
+ &dcfg,
|
||||
+ AFE_PARAM_ID_INT_DIGITAL_CDC_CLK_CONFIG,
|
||||
+ AFE_MODULE_AUDIO_DEV_INTERFACE,
|
||||
+ sizeof(dcfg),
|
||||
+ AFE_CLK_TOKEN);
|
||||
+ if (!ret && freq > 0)
|
||||
+ afe->digital_cdc_clk_freq = freq;
|
||||
+ return ret;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1254,6 +1262,27 @@ int q6afe_port_stop(struct q6afe_port *port)
|
||||
dev_err(afe->dev, "AFE close failed %d\n", ret);
|
||||
|
||||
kfree(pkt);
|
||||
+ if (!ret && port_id == AFE_PORT_ID_PRIMARY_MI2S_RX &&
|
||||
+ q6core_get_adsp_version() < Q6_ADSP_VERSION_2_7 &&
|
||||
+ afe->digital_cdc_clk_freq > 0) {
|
||||
+ struct afe_digital_clk_cfg dcfg = {0,};
|
||||
+ int clk_ret;
|
||||
+
|
||||
+ dcfg.i2s_cfg_minor_version = AFE_API_VERSION_I2S_CONFIG;
|
||||
+ dcfg.clk_val = afe->digital_cdc_clk_freq;
|
||||
+ dcfg.clk_root = 5;
|
||||
+ clk_ret = q6afe_set_param_v2(afe, NULL,
|
||||
+ AFE_PORT_ID_PRIMARY_MI2S_RX,
|
||||
+ &dcfg,
|
||||
+ AFE_PARAM_ID_INT_DIGITAL_CDC_CLK_CONFIG,
|
||||
+ AFE_MODULE_AUDIO_DEV_INTERFACE,
|
||||
+ sizeof(dcfg),
|
||||
+ AFE_CLK_TOKEN);
|
||||
+ if (clk_ret)
|
||||
+ dev_warn(afe->dev,
|
||||
+ "Failed to retain digital codec clk after PRI_MI2S_RX stop (%d)\n",
|
||||
+ clk_ret);
|
||||
+ }
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(q6afe_port_stop);
|
||||
diff --git a/sound/soc/qcom/qdsp6/q6core.c b/sound/soc/qcom/qdsp6/q6core.c
|
||||
index 855ab4f..7200330 100644
|
||||
--- a/sound/soc/qcom/qdsp6/q6core.c
|
||||
+++ b/sound/soc/qcom/qdsp6/q6core.c
|
||||
@@ -275,6 +275,18 @@ static bool __q6core_is_adsp_ready(struct q6core *core)
|
||||
return false;
|
||||
}
|
||||
|
||||
+static void q6core_query_versions_locked(struct q6core *core)
|
||||
+{
|
||||
+ if (core->is_version_requested)
|
||||
+ return;
|
||||
+
|
||||
+ if (q6core_get_fwk_versions(core) || !core->fwk_version_supported)
|
||||
+ q6core_get_svc_versions(core);
|
||||
+
|
||||
+ if (core->adsp_version != Q6_ADSP_VERSION_UNKNOWN)
|
||||
+ core->is_version_requested = true;
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* q6core_get_svc_api_info() - Get version number of a service.
|
||||
*
|
||||
@@ -292,11 +304,7 @@ int q6core_get_svc_api_info(int svc_id, struct q6core_svc_api_info *ainfo)
|
||||
return 0;
|
||||
|
||||
mutex_lock(&g_core->lock);
|
||||
- if (!g_core->is_version_requested) {
|
||||
- if (q6core_get_fwk_versions(g_core) == -ENOTSUPP)
|
||||
- q6core_get_svc_versions(g_core);
|
||||
- g_core->is_version_requested = true;
|
||||
- }
|
||||
+ q6core_query_versions_locked(g_core);
|
||||
|
||||
if (g_core->fwk_version_supported) {
|
||||
for (i = 0; i < g_core->fwk_version->num_services; i++) {
|
||||
@@ -345,10 +353,6 @@ enum q6core_version q6core_get_adsp_version(void)
|
||||
return Q6_ADSP_VERSION_UNKNOWN;
|
||||
|
||||
mutex_lock(&g_core->lock);
|
||||
- if (!g_core->is_version_requested) {
|
||||
- if (q6core_get_fwk_versions(g_core) == -ENOTSUPP)
|
||||
- q6core_get_svc_versions(g_core);
|
||||
- g_core->is_version_requested = true;
|
||||
- }
|
||||
+ q6core_query_versions_locked(g_core);
|
||||
ret = g_core->adsp_version;
|
||||
mutex_unlock(&g_core->lock);
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -112,7 +112,7 @@ EOF
|
||||
echo "[2m/5] Applying system-core keypad debouncer patch..."
|
||||
patch -p1 < /bananarchy/patches/kernel/0014-input-core-keypad-debouncer.patch
|
||||
fi
|
||||
if ! grep -q "msm8916_wcd_digital_reg_defaults" sound/soc/codecs/msm8916-wcd-digital.c 2>/dev/null; then
|
||||
if ! grep -q "msm8916_wcd_digital_force_sync_ctl" sound/soc/codecs/msm8916-wcd-digital.c 2>/dev/null; then
|
||||
echo "[2n/5] Applying WCD digital 48 kHz interpolator and CAJON analog codec patch..."
|
||||
patch -p1 < /bananarchy/patches/kernel/0015-msm8909-wcd-digital-interpolator-cajon-analog.patch
|
||||
fi
|
||||
|
||||
@@ -564,15 +564,15 @@ fi
|
||||
|
||||
echo "[check] Known-good flashable image set..."
|
||||
for pair in \
|
||||
"e15e0fff0e68d059000caf28f73a061170a9da62368531499c6d82b275821903 images/bananarchy-nokia-argon.img" \
|
||||
"64fcf14fbe8863490d8a3b2838e66baa9e9b5712450526ca0b9e3bed5d724437 images/bananarchy-nokia-beatles.img" \
|
||||
"7c6aec20941b074cd36c856f62cb9b51b4ad2fe111c4f43f68844e07b828fb84 images/boot-bananarchy-nokia-beatles.img" \
|
||||
"6279d2b99600aee7751f501257ac48d485eaeee3b3f31c0f98a2b8522400bcd1 images/bananarchy-nokia-argon.img" \
|
||||
"f067a130984d7fe6f79fdf46b3ff657bbe19fe12400e5db1e6ebd4cac24d1e6c images/bananarchy-nokia-beatles.img" \
|
||||
"d32c7a38ac85df7faa71d2649d7c6ead1adcef0af39c3e91f08993965ddd44b9 images/boot-bananarchy-nokia-beatles.img" \
|
||||
"f13db705a714aaebd2d8fcc2e0f7266d0e40268c0a276208117dfdf9d8f45351 images/boot-lk2nd-nokia-beatles-display.img" \
|
||||
"753029acf664a78b6990d799c060ee29ccb8b464bc0a4c40c1909b1a1a5dbfcb images/bananarchy-nokia-coconut.img" \
|
||||
"948c44097e069624d60cf952de065961b38e9d45c77bcee958684b96d86dbb7c images/boot-bananarchy-nokia-coconut.img" \
|
||||
"4d6733b633ca78ec7fe5de93e1ed0564a3aa116088aee3634147759a414af2c7 images/bananarchy-nokia-coconut.img" \
|
||||
"fdad08c8501de6b53c6ac76b7886849834fc8840ffec289b41a5c58e924ac803 images/boot-bananarchy-nokia-coconut.img" \
|
||||
"9a5bd2da6cfd95c745d9c1acb2e3bc61afa339824810e3d160bf079e17b23192 images/boot-lk2nd-nokia-coconut-display.img" \
|
||||
"36e3a663de0d2586422aa5303a18ce2a70f05274d4d2ff7e377cf5dad243c777 images/bananarchy-nokia-sparkler.img" \
|
||||
"f40757646fb9a5c0c489df370f59a97a5638d36bda037042a98be894b47bcf8e images/boot-bananarchy-nokia-sparkler.img" \
|
||||
"068f4fa606bee9c63ac6044902e04a28d596b04edcd230d9703a2687951ee4bb images/bananarchy-nokia-sparkler.img" \
|
||||
"026852df5acc871738322ff1de3febf91c097f0f1d745fbbe71f22661023b0e2 images/boot-bananarchy-nokia-sparkler.img" \
|
||||
"120ade81bc5416263a1afd95a29981675358b98516e105e5ed611edf258a29f7 images/boot-lk2nd-nokia-sparkler-display.img"; do
|
||||
set -- $pair
|
||||
want=$1
|
||||
|
||||
@@ -14,6 +14,9 @@ PATCH_0015 = os.path.join(
|
||||
)
|
||||
BUILD_KERNEL = os.path.join(BASE_DIR, "scripts/build-kernel-audio.sh")
|
||||
SXMO_AUDIO = os.path.join(BASE_DIR, "overlay/rootfs/usr/bin/sxmo_audio.sh")
|
||||
SOUNDMONITOR_C = os.path.join(
|
||||
BASE_DIR, "src/bananarchy-daemons/bananarchy-soundmonitor.c"
|
||||
)
|
||||
SXMO_RING = os.path.join(
|
||||
BASE_DIR, "overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_ring.sh"
|
||||
)
|
||||
@@ -169,14 +172,22 @@ def check_patch_0015():
|
||||
txt = read_text(PATCH_0015)
|
||||
required = [
|
||||
"msm8916_wcd_digital_reg_defaults",
|
||||
"{ LPASS_CDC_RX1_B5_CTL, 0x68 }",
|
||||
"{ LPASS_CDC_RX2_B5_CTL, 0x68 }",
|
||||
"{ LPASS_CDC_RX3_B5_CTL, 0x68 }",
|
||||
"{ LPASS_CDC_TX1_CLK_FS_CTL, 0x03 }",
|
||||
"{ LPASS_CDC_TX2_CLK_FS_CTL, 0x03 }",
|
||||
"{ LPASS_CDC_CLK_OTHR_CTL, 0x04 }",
|
||||
"{ LPASS_CDC_CLK_RX_RESET_CTL, 0x00 }",
|
||||
"{ LPASS_CDC_RX1_B5_CTL, 0x00 }",
|
||||
"{ LPASS_CDC_RX2_B5_CTL, 0x00 }",
|
||||
"{ LPASS_CDC_RX3_B5_CTL, 0x00 }",
|
||||
"{ LPASS_CDC_TX1_CLK_FS_CTL, 0x00 }",
|
||||
"{ LPASS_CDC_TX2_CLK_FS_CTL, 0x00 }",
|
||||
"{ LPASS_CDC_CLK_OTHR_CTL, 0x00 }",
|
||||
"msm8916_wcd_digital_force_sync_ctl",
|
||||
"regmap_write_bits",
|
||||
".use_pmdown_time\t= 0,",
|
||||
"RXn_B5_CTL_INTERP_FS_RATE_MASK",
|
||||
"TXn_CLK_FS_CTL_FS_RATE_MASK",
|
||||
"digital_cdc_clk_freq",
|
||||
"AFE_PORT_ID_PRIMARY_MI2S_RX",
|
||||
"q6core_query_versions_locked",
|
||||
"core->adsp_version != Q6_ADSP_VERSION_UNKNOWN",
|
||||
"wcd_reg_defaults_cajon_2_0",
|
||||
"{CDC_A_NCP_FBCTRL, 0xA8}",
|
||||
"{CDC_A_NCP_VCTRL, 0xA4}",
|
||||
@@ -194,6 +205,22 @@ def check_patch_0015():
|
||||
if tok not in txt:
|
||||
return fail(f"0015 patch missing required token: {tok}")
|
||||
|
||||
if ".volatile_reg" in txt:
|
||||
return fail("0015 patch must not set .volatile_reg on msm8916_codec_regmap_config")
|
||||
|
||||
m = re.search(
|
||||
r"msm8916_wcd_digital_reg_defaults\[\]\s*=\s*\{(.*?)\n\+\};",
|
||||
txt,
|
||||
re.S,
|
||||
)
|
||||
if not m:
|
||||
return fail("0015 patch missing msm8916_wcd_digital_reg_defaults block")
|
||||
default_entries = re.findall(r"\{\s*(LPASS_CDC_[A-Z0-9_]+),\s*(0x[0-9a-fA-F]+)\s*\}", m.group(1))
|
||||
if len(default_entries) != 97:
|
||||
return fail(f"0015 msm8916_wcd_digital_reg_defaults expected 97 registers, got {len(default_entries)}")
|
||||
if any(val != "0x00" for _, val in default_entries):
|
||||
return fail("0015 msm8916_wcd_digital_reg_defaults entries must use 0x00 hardware reset defaults")
|
||||
|
||||
build_txt = read_text(BUILD_KERNEL)
|
||||
if build_txt.count("0015-msm8909-wcd-digital-interpolator-cajon-analog.patch") != 2:
|
||||
return fail("scripts/build-kernel-audio.sh must apply 0015 in both kcache and tarball paths")
|
||||
@@ -280,8 +307,15 @@ def check_gain_staging():
|
||||
audio_txt = read_text(SXMO_AUDIO)
|
||||
if "bananarchy_set_sink_volume" not in audio_txt or \
|
||||
"bananarchy_sync_internal_pw_vol" not in audio_txt or \
|
||||
"[ -d /proc/asound/card0 ]" not in audio_txt:
|
||||
return fail("sxmo_audio.sh missing PipeWire unity sync guard for card0")
|
||||
"[ -d /proc/asound/card0 ]" not in audio_txt or \
|
||||
"@DEFAULT_AUDIO_SINK@" not in audio_txt or \
|
||||
'pactl list short sinks 2>/dev/null | grep -Fq "$sink_name"' not in audio_txt:
|
||||
return fail("sxmo_audio.sh missing PipeWire unity sync guard, @DEFAULT_AUDIO_SINK@, or sink wait")
|
||||
|
||||
soundmon_txt = read_text(SOUNDMONITOR_C)
|
||||
for tok in ("has_internal_sink", "internal_synced"):
|
||||
if tok not in soundmon_txt:
|
||||
return fail(f"bananarchy-soundmonitor.c missing {tok}")
|
||||
|
||||
probe_script = r"""
|
||||
set -eu
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
static volatile sig_atomic_t stop_requested = 0;
|
||||
static volatile pid_t pactl_pid = -1;
|
||||
static int internal_synced = 0;
|
||||
|
||||
static void handle_signal(int sig)
|
||||
{
|
||||
@@ -215,6 +216,28 @@ static void find_bt_sink(char *out, size_t out_len)
|
||||
}
|
||||
}
|
||||
|
||||
static int has_internal_sink(void)
|
||||
{
|
||||
char raw[2048];
|
||||
char *line;
|
||||
char *save = NULL;
|
||||
char *const argv[] = {
|
||||
(char *)"pactl", (char *)"list", (char *)"short", (char *)"sinks", NULL
|
||||
};
|
||||
if(run_capture(argv, raw, sizeof(raw)) != 0)
|
||||
return 0;
|
||||
for(line = strtok_r(raw, "\n", &save); line; line = strtok_r(NULL, "\n", &save)) {
|
||||
char *c1 = strtok(line, " \t");
|
||||
char *c2 = c1 ? strtok(NULL, " \t") : NULL;
|
||||
if(c2 &&
|
||||
(strncmp(c2, "alsa_output.platform-7702000.", 29) == 0 ||
|
||||
strncmp(c2, "alsa_output.platform-sound.", 27) == 0)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void sxmo_audio_cmd(const char *arg1, const char *arg2)
|
||||
{
|
||||
if(arg2) {
|
||||
@@ -346,7 +369,8 @@ static int start_pactl_subscribe(char *prev_bt, size_t prev_bt_len)
|
||||
return pfd[0];
|
||||
}
|
||||
|
||||
static void dispatch_pactl_line(const char *line, char *prev_bt, size_t prev_bt_len)
|
||||
static void dispatch_pactl_line(const char *line, char *prev_bt, size_t prev_bt_len,
|
||||
int jack_fd)
|
||||
{
|
||||
if((strstr(line, "Event 'new' on sink") != NULL) ||
|
||||
(strstr(line, "Event 'new' on card") != NULL) ||
|
||||
@@ -357,6 +381,15 @@ static void dispatch_pactl_line(const char *line, char *prev_bt, size_t prev_bt_
|
||||
safe_copy(prev_bt, prev_bt_len, bt_sink);
|
||||
sxmo_audio_cmd("set", "Bluetooth");
|
||||
}
|
||||
if(!internal_synced && has_internal_sink()) {
|
||||
internal_synced = 1;
|
||||
if(bt_sink[0] == '\0') {
|
||||
if(query_ev_sw(jack_fd, SW_HEADPHONE_INSERT, "name='Headphone Jack'"))
|
||||
handle_jack_insert(jack_fd);
|
||||
else
|
||||
sxmo_audio_cmd("apply", NULL);
|
||||
}
|
||||
}
|
||||
{
|
||||
char *const sb_argv[] = {
|
||||
(char *)"sxmo_hook_statusbar.sh", (char *)"volume", NULL
|
||||
@@ -367,6 +400,8 @@ static void dispatch_pactl_line(const char *line, char *prev_bt, size_t prev_bt_
|
||||
(strstr(line, "Event 'remove' on card") != NULL)) {
|
||||
char bt_sink[128] = "";
|
||||
find_bt_sink(bt_sink, sizeof(bt_sink));
|
||||
if(internal_synced && !has_internal_sink())
|
||||
internal_synced = 0;
|
||||
if(bt_sink[0] == '\0' && prev_bt[0] != '\0') {
|
||||
char cur_out[64] = "";
|
||||
prev_bt[0] = '\0';
|
||||
@@ -433,6 +468,7 @@ int main(void)
|
||||
else
|
||||
sxmo_audio_cmd("apply", NULL);
|
||||
}
|
||||
internal_synced = has_internal_sink();
|
||||
if(jack_fd < 0)
|
||||
jack_retry_at = now_ms() + 5000;
|
||||
|
||||
@@ -525,7 +561,7 @@ int main(void)
|
||||
while((nl = strchr(pactl_buf, '\n')) != NULL) {
|
||||
size_t rest;
|
||||
*nl = '\0';
|
||||
dispatch_pactl_line(pactl_buf, prev_bt, sizeof(prev_bt));
|
||||
dispatch_pactl_line(pactl_buf, prev_bt, sizeof(prev_bt), jack_fd);
|
||||
rest = (size_t)(pactl_buf + pactl_len - (nl + 1));
|
||||
memmove(pactl_buf, nl + 1, rest);
|
||||
pactl_len = rest;
|
||||
|
||||
Reference in new issue
Block a user