IMX6q-SabreAuto board playback works fine but for mono or stereo channels it gives silent audio file.
This board has cs42888 as an audio codec. The playback works fine with the existing driver, but capture with channels count 6 is working and not with channels count 2.
I am capturing audio with arecord with following command for 6 channels count:
arecord --device=plughw:0,1 -f dat -c6 foo.wav
and for 2 channels count :
arecord --device=plughw:0,1 -f dat -c2 foo.wav
I tried a standalone c application also but that works fine with 6 channels count and for 2 channels count it gives a silent audio file. [ If we check 6 channels captured file in audacity it shows data on 2nd and 5th channel only.]
Also dumped captured data from alsa in file pcm_lib.c at snd_pcm_lib_read() and it is same as the output file.
As per the schematics mic in is connected to AIN3 of the audio codec input pin and I have verified the waveforms at this pin[ pin number 50 i.e. AIN3p of codec].
Also verified waveforms at ADC_SCLK and ADC_LRCK pins when capturing for 2 channels and for 6 channels.
In Alsamixer capture (i.e ADC1 and ADC2 ) is not muted.
Amixer gives output as :
root@imx6qsabreauto:~# amixer
Simple mixer control 'ADC High-Pass Filter',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [on]
Simple mixer control 'ADC Soft Ramp & Zero Cross Control',0
Capabilities: enum
Items: 'Immediate Change' 'Zero Cross' 'Soft Ramp' 'Soft Ramp on Zero Cross'
Item0: 'Immediate Change'
Simple mixer control 'ADC2',0
Capabilities: cvolume
Capture channels: Front Left - Front Right
Limits: Capture 0 - 176
Front Left: Capture 128 [73%] [0.00dB]
Front Right: Capture 128 [73%] [0.00dB]
Simple mixer control 'ADC2 Invert',0
Capabilities: pswitch
Playback channels: Front Left - Front Right
Mono:
Front Left: Playback [off]
Front Right: Playback [off]
Simple mixer control 'ADC2 Single Ended Mode',0
Capabilities: enum
Items: 'Differential' 'Single-Ended'
Item0: 'Differential'
Simple mixer control 'DAC Auto Mute',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [on]
Simple mixer control 'DAC De-emphasis',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
Simple mixer control 'DAC Soft Ramp & Zero Cross Control',0
Capabilities: enum
Items: 'Immediate Change' 'Zero Cross' 'Soft Ramp' 'Soft Ramp on Zero Cross'
Item0: 'Immediate Change'
Simple mixer control 'DAC1',0
Capabilities: pvolume
Playback channels: Front Left - Front Right
Limits: Playback 0 - 255
Mono:
Front Left: Playback 255 [100%] [0.00dB]
Front Right: Playback 255 [100%] [0.00dB]
Simple mixer control 'DAC1 Invert',0
Capabilities: pswitch
Playback channels: Front Left - Front Right
Mono:
Front Left: Playback [off]
Front Right: Playback [off]
Simple mixer control 'DAC2',0
Capabilities: pvolume
Playback channels: Front Left - Front Right
Limits: Playback 0 - 255
Mono:
Front Left: Playback 255 [100%] [0.00dB]
Front Right: Playback 255 [100%] [0.00dB]
Simple mixer control 'DAC2 Invert',0
Capabilities: pswitch
Playback channels: Front Left - Front Right
Mono:
Front Left: Playback [off]
Front Right: Playback [off]
Simple mixer control 'DAC3',0
Capabilities: pvolume
Playback channels: Front Left - Front Right
Limits: Playback 0 - 255
Mono:
Front Left: Playback 255 [100%] [0.00dB]
Front Right: Playback 255 [100%] [0.00dB]
Simple mixer control 'DAC3 Invert',0
Capabilities: pswitch
Playback channels: Front Left - Front Right
Mono:
Front Left: Playback [off]
Front Right: Playback [off]
Simple mixer control 'DAC4',0
Capabilities: pvolume
Playback channels: Front Left - Front Right
Limits: Playback 0 - 255
Mono:
Front Left: Playback 255 [100%] [0.00dB]
Front Right: Playback 255 [100%] [0.00dB]
Simple mixer control 'DAC4 Invert',0
Capabilities: pswitch
Playback channels: Front Left - Front Right
Mono:
Front Left: Playback [off]
Front Right: Playback [off]
Simple mixer control 'Mute ADC Serial Port',0
Capabilities: pswitch pswitch-joined
Playback channels: Mono
Mono: Playback [off]
root@imx6qsabreauto:~#
my /etc/asound.conf file contains:
defaults.pcm.rate_converter "linear"
pcm.dmix_48000{
type dmix
ipc_key 5678293
ipc_key_add_uid yes
slave{
pcm "hw:0,0"
period_time 40000
buffer_time 320000
format S16_LE
rate 48000
}
}
pcm.dmix_44100{
type dmix
ipc_key 5678293
ipc_key_add_uid yes
slave{
pcm "hw:0,0"
period_time 40000
buffer_time 360000
format S16_LE
rate 44100
}
}
pcm.dmix_32000{
type dmix
ipc_key 5678293
ipc_key_add_uid yes
slave{
pcm "hw:0,0"
period_time 40000
buffer_time 360000
format S16_LE
rate 32000
}
}
pcm.dmix_24000{
type dmix
ipc_key 5678293
ipc_key_add_uid yes
slave{
pcm "hw:0,0"
period_time 40000
buffer_time 360000
format S16_LE
rate 24000
}
}
pcm.dmix_22050{
type dmix
ipc_key 5678293
ipc_key_add_uid yes
slave{
pcm "hw:0,0"
period_time 40000
buffer_time 360000
format S16_LE
rate 22050
}
}
pcm.dmix_16000{
type dmix
ipc_key 5678293
ipc_key_add_uid yes
slave{
pcm "hw:0,0"
period_time 40000
buffer_time 360000
format S16_LE
rate 16000
}
}
pcm.dmix_12000{
type dmix
ipc_key 5678293
ipc_key_add_uid yes
slave{
pcm "hw:0,0"
period_time 40000
buffer_time 240000
format S16_LE
rate 12000
}
}
pcm.dmix_11025{
type dmix
ipc_key 5678293
ipc_key_add_uid yes
slave{
pcm "hw:0,0"
period_time 40000
buffer_time 240000
format S16_LE
rate 11025
}
}
pcm.dmix_8000{
type dmix
ipc_key 5678293
ipc_key_add_uid yes
slave{
pcm "hw:0,0"
period_time 40000
buffer_time 360000
format S16_LE
rate 8000
}
}
pcm.!dsnoop_48000{
type dsnoop
ipc_key 5778293
ipc_key_add_uid yes
slave{
pcm "hw:0,0"
period_time 40000
buffer_time 320000
format S16_LE
rate 48000
}
}
pcm.!dsnoop_44100{
type dsnoop
ipc_key 5778293
ipc_key_add_uid yes
slave{
pcm "hw:0,0"
period_time 40000
buffer_time 360000
format S16_LE
rate 44100
}
}
pcm.!dsnoop_32000{
type dsnoop
ipc_key 5778293
ipc_key_add_uid yes
slave{
pcm "hw:0,0"
period_time 40000
buffer_time 360000
format S16_LE
rate 32000
}
}
pcm.!dsnoop_24000{
type dsnoop
ipc_key 5778293
ipc_key_add_uid yes
slave{
pcm "hw:0,0"
period_time 40000
buffer_time 360000
format S16_LE
rate 24000
}
}
pcm.!dsnoop_22050{
type dsnoop
ipc_key 5778293
ipc_key_add_uid yes
slave{
pcm "hw:0,0"
period_time 40000
buffer_time 360000
format S16_LE
rate 22050
}
}
pcm.!dsnoop_16000{
type dsnoop
ipc_key 5778293
ipc_key_add_uid yes
slave{
pcm "hw:0,0"
period_time 40000
buffer_time 360000
format S16_LE
rate 16000
}
}
pcm.!dsnoop_12000{
type dsnoop
ipc_key 5778293
ipc_key_add_uid yes
slave{
pcm "hw:0,0"
period_time 40000
buffer_time 240000
format S16_LE
rate 12000
}
}
pcm.!dsnoop_11025{
type dsnoop
ipc_key 5778293
ipc_key_add_uid yes
slave{
pcm "hw:0,0"
period_time 40000
buffer_time 240000
format S16_LE
rate 11025
}
}
pcm.!dsnoop_8000{
type dsnoop
ipc_key 5778293
ipc_key_add_uid yes
slave{
pcm "hw:0,0"
period_time 40000
buffer_time 360000
format S16_LE
rate 8000
}
}
pcm.asymed{
type asym
playback.pcm "dmix_44100"
capture.pcm "dsnoop_44100"
}
pcm.dsp0{
type plug
slave.pcm "asymed"
}
pcm.!default{
type plug
route_policy "average"
slave.pcm "asymed"
}
ctl.!default{
type hw
card 0
}
ctl.mixer0{
type hw
card 0
}
There is no ~/.asoundrc file exist.
I also tried channels downmixing in /etc/asound.conf but that didn't help.
Any suggestions how can I make it work for 2 channels count ?
Thanks in advance.
Nilesh Tekale.
Hi Igor,
I am also part of this project.
I am yet to explore your last answer related to "audio routing" dts entry. I will do that and let you know.
Now I have question related to sampling rate. It is mentioned in IMX Linux reference manual that codec CS42888 supports 48 KHz, 96 KHz, 192 KHz. For our application we require sampling rate of 24KHz, 32KHz. Does the codec support this ? If not does the codec support SRC(Sampling Rate Converter) or iMX6 platform support SRC ?
Hi Ajay
I am afraid SRC and rates not mentioned in Linux Manual
are not supported.
Best regards
igor
Hi Igor,
Can you please suggest, which codec and platform will support above mentioned requirements.
Hi Ajay
Linux Manual describes supported features for all platforms.
If not mentioned, then it is not supported and one will have to add such support himself.
Best regards
igor
Hi Nilesh
please refer to sect.7.1.5 Unit Test attached Linux Manual
and unit tests:
imx-test (folder /mxc_sound_test)
www.nxp.com/lgfiles/NMG/MAD/YOCTO/imx-test-5.7.tar.gz
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi igor,
Thanks for replay.
As per the Linux manual the amixer controls are explained for WM8960 codec and mine is cs42888 codec so as per my amixer controls ADC1 and ADC2 are ON. Also its mentioned in Linux manual that Line IN is connected to AIN1, 2 and Mic IN is connected to AIN3, 4 hence by default capturing for 2 channels will capture Line In whereas capturing 4 channels will capture Mic IN.
I can record the sound by capturing 4 channels but my query is can I capture Mic IN by capturing 2 channels via arecord. Because my end application expects the data to be captured with either mono or stereo channels.
Thanks and best regards,
Nilesh
Hi Nilesh
one can try to reassign default 2 channels to AIN3, 4 (Mic IN)
Best regards
igor
Hi igor,
I would love to know how to do that (sorry I'm new in ALSA). Thanks again for your reply.
Thanks,
Nilesh.
one can try "audio-routing" dts entry as in example in
linux/Documentation/devicetree/bindings/sound/imx-audio-wm8962.txt - Elixir - Free Electrons
http://events.linuxfoundation.org/sites/events/files/slides/belloni-alsa-asoc_0.pdf
Best regards
igor