Skip to content

Commit

Permalink
ASoC: blackfin: use samples to set silence
Browse files Browse the repository at this point in the history
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>
Cc: stable@vger.kernel.org
  • Loading branch information
Scott Jiang authored and Mark Brown committed Jul 17, 2014
1 parent 7171511 commit 3044340
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sound/soc/blackfin/bf5xx-i2s-pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,19 +290,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;
}
Expand Down

0 comments on commit 3044340

Please sign in to comment.