I am facing issue in recording audio via Mic IN. SGTL5000 is interfaced to imx8mnano.
I am using arecord to record the audio. Sample sample output I get:
root@imx8mn-lpddr4-evk:~# arecord -D hw:1,0 -r 48000 -f S16_LE -c 2 -d 10 /record.wav -vvv
Hardware PCM card 1 'sgtl5000-audio' device 0 subdevice 0
Its setup is:
stream : CAPTURE
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 48000
exact rate : 48000 (48000/1)
msbits : 16
buffer_size : 24000
period_size : 6000
period_time : 125000
tstamp_mode : NONE
tstamp_type : MONOTONIC
period_step : 1
avail_min : 6000
period_event : 0
start_threshold : 1
stop_threshold : 24000
silence_threshold: 0
silence_size : 0
boundary : 6755399441055744000
appl_ptr : 0
hw_ptr : 0
Recording WAVE '/record.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
Max peak (12000 samples): 0x00007fff #################### 99%
But the recording just has noise, no proper audio. Audio output to HPOUT jack is working fine.
Please suggest ways to check if the configuration is correct.
Below is the DTS changes done.
sound-sgtl5000{
compatible = "fsl,imx-audio-sgtl5000";
model = "sgtl5000-audio";
audio-cpu = <&sai3>;
audio-asrc=<&easrc>;
audio-codec = <&sgtl5000>;
audio-routing =
"MIC_IN", "Mic Jack",
"Mic Jack", "Mic Bias",
"Headphone Jack", "HP_OUT",
"Line Out Jack", "LINE_OUT";
mux-int-port = <2>;
mux-ext-port = <3>;
};
sgtl5000: codec@a {
compatible = "fsl,sgtl5000";
reg = <0xa>;
#sound-dai-cells = <1>;
clocks = <&clk IMX8MN_CLK_SAI3_ROOT>;
micbias-resistor-k-ohms = <2>;
micbias-voltage-m-volts = <2250>;
VDDA-supply = <®_module_3v3>;
VDDIO-supply = <®_module_3v3>;
VDDD-supply = <®_module_1v8>;
status = "okay";
};
Hoping to get a quick reply.
Any suggestions??
Could you tell me which version of BSP are you using?
Could you show me your board's device tree file?
For your reference, this dts file use the sgtl5000 codec.