AnsweredAssumed Answered

IMX6q-SabreAuto board playback works fine but capture doesn't work for mono or stereo channels

Question asked by Nilesh Tekale on Aug 4, 2017
Latest reply on Aug 16, 2017 by igorpadykov

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.

Outcomes