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

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

No files matched your search

+22 -10
View File
@@ -214,10 +214,11 @@ default_vol_for_dev() {
esac
}
# Linear percentage (0..100%) to hardware digital volume register:
# - Speaker (RX3 Digital Volume): 0 -> 0, 1..100 -> 56..88 (-28 dB .. +4 dB)
# - Earpiece (RX1 Digital Volume): 0 -> 0, 1..100 -> 60..92 (-24 dB .. +8 dB)
# - Headphones (RX1 & RX2 Digital): 0 -> 0, 1..100 -> 52..84 (-32 dB .. 0 dB)
# Linear percentage (0..100%) to hardware digital volume register (max 84 = 0 dB
# unity so the 16-bit WCD interpolator never applies digital overdrive):
# - Speaker (RX3 Digital Volume): 0 -> 0, 1..100 -> 52..84 (-32 dB .. 0 dB)
# - Earpiece (RX1 Digital Volume): 0 -> 0, 1..100 -> 52..84 (-32 dB .. 0 dB)
# - Headphones (RX1 & RX2 Digital): 0 -> 0, 1..100 -> 51..83 (-33 dB .. -1 dB)
# - Microphone (TX1 Digital Volume): 0 -> 0, 1..100 -> 56..88 (-28 dB .. +4 dB)
# PipeWire software sink/source is kept at 100% (0.0 dB unity gain) when unmuted
# so software cubic scaling never compounds with the linear hardware curve.
@@ -230,13 +231,13 @@ pct_to_hw_out() {
fi
case "$dev" in
Earpiece)
printf "%d" "$(( 60 + (pct * 32 + 50) / 100 ))"
;;
Headphones)
printf "%d" "$(( 52 + (pct * 32 + 50) / 100 ))"
;;
Headphones)
printf "%d" "$(( 51 + (pct * 32 + 50) / 100 ))"
;;
*)
printf "%d" "$(( 56 + (pct * 32 + 50) / 100 ))"
printf "%d" "$(( 52 + (pct * 32 + 50) / 100 ))"
;;
esac
}
@@ -543,13 +544,24 @@ EOF
if [ "$eff_pct" -gt 0 ]; then
printf "0\n" > /tmp/sxmo_pw_sink_muted 2>/dev/null || true
pactl set-sink-mute @DEFAULT_SINK@ 0 >/dev/null 2>&1 || true
bananarchy_set_sink_volume "$eff_pct"
bananarchy_sync_internal_pw_vol "$eff_pct"
else
printf "1\n" > /tmp/sxmo_pw_sink_muted 2>/dev/null || true
pactl set-sink-mute @DEFAULT_SINK@ 1 >/dev/null 2>&1 || true
fi
}
# Bananarchy: keep PipeWire's software sink at 100% (0.0 dB unity) whenever ALSA
# card0 is present so software cubic scaling never compounds with WCD digital
# volume; only fall back to scaling PipeWire software volume when card0 is absent.
bananarchy_sync_internal_pw_vol() {
if [ -d /proc/asound/card0 ]; then
bananarchy_set_sink_volume 100
else
bananarchy_set_sink_volume "$1"
fi
}
# Bananarchy: the MSM8905 mainline kernel exposes no ALSA card yet, so the
# amixer csets below are no-ops and PipeWire's null sink is the real output.
# @DEFAULT_SINK@ does not resolve when wireplumber has no default configured
@@ -681,7 +693,7 @@ EOF
printf "0\n" > /tmp/sxmo_pw_sink_muted 2>/dev/null || true
pactl set-sink-mute @DEFAULT_SINK@ 0 >/dev/null 2>&1 || true
fi
bananarchy_set_sink_volume "$eff_pct"
bananarchy_sync_internal_pw_vol "$eff_pct"
else
if [ "$pw_muted" != "1" ]; then
printf "1\n" > /tmp/sxmo_pw_sink_muted 2>/dev/null || true