ASoC: blackfin: use samples to set silence
authorScott Jiang <scott.jiang.linux@gmail.com>
Fri, 18 Jul 2014 08:14:57 +0000 (16:14 +0800)
committerJiri Slaby <jslaby@suse.cz>
Wed, 17 Sep 2014 14:55:08 +0000 (16:55 +0200)
commit 30443408fd7201fd1911b09daccf92fae3cc700d upstream.

The third parameter for snd_pcm_format_set_silence needs the number
of samples instead of sample bytes.

Signed-off-by: Scott Jiang <scott.jiang.linux@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
sound/soc/blackfin/bf5xx-i2s-pcm.c

index 9cb4a80df98eee2efa78b9b3a05a99baf64cc8b1..bc9983d38ff3a6e0046a3c7cbbcb695880a8aa3f 100644 (file)
@@ -293,19 +293,19 @@ static int bf5xx_pcm_silence(struct snd_pcm_substream *substream,
        unsigned int sample_size = runtime->sample_bits / 8;
        void *buf = runtime->dma_area;
        struct bf5xx_i2s_pcm_data *dma_data;
-       unsigned int offset, size;
+       unsigned int offset, samples;
 
        dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
 
        if (dma_data->tdm_mode) {
                offset = pos * 8 * sample_size;
-               size = count * 8 * sample_size;
+               samples = count * 8;
        } else {
                offset = frames_to_bytes(runtime, pos);
-               size = frames_to_bytes(runtime, count);
+               samples = count * runtime->channels;
        }
 
-       snd_pcm_format_set_silence(runtime->format, buf + offset, size);
+       snd_pcm_format_set_silence(runtime->format, buf + offset, samples);
 
        return 0;
 }