No microphone input
I originally had no call audio sent to the network on my birch device and after investigating, it looks like there's no audio going to the codec's ALSA capture interface. This is what a recording looks like and it's the same wave every time:
The recording was made by:
- Stopping and masking the
pulseaudio.socket
andpulseaudio.service
systemd user units. - Setting the ALSA UCM verb and device like so:
alsaucm -n -b - <<EOF
open wm8962
set _verb Audio
set _enadev Handset
EOF
- Recording from the ALSA device using
arecord -D hw:CARD=wm8962,DEV=0 -c 2 -f S16_LE -r 48000 t.wav
I've checked each of the relevant codec registers in the signal path while recording and I can find no reason that the microphone input isn't going through. Everything looks in order (note that the .dts sets the SAI2 clock, that is, the codec's MCLK pin, to 24576000 Hz):
Register | Value (base 2) | Relevant bit(s) | Value |
---|---|---|---|
R514 (0202h) GPIO 3 | 10011 | 4:0 GP3_FN [4:0] | 1_0011 = Digital Microphone Output Clock |
R516 (0204h) GPIO 5 | 1000000000010100 | 4:0 GP5_FN [4:0] | 1_0100 = Digital Microphone Input Data |
R25 (19h) Pwr Mgmt (1) | 10011111100 | 10 DMIC_ENA | 1 = Audio DSP input is from digital microphone interface |
3 ADCL_ENA - Left ADC Enable | 1 = Enabled | ||
2 ADCR_ENA - Right ADC Enable | 1 = Enabled | ||
R21 (15h) Left ADC Volume | 11001000 | 7:0 ADCL_VOL [7:0] - Left ADC Digital Volume | C8 (Volume 3.000 dB) |
R22 (16h) Right ADC Volume | 11001000 | 7:0 ADCR_VOL [7:0] - Right ADC Digital Volume | C8 (Volume 3.000 dB) |
R5 (05h) ADC & DAC Control 1 | 11000 | 0 ADC_HPF_DIS - ADC High-Pass Filter Disable | 0 = Enable |
R6 (06h) ADC & DAC Control 2 | 10000000001000 | 10 ADC_HPF_MODE - ADC High-Pass Filter Mode select | 0 = Hi-Fi mode (1st order) Note: ‘Hi-Fi Mode’ refers to the mode when ADC_HPF_MODE = 0 (first order filtering and a cut-off frequency of 3.5Hz at a sample rate of 44.1kHz); |
R264 (0108h) LHPF1 | 0 | 0 LHPF_ENA - Low/High-Pass Filter mode select | 0 = Disable |
R268 (010Ch) THREED1 | 0 | 0 THREED_ENA - 3D Surround Sound enable | 0 = Disabled |
R256 (0100h) DF1 | 0 | 0 DF1_ENA - DF1 Enable in ADC path | 0 = Disabled |
R16389 (4005h) SOUNDSTAGE_ENABLES_0 | 0 | 5 RTN_ADC_ENA - ADC ReTune enable | 0 = disabled |
R276 (0114h) DRC 1 | 1100 | 0 DRC_ENA - DRC Enable | 0 = Disabled |
R7 (07h) Audio Interface 0 | 1100010 | 8 ADC_LRSWAP - Swap left/right ADC data on the interface | 0 = Normal |
R5 (05h) ADC & DAC Control 1 | 11000 | 6 ADCR_DAT_INV - Right ADC Invert | 0 = Right ADC output not inverted |
5 ADCL_DAT_INV - Left ADC Invert | 0 = Left ADC output not inverted | ||
R285 (011Dh) Tloopback | 0 | 1 TLB_ENA - T-Loopback Enable | 0 = Disabled |
R7 (07h) Audio Interface 0 | 1100010 | 10 AIFADC_TDM_MODE - ADC TDM Mode Select | 0 = Normal ADCDAT operation (1 stereo slot) |
8 ADC_LRSWAP - Swap left/right ADC data on the interface | 0 = Normal | ||
7 BCLK_INV - BCLK Invert | 0 = BCLK not inverted | ||
6 MSTR - Audio Interface Mode Select | 1 = Master mode | ||
4 LRCLK_INV - Right, left and I2S modes - LRCLK polarity | 0 = normal LRCLK polarity | ||
3:2 WL [1:0] - Digital Audio Interface Word Length | 00 = 16 bits | ||
1:0 FMT [1:0] - Digital Audio Interface Format | 10 = I2S Format | ||
R9 (09h) Audio Interface 1 | 1100000000 | 2 ADC_COMP - ADC Companding Enable | 0 = disabled |
R8 (08h) Clocking2 | 100111101010 | 11 CLKREG_OVD - Clock Configuration Override | 1 = Clocking registers are controlled as normal via Control Interface |
10:9 MCLK_SRC - MCLK source select | 00 = MCLK pin | ||
5 SYSCLK_ENA - SYSCLK enable | 1 = Enabled | ||
3:0 BCLK_DIV - BCLK Rate | 1010 = DSPCLK / 16 | ||
R4 (04h) Clocking1 | 100010 | 10:9 DSPCLK_DIV [1:0] - DSP Clock Divider | 00 = MCLK |
8:6 ADCSYS_CLK_DIV [2:0] - ADC Sample Rate Divider | 000 = SYSCLK | ||
2:1 SYSCLK_DIV - SYSCLK Divider | 01 = MCLK / 2 | ||
R56 (38h) Clocking 4 | 10100100001010 | 4:1 MCLK_RATE [3:0] - Selects the MCLK / fs ratio | 0101 = 512 |
R27 (1Bh) Additional Control (3) | 10000 | 2:0 SAMPLE_RATE [2:0] - Selects the Sample Rate (fs) | 000 = 44.1kHz, 48kHz |
4 SAMPLE_RATE_INT_MODE - Selects the Integer or Fractional value of the SAMPLE_RATE register | 1 = 8k, 12k, 16k, 24k, 32k, 48k or 96kHz | ||
R14 (0Eh) Audio Interface 2 | 100000 | 10:0 AIF_RATE [10:0] - LRCLK Rate = BCLK / AIF_RATE; Integer (LSB = 1) | 32 BCLKs per LRCLK |
R23 (17h) Additional Control (1) | 101100001 | 5 ADC_HP - ADC Oversampling Ratio | 1 = High Performance (typically 128 x fs) |
Given that some users have reported working microphone input during calls, I'm tempted to suspect that this is a hardware issue.
The kernel package is linux-image-5.3.0-librem5-h1 5.3.0+librem5.6