[Miscellaneous Android Development] siljaer:
snapdragon 410 codec and mixer paths

I am writing this post in order to collect the information I've found to modify mixer_paths.xml. I hope it will be useful to anyone developing for the trunk.

The first part of mixer_paths.xml sets default values for the mixer. The second part defines "paths", that is, sequences of commands depending on the device/action chosen. Paths sections can be nested.

The trunk uses the snapdragon 410, that has the following:

Audio inputs: three single-ended inputs and two ADCs (8,16,32,48 KHz). In the trunk should be connected only two: handset mic and headset mic. ADCs outputs are routed to decimators DEC1 and DEC2 (or TX1 and TX2).

example:

<path name="adc1">
<ctl name="DEC1 MUX" value="ADC1" />
</path>

It looks like ADC1 is permanently connected to mouthpiece, while ADC2 is multiplexed (headset mic/secondary mic)

<path name="headset-mic">
<path name="adc2" />
<ctl name="ADC2 MUX" value="INP2" />
<ctl name="IIR1 INP1 MUX" value="DEC1" />
</path>

here we connect headset mic (INP2) to ADC2; more on IIR filtering and mixing later.

We can control the analog gains of ADCs and the digital volumes of DECn.

example:

<ctl name="ADC1 Volume" value="6" />
<ctl name="ADC2 Volume" value="6" />
<ctl name="ADC3 Volume" value="6" />
<ctl name="DEC1 Volume" value="84" />
<ctl name="DEC2 Volume" value="84" />

Audio outputs: Four outputs: Earpiece, headphones(2), Class-D speaker driver, Three DACs. Three interpolation filters outputs (RX1, RX2, RX3) are routed to the DACs.

One DAC is permanently connected to the loudspeaker, and fed by RX3. RX1 is used for earpiece and/or headphone. RDAC1 (not mentioned) is possibly fed with RX1 and connected to headphones (??). RDAC2 is mentioned (has it two channels?).

example:

<path name="headphones">
<ctl name="MI2S_RX Channels" value="Two" />
<ctl name="RX1 MIX1 INP1" value="RX1" />
<ctl name="RX2 MIX1 INP1" value="RX2" />
<ctl name="RDAC2 MUX" value="RX2" />
<ctl name="HPHL" value="Switch" />
<ctl name="HPHR" value="Switch" />
</path>

here, RX1 and RX2 are routed to RX1 and RX2. RX2 is routed to RDAC2 (possibly RX1 is already connected to RDAC1). But I admit that this sequence is still obscure to me.

We can control analog gain of loudspeaker and hearphones, and digital volumes of RXn.

example:

<ctl name="HPHL Volume" value="9" />
<ctl name="HPHR Volume" value="9" />
<ctl name="RX1 Digital Volume" value="84" />
<ctl name="RX2 Digital Volume" value="84" />
<ctl name="RX3 Digital Volume" value="84" />

loudspeaker/earpiece analog gains are controlled differently:

example:

<ctl name="Speaker Boost" value="ENABLE" />

<ctl name="EAR PA Gain" value="POS_1P5_DB" />
<ctl name="EAR PA Boost" value="ENABLE" />

Internally we have Mixer1 and Mixer2. Mixer1 is used for routing/mixing purposes.

example:

<path name="speaker">
<ctl name="RX3 MIX1 INP1" value="RX1" />
<ctl name="SPK DAC Switch" value="1" />
</path>

here RX1 (earpiece/headphones signal) is routed to the speaker and the speaker turned on.

Mixer2 is used in association with one IIR filtering block (the manual mentions two IIRs, but it also mentions three DACs....).

The IIR filtering block(s) are meant to perform filtering needed for sidetone (feedback for speaker's voice fed into their own earpiece).

example:

<path name="handset-mic">
<path name="adc1" />
<ctl name="IIR1 INP1 MUX" value="DEC1" />
</path>

we use ADC1 settings, and we feed IIR1 with DEC1

<path name="sidetone-iir">
<ctl name="IIR1 Enable Band1" value="1" />
<ctl name="IIR1 Enable Band2" value="1" />
<ctl name="IIR1 Enable Band3" value="1" />
<ctl name="IIR1 Enable Band4" value="1" />
<ctl name="IIR1 Enable Band5" value="1" />
</path>

enabling IIR1 filtering bands

<path name="sidetone-handset">
<path name="sidetone-iir" />
<ctl name="IIR1 INP1 Volume" value="53" />
<ctl name="RX1 MIX2 INP1" value="IIR1" />
</path>

here we set volume of IIR1 input, the output of IIR1 is then added to RX1 (RX1=RX1+IIR1) using mixer2

finally, RX1 is routed to earpiece:

<path name="handset">
<ctl name="RX1 MIX1 INP1" value="RX1" />
<ctl name="RDAC2 MUX" value="RX1" />
<ctl name="EAR_S" value="Switch" />
</path>

Unfortunately, I still have to figure out the meaning of most of the initial part settings, MI2S and so on...