MLK-9731 ASoC: imx-hdmi-dma: audio output is noisy in long time playback
authorShengjiu Wang <shengjiu.wang@freescale.com>
Fri, 31 Oct 2014 05:51:20 +0000 (13:51 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:48:32 +0000 (14:48 -0500)
In the frame_to_bytes(), when hw_ptr*frame_bits exceed the maxmum of unsigned
long, the return value is saturated, so the appl_bytes is wrong.
This patch is to correct the usage of frame_to_bytes().

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

sound/soc/fsl/imx-hdmi-dma.c

index 8eeb009..0df6851 100644 (file)
@@ -455,7 +455,7 @@ static void hdmi_dma_data_copy(struct snd_pcm_substream *substream,
        if (runtime->access != SNDRV_PCM_ACCESS_MMAP_INTERLEAVED)
                return;
 
-       appl_bytes = frames_to_bytes(runtime, runtime->status->hw_ptr);
+       appl_bytes =  runtime->status->hw_ptr * (runtime->frame_bits / 8);
        if (type == 'p')
                appl_bytes += 2 * priv->period_bytes;
        offset = appl_bytes % priv->buffer_bytes;