ASoC: SOF: imx: Add SNDRV_PCM_INFO_BATCH flag
authorShengjiu Wang <shengjiu.wang@nxp.com>
Wed, 27 Dec 2023 09:27:43 +0000 (17:27 +0800)
committerMark Brown <broonie@kernel.org>
Fri, 29 Dec 2023 02:09:02 +0000 (02:09 +0000)
The sof imx pcm device is a device which should support
double buffering.

Found this issue with pipewire. When there is no
SNDRV_PCM_INFO_BATCH flag in driver, the pipewire will
set headroom to be zero, and because sof pcm device
don't support residue report, when the latency setting
is small, the "delay" always larger than "target" in
alsa-pcm.c, that reading next period data is not
scheduled on time.

With SNDRV_PCM_INFO_BATCH flag in driver, the pipewire
will select a smaller period size for device, then
the task of reading next period data will be scheduled
on time.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1703669263-13832-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/imx/imx8.c
sound/soc/sof/imx/imx8m.c
sound/soc/sof/imx/imx8ulp.c

index 170740bce8393650f9abf10accc7fdf6854ef607..d777e70250efc006739e1edbf20a4f5fd344ee88 100644 (file)
@@ -603,6 +603,7 @@ static struct snd_sof_dsp_ops sof_imx8x_ops = {
                        SNDRV_PCM_INFO_MMAP_VALID |
                        SNDRV_PCM_INFO_INTERLEAVED |
                        SNDRV_PCM_INFO_PAUSE |
+                       SNDRV_PCM_INFO_BATCH |
                        SNDRV_PCM_INFO_NO_PERIOD_WAKEUP
 };
 
index f088fd1a672bd62d054dfea17806a57bb9fe6e12..1b976fa500aa2725aca8373117e340c5354adec4 100644 (file)
@@ -472,6 +472,7 @@ static struct snd_sof_dsp_ops sof_imx8m_ops = {
                SNDRV_PCM_INFO_MMAP_VALID |
                SNDRV_PCM_INFO_INTERLEAVED |
                SNDRV_PCM_INFO_PAUSE |
+               SNDRV_PCM_INFO_BATCH |
                SNDRV_PCM_INFO_NO_PERIOD_WAKEUP,
 };
 
index ca6edb85ff714ecdd5bf8fe9e653c4f222f51893..2badca75782b28aa4fb0ead18a03b22c233cc96c 100644 (file)
@@ -463,6 +463,7 @@ static struct snd_sof_dsp_ops sof_imx8ulp_ops = {
                        SNDRV_PCM_INFO_MMAP_VALID |
                        SNDRV_PCM_INFO_INTERLEAVED |
                        SNDRV_PCM_INFO_PAUSE |
+                       SNDRV_PCM_INFO_BATCH |
                        SNDRV_PCM_INFO_NO_PERIOD_WAKEUP,
 
        /* PM */