nau8822 codec driver 錄音時mic bias 無法自動打開問題
問題描述:
kernel版本:3.10
在nuc970上測試nau8822驅動時發現,雖然驅動中有如下定義:
SND_SOC_DAPM_MICBIAS("Mic Bias", NAU8822_POWER_MANAGEMENT_1, 4, 0),
但在播放錄音時始終調不到該操作。
在route上增加如下路徑
{"Left Boost Mixer", NULL, "Mic Bias"},
后依然無法調用到Mic Bias。
分析:
經測試及查資料發現,是因為SND_SOC_DAPM_MICBIAS在3.10內核中不是起點或終點,所以如果定義mic bias為SND_SOC_DAPM_MICBIAS,它不能位于路徑的起點或終點。
一條完整的dapm音頻路徑,必然有起點和終點,我們把位于這些起點和終點的widget稱之為端點widget。以下這些類型的widget可以成為端點widget:
codec的輸入輸出引腳:
snd_soc_dapm_output
snd_soc_dapm_input
外接的音頻設備:
snd_soc_dapm_hp
snd_soc_dapm_spk
snd_soc_dapm_line
音頻流(stream domain):
snd_soc_dapm_adc
snd_soc_dapm_dac
snd_soc_dapm_aif_out
snd_soc_dapm_aif_in
snd_soc_dapm_dai_out
snd_soc_dapm_dai_in
電源、時鐘和其它:
snd_soc_dapm_supply
snd_soc_dapm_regulator_supply
snd_soc_dapm_clock_supply
snd_soc_dapm_kcontrol
解決方法有2:
1.構造新的route使bias位于路徑的中間,例如:
{"Left Input Mixer", "Mic Switch", "Mic bias"},
{"Mic bias", NULL, "LMICN"},
{"Mic bias", NULL, "LMICP"},
2.采用新的定義:SND_SOC_DAPM_SUPPLY代替SND_SOC_DAPM_MICBIAS來定義mic bias,具體定義如下:
SND_SOC_DAPM_SUPPLY("Mic Bias",
NAU8822_POWER_MANAGEMENT_1, 4, 0, NULL, 0),
在route定義中增加如下route:
{"Left Boost Mixer", NULL, "Mic Bias"},
測試驗證:
只驗證了方法2,修改代碼后,在nuc970bsp中運行
/usr/arecord -f S16_LE -r 8000 -c 2 -D plughw:0,0 test.wav
成功調出mic bias,log如下:
bash-3.2# /usr/arecord -f S16_LE -r 8000 -c 2 -D plughw:0,0 test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Stereo
pop test : Queue RMICN: reg=0xffffffff, 0x1/0x1
pop test : Queue RMICP: reg=0xffffffff, 0x1/0x1
pop test : Queue LMICN: reg=0xffffffff, 0x1/0x1
pop test : Queue LMICP: reg=0xffffffff, 0x1/0x1
pop test : Queue RAUX: reg=0xffffffff, 0x1/0x1
pop test : Queue R2: reg=0xffffffff, 0x1/0x1
pop test : Queue LAUX: reg=0xffffffff, 0x1/0x1
pop test : Queue L2: reg=0xffffffff, 0x1/0x1
pop test : Queue Mic Bias: reg=0x1, 0x10/0x10
pop test : Queue Capture: reg=0xffffffff, 0x1/0x1
pop test : Queue Right Input Mixer: reg=0x2, 0x8/0x8
pop test : Queue Left Input Mixer: reg=0x2, 0xc/0xc
pop test : Queue Right Boost Mixer: reg=0x2, 0x20/0x20
pop test : Queue Left Boost Mixer: reg=0x2, 0x30/0x30
pop test : Queue Left Capture PGA: reg=0x2d, 0x0/0x40
pop test : Queue Right Capture PGA: reg=0x2e, 0x0/0x40
pop test : Queue Right ADC: reg=0x2, 0x2/0x2
pop test : Queue Left ADC: reg=0x2, 0x3/0x3
新聞熱點
疑難解答