AnsweredAssumed Answered

[Android 4.4.2] [Linux 3.0.35] SGTL5000 sound delay problem

Question asked by Aebischer Quentin on Sep 12, 2017

Hello everyone,


We are using android 4.4.2 and kernel 3.0.35 from NXP.


When I firts try to play sound on internal speakers (SGTL5000), there is a small delay before the sound is actually played which is shown in the logcat :


    W/AudioFlinger( 2484): write blocked for 343 msecs, 2 delayed writes, thread 0x40dcb008


I added some logs and tracked down the issue ; it seems that this delay is triggered by a call to dmaengine_submit(iprtd->desc), in the function static int snd_imx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) with cmd = SNDRV_PCM_TRIGGER_START (file sound/soc/imx/imx-pcm-dma-mx2.c)


I tried to play the sound in android 4.4.3 using kernel 3.10.53 from NXP, and there is no delay.


The overall implementation seems very different though, and the SNDRV_PCM_TRIGGER_START trigger command is handled by fsl_ssi_trigger(...) function in fsl_ssi.c


I have no experience in sound or dma drivers, so it's kinda hard for me to know exactly what's happening beyond that point.


For now we would like to keep android 4.4.2 since we have a lot of tweaks and a stable product, so I have 2 questions then:


- Is there a patch for this delay in a kernel similar to 3.0.35 (with no big dma api change) ? I tried searching but couldn't find anything.


- If not, how hard would it be to make a patch for 3.0.35 kernel or port the implementation from 3.10.53 into 3.0.35 kernel.


Thanks a lot for reading me,