mixer_paths.xml 作用
音频通路配置
在qcom平台上, DSP 连接着 FE, 和 BE;
其中 FE对应着一个 PCM设备,可以看做是一个usecase;
其中 BE对应着一个DAI, DAI连接着具体的audio device;
FE最终所对应audio device有很多个可选,具体的对应关系 需要通过配置 音频通路来配置;
简单理解:连接usecase 和 device 并打开该通路上的控件;
同时mixer_paths.xml 还提供mixer 各个控件的初始化配置;
mixer ctrl 初始化
mixer ctrl 初始化
<!-- These are the initial mixer settings -->
<ctl name="Voice Rx Device Mute" id="0" value="0" />
<ctl name="Voice Rx Device Mute" id="1" value="-1" />
<ctl name="Voice Rx Device Mute" id="2" value="20" />
<ctl name="Voice Tx Mute" id="0" value="0" />
<ctl name="Voice Tx Mute" id="1" value="-1" />
<ctl name="Voice Tx Mute" id="2" value="500" />
<ctl name="Voice Rx Gain" id="0" value="0" />
<ctl name="Voice Rx Gain" id="1" value="-1" />
<ctl name="Voice Rx Gain" id="2" value="20" />
<ctl name="Voip Tx Mute" id="0" value="0" />
<ctl name="Voip Tx Mute" id="1" value="500" />
<ctl name="Voip Rx Gain" id="0" value="0" />
<ctl name="Voip Rx Gain" id="1" value="20" />
<ctl name="Voip Mode Config" value="12" />
<ctl name="Voip Rate Config" value="0" />
<ctl name="Voip Evrc Min Max Rate Config" id="0" value="1" />
<ctl name="Voip Evrc Min Max Rate Config" id="1" value="4" />
<ctl name="Voip Dtx Mode" value="0" />
<ctl name="TTY Mode" value="OFF" />
<ctl name="INT4_MI2S_RX Port Mixer INT3_MI2S_TX" value="0" />
<ctl name="SLIMBUS_7_RX Audio Mixer MultiMedia1" value="0" />
......
<ctl name="TERT_MI2S_RX Audio Mixer MultiMedia1" value="0" />
<ctl name="TERT_MI2S_RX Audio Mixer MultiMedia2" value="0" />
<ctl name="TERT_MI2S_RX Audio Mixer MultiMedia3" value="0" />
......
<ctl name="DISPLAY_PORT Mixer MultiMedia1" value="0" />
<ctl name="DISPLAY_PORT Mixer MultiMedia2" value="0" />
<ctl name="DISPLAY_PORT Mixer MultiMedia3" value="0" />
......
<ctl name="Display Port RX Channels" value="Two" />
<ctl name="INT4_MI2S_RX Audio Mixer MultiMedia1" value="0" />
<ctl name="INT0_MI2S_RX Audio Mixer MultiMedia1" value="0" />
<ctl name="INT4_MI2S_RX Audio Mixer MultiMedia2" value="0" />
......
<ctl name="PRI_MI2S_RX Audio Mixer MultiMedia1" value="0" />
<ctl name="USB_AUDIO_RX Audio Mixer MultiMedia1" value="0" />
<ctl name="USB_AUDIO_RX Audio Mixer MultiMedia2" value="0" />
......
<ctl name="USB_AUDIO_RX Format" value="S16_LE" />
<ctl name="USB_AUDIO_RX SampleRate" value="KHZ_48" />
<ctl name="USB_AUDIO_RX Channels" value="Two" />
......
<!-- HFP start -->
<ctl name="HFP_SLIM7_UL_HL Switch" value="0" />
<ctl name="INT4_MI2S_RX Port Mixer SLIM_7_TX" value="0" />
<ctl name="INT0_MI2S_RX Port Mixer SLIM_7_TX" value="0" />
<!-- HFP end -->
<!-- echo reference -->
<ctl name="AUDIO_REF_EC_UL1 MUX" value="None" />
<!-- usb headset -->
<ctl name="AFE_PCM_RX Audio Mixer MultiMedia1" value="0" />
......
<!-- fm -->
<ctl name="SLIMBUS_8 LOOPBACK Volume" value="0" />
<ctl name="INT4_MI2S_RX Port Mixer SLIM_8_TX" value="0" />
......
<!-- Multimode Voice1 -->
<ctl name="INT4_MI2S_RX_Voice Mixer VoiceMMode1" value="0" />
<ctl name="INT0_MI2S_RX_Voice Mixer VoiceMMode1" value="0" />
<ctl name="VoiceMMode1_Tx Mixer INT3_MI2S_TX_MMode1" value="0" />
<!-- Multimode Voice1 HDMI -->
<ctl name="HDMI_RX_Voice Mixer VoiceMMode1" value="0" />
<!-- Multimode Voice1 BTSCO -->
<ctl name="SLIM_7_RX_Voice Mixer VoiceMMode1" value="0" />
<ctl name="VoiceMMode1_Tx Mixer SLIM_7_TX_MMode1" value="0" />
<!-- Multimode Voice1 USB headset -->
<ctl name="AFE_PCM_RX_Voice Mixer VoiceMMode1" value="0" />
<ctl name="VoiceMMode1_Tx Mixer AFE_PCM_TX_MMode1" value="0" />
<ctl name="USB_AUDIO_RX_Voice Mixer VoiceMMode1" value="0" />
<ctl name="VoiceMMode1_Tx Mixer USB_AUDIO_TX_MMode1" value="0" />
<!-- Miltimode Voice1 end-->
<!-- Multimode Voice2 -->
<ctl name="INT4_MI2S_RX_Voice Mixer VoiceMMode2" value="0" />
......
<!-- Multimode Voice2 HDMI -->
<ctl name="HDMI_RX_Voice Mixer VoiceMMode2" value="0" />
......
<!-- Multimode Voice2 end-->
<!-- Voice external ec. reference -->
<ctl name="VOC_EXT_EC MUX" value="NONE" />
<!-- Voice external ec. reference end -->
<!-- RT Proxy Cal -->
<ctl name="RT_PROXY_1_RX SetCalMode" value="CAL_MODE_NONE" />
<ctl name="RT_PROXY_1_TX SetCalMode" value="CAL_MODE_NONE" />
<!-- RT Proxy Cal end -->
<!-- mixer control to disable lowlatency qos voting -->
<ctl name="MultiMedia5_RX QOS Vote" value="Disable" />
<!-- mixer control to disable lowlatency qos voting end -->
<!-- Incall Recording -->
<ctl name="MultiMedia1 Mixer VOC_REC_UL" value="0" />
......
<!-- Incall Recording End -->
<!-- Incall Music -->
<ctl name="Incall_Music Audio Mixer MultiMedia2" value="0" />
<!-- Incall Music End -->
......
<!-- Codec controls -->
<!-- WSA controls -->
<ctl name="SpkrLeft COMP Switch" value="0" />
<ctl name="SpkrRight COMP Switch" value="0" />
<ctl name="SpkrLeft BOOST Switch" value="0" />
<ctl name="SpkrRight BOOST Switch" value="0" />
<ctl name="SpkrLeft VISENSE Switch" value="0" />
<ctl name="SpkrRight VISENSE Switch" value="0" />
<ctl name="SpkrLeft SWR DAC_Port Switch" value="0" />
<ctl name="SpkrRight SWR DAC_Port Switch" value="0" />
<ctl name="SpkrLeft WSA PA Gain" value="G_0_DB" />
<ctl name="SpkrRight WSA PA Gain" value="G_0_DB" />
<ctl name="SpkrLeft WSA PA Mute" value="1" />
<ctl name="SpkrRight WSA PA Mute" value="1" />
<ctl name="EAR SPKR PA Gain" value="G_DEFAULT" />
<!-- Volume controls -->
<ctl name="HPHL Volume" value="9" />
<ctl name="HPHR Volume" value="9" />
<ctl name="EAR PA Gain" value="POS_1P5_DB" />
<ctl name="EAR PA Boost" value="ENABLE" />
<ctl name="RX1 Digital Volume" value="84" />
<ctl name="RX2 Digital Volume" value="84" />
<ctl name="RX3 Digital Volume" value="84" />
<ctl name="RX4 Digital Volume" value="84" />
<ctl name="RX5 Digital Volume" value="84" />
<ctl name="ADC1 Volume" value="4" />
<ctl name="ADC2 Volume" value="4" />
<ctl name="ADC3 Volume" value="14" />
<ctl name="DEC1 Volume" value="84" />
<ctl name="DEC2 Volume" value="84" />
<ctl name="DEC3 Volume" value="84" />
<ctl name="DEC4 Volume" value="84" />
<!-- Compander controls -->
<ctl name="COMP1 Switch" value="1" />
<ctl name="COMP2 Switch" value="1" />
<!-- MUX controls -->
<ctl name="DEC1 MUX" value="ZERO" />
<ctl name="DEC2 MUX" value="ZERO" />
<ctl name="DEC3 MUX" value="ZERO" />
<ctl name="DEC4 MUX" value="ZERO" />
<ctl name="ADC2 MUX" value="ZERO" />
<ctl name="RDAC2 MUX" value="ZERO" />
<!-- Interpolator chain controls -->
<!-- ADD RX Chain Controls -->
<ctl name="RX1 MIX1 INP1" value="ZERO" />
<ctl name="RX2 MIX1 INP1" value="ZERO" />
<ctl name="RDAC2 MUX" value="ZERO" />
<ctl name="HPHL" value="ZERO" />
<ctl name="HPHR" value="ZERO" />
<ctl name="RX1 MIX2 INP1" value="ZERO" />
<ctl name="RX2 MIX2 INP1" value="ZERO" />
<ctl name="RX3 MIX1 INP1" value="ZERO" />
<ctl name="RX4 MIX1 INP1" value="ZERO" />
<ctl name="RX5 MIX1 INP1" value="ZERO" />
<ctl name="RX HPH Mode" value="NORMAL" />
<ctl name="COMP0 RX1" value="0" />
<ctl name="COMP0 RX2" value="0" />
<!-- IIR/voice anc -->
<ctl name="IIR1 Band1" id ="0" value="268435456" />
<ctl name="IIR1 Band1" id ="1" value="0" />
......
audio route
mixer_pahts.xml 中根据usecase设置ctl控件,以deep-buffer-playback 为例:
<path name="deep-buffer-playback speaker">
<ctl name="QUAT_MI2S_RX Audio Mixer MultiMedia1" value="1" />
</path>
<path name="deep-buffer-playback headphones">
<ctl name="TERT_MI2S_RX Audio Mixer MultiMedia1" value="1" />
</path>
<path name="deep-buffer-playback earphones">
<ctl name="QUAT_MI2S_RX Audio Mixer MultiMedia1" value="1" />
</path>
这些通路其实就是连接 usecase、device 之间的路由。比如 “deep-buffer-playback speaker” 是连接 deep-buffer-playback FE PCM、speaker Device 之间的路由,打开 “deep-buffer-playback speaker”,则把 deep-buffer-playback FE PCM 和 speaker Device 连接起来;关闭 “deep-buffer-playback speaker”,则断开 deep-buffer-playback FE PCM 和 speaker Device 的连接。
路由控件名称一般是: $BE_DAI Audio Mixer $FE_PCM,录制类型的路由控件名称一般是:$FE_PCM Audio Mixer $BE_DAI,这很容易分辨。
deep-buffer-playback 连接 speaker
例如 “deep-buffer-playback speaker” 通路中的路由控件:
<ctl name="QUAT_MI2S_RX Audio Mixer MultiMedia1" value="1" />
- MultiMedia1:deep_buffer usacase 对应的 FE PCM
- QUAT_MI2S_RX:speaker device 所连接的 BE DAI
- Audio Mixer:表示 DSP 路由功能
- value:1 表示连接,0 表示断开连接
为了使得声音从 speaker 端点输出,需要打开 AIF1、DAC1、SPKOUT 这些部件,并把它们串联起来,这样音频数据才能顺着这条路径(AIF1>DAC1>SPKOUT>SPEAKER)一路输出到 speaker。
mixer_pahts.xml 中看 speaker 通路的通路配置:
<path name="speaker">
<ctl name="SPKL DAC1 Switch" value="1" />
<ctl name="DAC1L AIF1RX1 Switch" value="1" />
<ctl name="DAC1R AIF1RX2 Switch" value="1" />
</path>