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:
1 parent
1a229b0587
commit
4f73c28e5e
39 files changed
+1398
-55
No files matched your search
@@ -584,10 +584,10 @@ int callscreen_run_main(int argc, char** argv) {
|
||||
int softkeyPending = 0;
|
||||
int64_t softkeyDeadlineMs = 0;
|
||||
|
||||
auto pctToHwVol = [](int pct, bool spk, bool hp = false) -> long {
|
||||
auto pctToHwVol = [](int pct, bool /*spk*/, bool hp = false) -> long {
|
||||
int c = std::clamp(pct, 5, 100);
|
||||
if (hp) return 52 + (c * 32 + 50) / 100;
|
||||
return spk ? (56 + (c * 32 + 50) / 100) : (60 + (c * 32 + 50) / 100);
|
||||
if (hp) return 51 + (c * 32 + 50) / 100;
|
||||
return 52 + (c * 32 + 50) / 100;
|
||||
};
|
||||
|
||||
auto refreshHardwareAudioState = [&]() {
|
||||
|
||||
@@ -902,9 +902,9 @@ int runFilesApp(int argc, char** argv) {
|
||||
}
|
||||
|
||||
int rvol = std::clamp(readRingVolumePct(), 0, 100);
|
||||
int rx3 = (rvol <= 0) ? 0 : (56 + (rvol * 32 + 50) / 100);
|
||||
int hp = (rvol <= 0) ? 0 : (52 + (rvol * 32 + 50) / 100);
|
||||
int ear = (rvol <= 0) ? 0 : (60 + (rvol * 32 + 50) / 100);
|
||||
int rx3 = (rvol <= 0) ? 0 : (52 + (rvol * 32 + 50) / 100);
|
||||
int hp = (rvol <= 0) ? 0 : (51 + (rvol * 32 + 50) / 100);
|
||||
int ear = (rvol <= 0) ? 0 : (52 + (rvol * 32 + 50) / 100);
|
||||
std::string cfgDir = homeDir + "/.config/sxmo";
|
||||
const char* xdgCfg = std::getenv("XDG_CONFIG_HOME");
|
||||
if (xdgCfg && *xdgCfg) cfgDir = std::string(xdgCfg) + "/sxmo";
|
||||
|
||||
@@ -574,9 +574,9 @@ int runRingtonesApp(int argc, char** argv) {
|
||||
|
||||
settings = loadRingSettings();
|
||||
int rvol = std::clamp(settings.ringVol, 0, 100);
|
||||
int rx3 = (rvol <= 0) ? 0 : (56 + (rvol * 32 + 50) / 100);
|
||||
int hp = (rvol <= 0) ? 0 : (52 + (rvol * 32 + 50) / 100);
|
||||
int ear = (rvol <= 0) ? 0 : (60 + (rvol * 32 + 50) / 100);
|
||||
int rx3 = (rvol <= 0) ? 0 : (52 + (rvol * 32 + 50) / 100);
|
||||
int hp = (rvol <= 0) ? 0 : (51 + (rvol * 32 + 50) / 100);
|
||||
int ear = (rvol <= 0) ? 0 : (52 + (rvol * 32 + 50) / 100);
|
||||
std::string volArg = "--volume=100";
|
||||
std::string loopArg = singleShot ? "--loop=no" : "--loop=2";
|
||||
bool useSparklerAf = isHapticAudioSpeakerDevice() &&
|
||||
@@ -1124,8 +1124,8 @@ int runRingtonesApp(int argc, char** argv) {
|
||||
saveRingSettings(settings);
|
||||
if (previewPid > 0) {
|
||||
int rvol = settings.ringVol;
|
||||
int rx3 = (rvol <= 0) ? 0 : (56 + (rvol * 32 + 50) / 100);
|
||||
int hp = (rvol <= 0) ? 0 : (52 + (rvol * 32 + 50) / 100);
|
||||
int rx3 = (rvol <= 0) ? 0 : (52 + (rvol * 32 + 50) / 100);
|
||||
int hp = (rvol <= 0) ? 0 : (51 + (rvol * 32 + 50) / 100);
|
||||
runAsyncCmd("outdev=$(cat /tmp/sxmo_audio_out_device 2>/dev/null); "
|
||||
"if [ \"$outdev\" = \"Bluetooth\" ]; then "
|
||||
" pactl set-sink-volume @DEFAULT_SINK@ " + std::to_string(rvol) + "% >/dev/null 2>&1; "
|
||||
|
||||
+12
-12
@@ -343,10 +343,10 @@ class PhoneController {
|
||||
long rx1 = alsa_.getInteger("RX1 Digital Volume", 78);
|
||||
if (rx1 <= 0) {
|
||||
hpPct = 0;
|
||||
} else if (rx1 >= 84) {
|
||||
} else if (rx1 >= 83) {
|
||||
hpPct = 100;
|
||||
} else {
|
||||
hpPct = std::clamp(static_cast<int>(std::lround(((rx1 - 52) * 100.0) / 32.0)), 5, 100);
|
||||
hpPct = std::clamp(static_cast<int>(std::lround(((rx1 - 51) * 100.0) / 32.0)), 5, 100);
|
||||
}
|
||||
}
|
||||
hpPct = ((hpPct + 2) / 5) * 5;
|
||||
@@ -355,13 +355,13 @@ class PhoneController {
|
||||
} else {
|
||||
int spkPct = readIntFile(getSxmoCfgDir() + "/speaker_vol", -1);
|
||||
if (spkPct < 0 || spkPct > 100) {
|
||||
long rx3 = alsa_.getInteger("RX3 Digital Volume", 84);
|
||||
long rx3 = alsa_.getInteger("RX3 Digital Volume", 79);
|
||||
if (rx3 <= 0) {
|
||||
spkPct = 0;
|
||||
} else if (rx3 >= 88) {
|
||||
} else if (rx3 >= 84) {
|
||||
spkPct = 100;
|
||||
} else {
|
||||
spkPct = std::clamp(static_cast<int>(std::lround(((rx3 - 56) * 100.0) / 32.0)), 5, 100);
|
||||
spkPct = std::clamp(static_cast<int>(std::lround(((rx3 - 52) * 100.0) / 32.0)), 5, 100);
|
||||
}
|
||||
}
|
||||
spkPct = ((spkPct + 2) / 5) * 5;
|
||||
@@ -369,16 +369,16 @@ class PhoneController {
|
||||
"Speaker", true, 0, 100, 5, spkPct});
|
||||
}
|
||||
|
||||
// 2. Earpiece volume (0..100%, linear mapped to ALSA RX1 Digital Volume 60..92)
|
||||
// 2. Earpiece volume (0..100%, linear mapped to ALSA RX1 Digital Volume 52..84)
|
||||
int earPct = readIntFile(getSxmoCfgDir() + "/earpiece_vol", -1);
|
||||
if (earPct < 0 || earPct > 100) {
|
||||
long rx1 = alsa_.getInteger("RX1 Digital Volume", 88);
|
||||
long rx1 = alsa_.getInteger("RX1 Digital Volume", 79);
|
||||
if (rx1 <= 0) {
|
||||
earPct = 0;
|
||||
} else if (rx1 >= 92) {
|
||||
} else if (rx1 >= 84) {
|
||||
earPct = 100;
|
||||
} else {
|
||||
earPct = std::clamp(static_cast<int>(std::lround(((rx1 - 60) * 100.0) / 32.0)), 5, 100);
|
||||
earPct = std::clamp(static_cast<int>(std::lround(((rx1 - 52) * 100.0) / 32.0)), 5, 100);
|
||||
}
|
||||
}
|
||||
earPct = ((earPct + 2) / 5) * 5;
|
||||
@@ -651,7 +651,7 @@ class PhoneController {
|
||||
} else if (outDev == "Headphones") {
|
||||
writeIntFile(cfg + "/headphones_vol", it.value);
|
||||
writeIntFile("/tmp/sxmo_out_muted", (it.value <= 0) ? 1 : 0);
|
||||
long hw = (it.value <= 0) ? 0 : (52 + std::lround((it.value * 32.0) / 100.0));
|
||||
long hw = (it.value <= 0) ? 0 : (51 + std::lround((it.value * 32.0) / 100.0));
|
||||
alsa_.setEnum("HPHL", (it.value > 0) ? 1 : 0);
|
||||
alsa_.setEnum("HPHR", (it.value > 0) ? 1 : 0);
|
||||
alsa_.setInteger("RX1 Digital Volume", hw);
|
||||
@@ -663,7 +663,7 @@ class PhoneController {
|
||||
runAsyncCmd(cmd);
|
||||
} else {
|
||||
writeIntFile(cfg + "/speaker_vol", it.value);
|
||||
long hw = (it.value <= 0) ? 0 : (56 + std::lround((it.value * 32.0) / 100.0));
|
||||
long hw = (it.value <= 0) ? 0 : (52 + std::lround((it.value * 32.0) / 100.0));
|
||||
if (outDev == "Speaker") {
|
||||
writeIntFile("/tmp/sxmo_out_muted", (it.value <= 0) ? 1 : 0);
|
||||
alsa_.setBoolean("SPK DAC Switch", it.value > 0);
|
||||
@@ -684,7 +684,7 @@ class PhoneController {
|
||||
std::string cfg = getSxmoCfgDir();
|
||||
::mkdir(cfg.c_str(), 0755);
|
||||
writeIntFile(cfg + "/earpiece_vol", it.value);
|
||||
long hw = (it.value <= 0) ? 0 : (60 + std::lround((it.value * 32.0) / 100.0));
|
||||
long hw = (it.value <= 0) ? 0 : (52 + std::lround((it.value * 32.0) / 100.0));
|
||||
if (readActiveOutputDevice() == "Earpiece") {
|
||||
writeIntFile("/tmp/sxmo_out_muted", (it.value <= 0) ? 1 : 0);
|
||||
alsa_.setEnum("EAR_S", (it.value > 0) ? 1 : 0);
|
||||
|
||||
Reference in new issue
Block a user