有關 codec routing 部份.,,,
先看 driver 的 snd_soc_dapm_route 矩陣
.先把array copy 出來。
https://gist.github.com/checko/eb5fd55bfd7baa25ddd4
每個 element 有三個欄位. (OUT, SW, IN).
看 電路,決定一下 route 的 in, out.
以 play 來說,:
out 是 HPOL, HPOR.
input 是 I2S 第一組
找 array 中,OUT 欄位是 HPOL. HPOR 的..
{ "HPOL", NULL, "HP Amp" }, { "HPOL", NULL, "HP L Amp" }, { "HPOL", NULL, "Improve HP Amp Drv" }, { "HPOR", NULL, "HP Amp" }, { "HPOR", NULL, "HP R Amp" }, { "HPOR", NULL, "Improve HP Amp Drv" },所以可以知道HPO 可以有三個 input path 可以選 : HP AMP. HP L/R Amp, Improved HP Amp Drv
其中 HP L/R Amp 和 Improve HP Amp Drv 都沒有 input path, 只有 HP Amp 有:
{ "HP Amp", NULL, "HPO MIX" }, { "HP Amp", NULL, "JD Power" }, { "HP Amp", NULL, "Mic Det Power" },一樣,其中只有 HPO MIX有 input source:
{ "HPO MIX", "DAC1 Switch", "DAC 1" }, { "HPO MIX", "HPVOL Switch", "HPOVOL" },
HPOVOL 的話,要經過..
{ "HPOVOL", NULL, "HPOVOL MIXL" }, { "HPOVOL", NULL, "HPOVOL MIXR" },只看 HPOVOL MIXL (因為沒有要 swap L/R, or mono):
{ "HPOVOL MIXL", "DAC1 Switch", "DAC L1" }, { "HPOVOL MIXL", "INL Switch", "INL VOL" },有兩個選項,一個 DAC L1 (跟剛剛 HPO MIX 一樣), 另一個是 INL VOL
IN VOL 接到 Analog Input,所以不是我們要用的。
看 DAC L1:
{ "DAC L1", NULL, "Stereo DAC MIXL" }, { "DAC L1", NULL, "PLL1", check_sysclk1_source },其中 PLL1 會 trigger check_sysclk_source, 同時也沒有 input,所以只看 Stereo DAC MIXL:
{ "Stereo DAC MIXL", "DAC L1 Switch", "DAC1 MIXL" }, { "Stereo DAC MIXL", "DAC R1 Switch", "DAC1 MIXR" }, { "Stereo DAC MIXL", "DAC L2 Switch", "DAC L2 Volume" }, { "Stereo DAC MIXL", NULL, "dac stereo1 filter" }, { "Stereo DAC MIXL", NULL, "DAC L1 Power" },DAC L1 Power 和 dac stereo1 filter 沒有 input,
IF1_DAC (也就是 I2S 第一組),有 0-7 共 8組 DAC...(!!)
DAC L1 接到 SounzReal, DAC L2 接到 Voice, 所以先看簡單的. DAC1 MIXL..
{ "DAC1 MIXL", "Stereo ADC Switch", "Stereo1 ADC MIXL" }, { "DAC1 MIXL", "DAC1 Switch", "DAC1 L Mux" }, { "DAC1 MIXL", NULL, "dac stereo1 filter" }, { "DAC1 MIXL", NULL, "DAC L1 Power" },dac stereo1 filter, DAC L1 Power 一樣,沒有 input.
Stereo1 ADC MIXL 接到 Analog Input ADC 哪一路,
所以應該是要看 DAC1 L Mux:
{ "DAC1 L Mux", "IF1 DAC", "IF1 DAC1 L" }, { "DAC1 L Mux", "IF2 DAC", "IF2 DAC L" },要 route 到 I2S 第一路,所以選 IF1 DAC1 L:
{ "IF1 DAC1 L", NULL, "IF1 DAC1" },IF1 DAC1 的 source 有兩個:
{ "IF1 DAC1", NULL, "AIF1RX" }, { "IF1 DAC1", NULL, "I2S1" },好像就是最後了....
最後是..
#ifdef USE_ASRC {"I2S1", NULL, "ASRC enable"}, {"I2S2", NULL, "ASRC enable"}, #endif
OK, 把上面的 path 列出來: (L)
{ "HPOL" , NULL , "HP Amp" }, { "HP Amp" , NULL , "HPO MIX" }, { "HPO MIX" , "DAC1 Switch" , "DAC 1" }, { "DAC 1" , NULL , "DAC L1" }, { "DAC L1" , NULL , "Stereo DAC MIXL" }, { "Stereo DAC MIXL", "DAC L1 Switch", "DAC1 MIXL" }, { "DAC1 MIXL" , "DAC1 Switch" , "DAC1 L Mux" }, { "DAC1 L Mux" , "IF1 DAC" , "IF1 DAC1 L" }, { "IF1 DAC1 L" , NULL , "IF1 DAC1" }, { "IF1 DAC1" , NULL , "I2S1" }, { "I2S1" , NULL , "ASRC enable" },其中,中間一項不是 NULL 的,就要寫在 asound.conf 中..
寫的東西要用 tinymixer 來看...
tinymixer 會列出所有的 control gadge..
要設的有...
36 BOOL 1 HPO MIX DAC1 Switch On 62 BOOL 1 Stereo DAC MIXR DAC R1 Switch On 65 BOOL 1 Stereo DAC MIXL DAC L1 Switch On 73 BOOL 1 DAC1 MIXR DAC1 Switch On 75 BOOL 1 DAC1 MIXL DAC1 Switch On 68 ENUM 1 DAC1 R Mux IF1 DAC 69 ENUM 1 DAC1 L Mux IF1 DAC
所以 /etc/asound.conf 就是....