<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic [Android 4.4.2] [Linux 3.0.35] SGTL5000 sound delay problem in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/Android-4-4-2-Linux-3-0-35-SGTL5000-sound-delay-problem/m-p/701076#M108899</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We are using android 4.4.2 and kernel 3.0.35 from NXP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;W/AudioFlinger( 2484): write blocked for 343 msecs, 2 delayed writes, thread 0x40dcb008&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I added some logs and tracked down the issue ; it seems that this delay is triggered by a call to dmaengine_submit(iprtd-&amp;gt;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)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried to play the sound in android 4.4.3 using kernel 3.10.53 from NXP, and there is no delay.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- 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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- 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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks a lot for reading me,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Quentin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 12 Sep 2017 15:37:59 GMT</pubDate>
    <dc:creator>aebischerquenti</dc:creator>
    <dc:date>2017-09-12T15:37:59Z</dc:date>
    <item>
      <title>[Android 4.4.2] [Linux 3.0.35] SGTL5000 sound delay problem</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Android-4-4-2-Linux-3-0-35-SGTL5000-sound-delay-problem/m-p/701076#M108899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We are using android 4.4.2 and kernel 3.0.35 from NXP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;W/AudioFlinger( 2484): write blocked for 343 msecs, 2 delayed writes, thread 0x40dcb008&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I added some logs and tracked down the issue ; it seems that this delay is triggered by a call to dmaengine_submit(iprtd-&amp;gt;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)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried to play the sound in android 4.4.3 using kernel 3.10.53 from NXP, and there is no delay.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- 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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- 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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks a lot for reading me,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Quentin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Sep 2017 15:37:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Android-4-4-2-Linux-3-0-35-SGTL5000-sound-delay-problem/m-p/701076#M108899</guid>
      <dc:creator>aebischerquenti</dc:creator>
      <dc:date>2017-09-12T15:37:59Z</dc:date>
    </item>
  </channel>
</rss>

