MLK-14582: ASoC: imx-pcm-rpmsg: fix audio noise issue with pulseaudio
authorShengjiu Wang <shengjiu.wang@freescale.com>
Thu, 30 Mar 2017 12:14:18 +0000 (20:14 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:21:58 +0000 (15:21 -0500)
The pulse audio will set a wrong buffer size which is not the integral
multiple of period size, it will cause the DMA can't work correctly in
M4 side.
The reason is that we always need to add a constraint for
SNDRV_PCM_HW_PARAM_PERIODS, which make it integer.

Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
(cherry picked from commit 54a10a6c2130a69aca4c1923dac3a15137911146)

sound/soc/fsl/imx-pcm-rpmsg.c

index 71ef769..e7d7244 100644 (file)
@@ -140,6 +140,11 @@ static int imx_rpmsg_pcm_open(struct snd_pcm_substream *substream)
 
        substream->runtime->private_data = prtd;
 
+       ret = snd_pcm_hw_constraint_integer(substream->runtime,
+                                           SNDRV_PCM_HW_PARAM_PERIODS);
+       if (ret < 0)
+               return ret;
+
        return ret;
 }