Real Time Audio and DragonBoard 410c


#1

Hi,

I am trying to achieve the lowest latency possible using the Microphones and audio output from the built-in PMIC on the Dragon Board. However, I have run into a wall trying to do this. I tried using Jackd and it errors out saying that it cannot set the buffer size. I also used PortAudio and it would silently fail for the same reason as not being able to set the buffer size. Given that I2S is supposed to have one of the lowest latencies, I am not able to set the period size below 2048 and buffer size of 4096 which is a latency of 85.3333 ms using the latency.c test code. It seems like the period_min and period_max has been hardcoded in Alsa driver for the PMIC to be 2048.

But here is the kicker when I use alsaloop code that is part of the alsa utils, I am able to set the period at 48 and buffer size of 96 giving us a latency of 2 ms.

Has anyone played around with this and figured out a way to use Jackd and/or PortAudio with a latency of less than 10 ms on the DragonBoard 410c or if anyone has an insight in this problem?

Thanks!


#2

Hi,
Its true that the periods and period size are hard coded in the lpass pcm driver (…/sound/soc/qcom/lpass-platform.c). Am not sure why we ended up with this intial values, but period size should be flexible enough to start from 2 bytes. We never changed it because it did work for desktop usecase.
Can you try this patch, and let me know if it works for you.
thanks,
srini

commit 384934ad36a350109bbec19348bc4fa51a2da674 (HEAD)
Author: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Date:   Wed Jun 20 12:18:01 2018 +0100

    ASoC: lpass: adjust pcm period size to allow low latency
    
    Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index 31fe78aa207f..9790f5a53713 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -32,7 +32,7 @@ struct lpass_pcm_data {
 };
 
 #define LPASS_PLATFORM_BUFFER_SIZE     (16 * 1024)
-#define LPASS_PLATFORM_PERIODS         2
+#define LPASS_PLATFORM_PERIODS         8192
 
 static const struct snd_pcm_hardware lpass_platform_pcm_hardware = {
        .info                   =       SNDRV_PCM_INFO_MMAP |
@@ -49,11 +49,9 @@ static const struct snd_pcm_hardware lpass_platform_pcm_hardware = {
        .channels_min           =       1,
        .channels_max           =       8,
        .buffer_bytes_max       =       LPASS_PLATFORM_BUFFER_SIZE,
-       .period_bytes_max       =       LPASS_PLATFORM_BUFFER_SIZE /
-                                               LPASS_PLATFORM_PERIODS,
-       .period_bytes_min       =       LPASS_PLATFORM_BUFFER_SIZE /
-                                               LPASS_PLATFORM_PERIODS,
-       .periods_min            =       LPASS_PLATFORM_PERIODS,
+       .period_bytes_max       =       4096,
+       .period_bytes_min       =       2,
+       .periods_min            =       2,
        .periods_max            =       LPASS_PLATFORM_PERIODS,
        .fifo_size              =       0,
 };

#3

copy of patch here: https://paste.ubuntu.com/p/2cGMDR4BfZ/


#5

Thanks that solved the problem.