# Pixel 3 (blueline) — loudspeaker routing fix

**Status:** SOLVED 2026-07-12 — pmOS routing applied; fix lives in Pixel3Arch rootfs-overlay UCM (commit 2f39c06) + alsactl store. Both speakers verified by ear.
**Goal:** Make the loud bottom speaker work. Right now sound only comes from the
top **earpiece**; the loud bottom-firing speaker never fires. Casey reports
postmarketOS had audio working but with the channels "reversed".

## Device / stack
- Google Pixel 3 (blueline), sdm845, mainline kernel `7.1.1-sdm845` (built 2026-07-11)
- Souveraine OS (Arch Linux ARM), Hyprland/Wayland
- ALSA card 0 = "Google Pixel 3" (`G3`)
- Audio: PipeWire 1.6.7 (PulseAudio shim)
- Speakers: **dual Cirrus CS35L36** amps ("Left"/"Right") on `QUAT_TDM_RX_0` (MultiMedia1)
- Earpiece amp: WCD9340 `EAR PA` (separate codec)

## Key config files
- Active UCM (system): `/usr/share/alsa/ucm2/Google/blueline/HiFi.conf`
  - referenced by `/usr/share/alsa/ucm2/conf.d/sdm845/Google-Pixel-3.conf`
  - **Only defines a "Speaker" device. No earpiece device. Never sets Channel Mux.**
- Intended fix location: **user override** under `~/.config/alsa/ucm2/...`
  (Casey chose user-override so pacman updates to alsa-ucm-conf don't clobber it.)
- Baseline ALSA state snapshot saved to scratchpad as `asound-current.state`
  (scratchpad is ephemeral — re-capture with `alsactl -f <file> store 0` if needed).

## What we PROVED (via live tone tests)
1. Both CS35L36 amps are healthy; both transducers (earpiece + loud speaker)
   can physically produce sound.
2. **The 30% volume / SUSPENDED sink was a huge red herring** — many "silent"
   test results were just low volume. ALWAYS test at `pactl set-sink-volume
   @DEFAULT_SINK@ 100%` and un-suspend the sink first.
3. Default state: both amps have `Channel Mux = RX1` (numid 121 Left, 112 Right).
   => both amps pull the same slot => only earpiece is audible.
4. `EAR PA Volume`=0 did NOT silence the earpiece output => the sound you hear
   from the "earpiece" is being driven by a **CS35L36 amp**, not the WCD EAR PA.
5. At 100% vol, an L-only vs R-only test: **one channel DID come out the loud
   bottom speaker.** So the loudspeaker amp works — it just needs the right
   channel/slot routed to it. (Casey couldn't reliably tell L vs R by ear.)
6. BUT: simply splitting `Left Channel Mux=RX1 / Right Channel Mux=RX2` and
   playing duplicated-mono did NOT wake the loudspeaker in a later test.
   => The channel→amp mapping is UPSTREAM of `Channel Mux`, on the QUAT_TDM_RX_0
   TDM bus. `Channel Mux` alone is not the whole story.

## Relevant mixer controls (card 0, by numid)
- 121 `Left Channel Mux`   (enum: 0=RX1, 1=RX2)  — default 0
- 112 `Right Channel Mux`  (enum: 0=RX1, 1=RX2)  — default 0
- 122 `Left AMP Enable Switch`   / 113 `Right AMP Enable Switch`  (default on)
- 123 `Left BOOST Enable Switch` / 114 `Right BOOST Enable Switch`(default on)
- 18  `EAR PA Volume` (WCD earpiece amp; default 4)
- CS35L36 input source slots: `Left/Right ASPTX1..6SRC` (both amps identical:
  1SRC=2, 2SRC=3, 3SRC=5, 4SRC=6, 5SRC=4, 6SRC=0)
- UCM SectionVerb enables: `QUAT_TDM_RX_0 Audio Mixer MultiMedia1` = 1

## NEXT STEP (where we stopped)
Get postmarketOS's authoritative blueline mixer mapping — pmOS works, so its
UCM / mixer_paths is the source of truth. The most relevant is the pmaports
**7.1rc1 kernel MR (!8446)** because that matches this exact kernel (7.1.x):
- https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8446
- Device/blueline MR: https://gitlab.com/postmarketOS/pmaports/-/merge_requests/3932
- Original Pixel 3 device MR (!5514): https://gitlab.com/postmarketOS/pmaports/-/merge_requests/5514
- pmOS SDM845 audio writeup: https://postmarketos.org/edge/2023/01/11/sdm845-audio/
- pmOS Audio wiki (xml2ucm / mixer_paths.xml -> UCM): https://wiki.postmarketos.org/wiki/Audio

Find in pmOS's config: which TDM slot / channel each CS35L36 amp is fed, and
whether it sets `Channel Mux` + the TDM RX slot routing so earpiece(top) and
loudspeaker(bottom) each get a distinct channel. Then encode that as a user UCM
override in `~/.config/alsa/ucm2/` (copy blueline HiFi.conf there, add the
Channel Mux / slot csets to the Speaker device's EnableSequence).

## HOW TO TEST (repeatable)
```sh
pactl set-sink-volume @DEFAULT_SINK@ 100%   # ALWAYS — 30% masks everything
pactl set-sink-mute   @DEFAULT_SINK@ 0
# distinct L/R tones already generated in scratchpad: left.wav right.wav stereo.wav
paplay left.wav ; paplay right.wav
# read/toggle mux:
amixer -c 0 cget numid=121   # Left Channel Mux
amixer -c 0 cset numid=112 1 # Right -> RX2
```
Restore baseline: both muxes -> 0, EAR PA -> 4, volume -> 30%.

## CAUTION
- Don't trust "silent" results unless volume is 100% and sink un-suspended.
- Reverse-engineering the TDM routing blind was NOT converging. Read the pmOS
  config first, then change mixers — don't guess.
