AnsweredAssumed Answered

Audio random LOST on i.MX 6Q

Question asked by Andy Ho on Nov 6, 2016
Latest reply on Nov 14, 2016 by Andy Ho

Hi,

 

We have a customer imx6q board based on 4.4.3_GA bsp, the OS is android 4.4.3 and kernel is 3.10.53. all cofiguration is set same as imx6q-sabresdb/sdp

We found the audio will lost when play vidio ( youtube, mxplayer...) or audio ( mp3 ) for several hours.

 

The error log shown as following:

Android tinyalsaHAL:

Failure start:
W/audio_hw_primary(  155): ret -1, pcm write 768 error cannot write stream data: I/O error.
W/audio_hw_primary(  155): pcm_state(pcm) = 3.
W/audio_hw_primary(  155): PCM_STATE_RUNNING
V/audio_hw_primary(  155): write error, sleep few ms
W/audio_hw_primary(  155): ret -1, pcm write 768 error cannot prepare channel1: Device or resource busy.
W/audio_hw_primary(  155): pcm_state(pcm) = 3.
W/audio_hw_primary(  155): PCM_STATE_RUNNING
V/audio_hw_primary(  155): write error, sleep few ms
W/audio_hw_primary(  155): ret -1, pcm write 768 error cannot prepare channel1: Device or resource busy.
W/audio_hw_primary(  155): pcm_state(pcm) = 3.
W/audio_hw_primary(  155): PCM_STATE_RUNNING
(loop)

 

 

 


kernel PCM_lib xrun_debug log

<7>ALSA sound/core/pcm_lib.c:407 period_update: pcmC0D0p:0: pos=768/192/1536, hwptr=192/1023552/1023744/1022976
<7>ALSA sound/core/pcm_lib.c:407 hwptr_update: pcmC0D0p:0: pos=768/192/1536, hwptr=0/1023744/1023744/1022976
<7>ALSA sound/core/pcm_lib.c:407 hwptr_update: pcmC0D0p:0: pos=768/192/1536, hwptr=0/1023744/1023744/1022976
<7>ALSA sound/core/pcm_lib.c:407 period_update: pcmC0D0p:0: pos=960/192/1536, hwptr=192/1023744/1023936/1022976
<7>ALSA sound/core/pcm_lib.c:407 hwptr_update: pcmC0D0p:0: pos=960/192/1536, hwptr=0/1023936/1023936/1022976
<7>ALSA sound/core/pcm_lib.c:407 hwptr_update: pcmC0D0p:0: pos=960/192/1536, hwptr=0/1023936/1023936/1022976
<7>ALSA sound/core/pcm_lib.c:407 period_update: pcmC0D0p:0: pos=1152/192/1536, hwptr=192/1023936/1024128/1022976
<7>ALSA sound/core/pcm_lib.c:407 hwptr_update: pcmC0D0p:0: pos=1152/192/1536, hwptr=0/1024128/1024128/1022976
<7>ALSA sound/core/pcm_lib.c:407 hwptr_update: pcmC0D0p:0: pos=1152/192/1536, hwptr=0/1024128/1024128/1022976
<7>ALSA sound/core/pcm_lib.c:407 period_update: pcmC0D0p:0: pos=1344/192/1536, hwptr=192/1024128/1024320/1022976
<7>ALSA sound/core/pcm_lib.c:407 hwptr_update: pcmC0D0p:0: pos=1344/192/1536, hwptr=0/1024320/1024320/1022976

Failure start.........................

<7>ALSA sound/core/pcm_lib.c:407 hwptr_update: pcmC0D0p:0: pos=1344/192/1536, hwptr=0/1130304/1130304/1128960
<7>ALSA sound/core/pcm_lib.c:407 hwptr_update: pcmC0D0p:0: pos=1344/192/1536, hwptr=0/1130304/1130304/1128960
<7>ALSA sound/core/pcm_lib.c:407 hwptr_update: pcmC0D0p:0: pos=1344/192/1536, hwptr=0/1130304/1130304/1128960
<7>ALSA sound/core/pcm_lib.c:407 hwptr_update: pcmC0D0p:0: pos=1344/192/1536, hwptr=0/1130304/1130304/1128960
<7>ALSA sound/core/pcm_lib.c:407 hwptr_update: pcmC0D0p:0: pos=1344/192/1536, hwptr=0/1130304/1130304/1128960
<7>ALSA sound/core/pcm_lib.c:407 hwptr_update: pcmC0D0p:0: pos=1344/192/1536, hwptr=0/1130304/1130304/1128960
<7>ALSA sound/core/pcm_lib.c:407 hwptr_update: pcmC0D0p:0: pos=1344/192/1536, hwptr=0/1130304/1130304/1128960

 

 

 

 

 

1.You can see the android and kernel log when failure started, the app continuous playing but no sound output
2.All hardware signal can be measured ( mclk, bclk,....) , even aud bus (PCM)
3.If the error just occured, stop the playing for a while, then start play again, the sound will back, but if the error occur for a long time, you must wait the pcm write error to stop then start play, or reboot.

4. From the kernel pcm error xrun_debug log, you can see no "period_update" when error occur (bold mark), the "hwptr_update" will never changed
5. I found the issue is simular to https://community.nxp.com/thread/304919 , but we have no "DMA or IRQ trouble" ( or I didn't enable DMA debug), and the asrc is not used

 

I think the issue may caused by imx dma implementation, but don't know how to debug and solve, hope I can get support here, thanks.

Outcomes