Microphone input on the SABRE Lite and Nitrogen6x

Published on December 6, 2012

Archived Notice

This article has been archived and may contain broken links, photos and out-of-date information. If you have any questions, please Contact Us.

We just identified a bug in the i.MX6 Linux driver for the SGTL5000 audio codec that could account for some reports of microphone failure.

You can see the patch here:

In English, that 4 is used as the maximum value for a control named "Mic" which is supposed to allow setting of a microphone gain:

Simple mixer control 'Mic',0 Capabilities: volume volume-joined penum Playback channels: Mono Capture channels: Mono Limits: 0 - 4 Mono: 0 [0%] [0.00dB] The only trouble is, there are only two bits of gain in the corresponding SGTL5000 register, so setting the value to 4 causes wrap and yields zero.

When a commodity PC microphone is attached, the result is silence.

We've pushed patches to both the boundary-imx-android-r13.4-ga and boundary-L3.0.35_12.09.01_GA kernel branches on GitHub.

We also found that for the microphones we have here (commodity PC boom mics) a default value of 2 for the gain gives the best results. We pushed patches for that too.

As a final note, you might need to change this setting to match other microphones. The value of 4KOhms worked well in our testing.

Testing under Linux was done with arecord and aplay as follows:

root@linaro-alip:/tmp# arecord -vvv -d 5 -f cd t.wav Recording WAVE 't.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo Plug PCM: Hardware PCM card 0 'sgtl5000-audio' device 0 subdevice 0 Its setup is: stream : CAPTURE access : RW_INTERLEAVED format : S16_LE subformat : STD channels : 2 rate : 44100 exact rate : 44100 (44100/1) msbits : 16 buffer_size : 22052 period_size : 5513 period_time : 125011 tstamp_mode : NONE period_step : 1 avail_min : 5513 period_event : 0 start_threshold : 1 stop_threshold : 22052 silence_threshold: 0 silence_size : 0 boundary : 1445199872 appl_ptr : 0 hw_ptr : 0 Max peak (11026 samples): 0x00001580 #### 16% Max peak (11026 samples): 0x0000119f ### 13% Max peak (11026 samples): 0x000003f6 # 3% Max peak (11026 samples): 0x0000033b # 2% ... Max peak (11026 samples): 0x00001a5e ##### 20% Max peak (11026 samples): 0x000009f1 ## 7% Max peak (11026 samples): 0x000011b2 ### 13% Max peak (11026 samples): 0x00001437 #### 15% Max peak (11026 samples): 0x0000187e #### 19% Max peak (11026 samples): 0x0000101c ### 12% Max peak (11026 samples): 0x000045d1 ########### 54% Max peak (11026 samples): 0x00001e57 ##### 23% Max peak (11026 samples): 0x00002306 ###### 27% Max peak (11026 samples): 0x0000104c ### 12% Max peak (11026 samples): 0x000016b4 #### 17% Max peak (11026 samples): 0x00001697 #### 17% root@linaro-alip:/tmp# aplay -D hw:0,0 t.wav Playing WAVE 't.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo