From 5098d82c999b4c53106a163178b67db0809ef48c Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 29 Jun 2011 09:49:04 -0700 Subject: [PATCH] --- yaml --- r: 257563 b: refs/heads/master c: 57cc2432e172b191db488ec8ad430b283807af0a h: refs/heads/master i: 257561: 22270d3ca3fc6e5f7f7847af370b266fe5c3613e 257559: 4f4365060198c58e8cc26af379fdea2451ca5556 v: v3 --- [refs] | 2 +- trunk/sound/soc/blackfin/bf5xx-i2s-pcm.c | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 18812ac9193e..71cebb53b9bd 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4e8e78e37c615e7904f51e62b5a06cb8fa3b3b53 +refs/heads/master: 57cc2432e172b191db488ec8ad430b283807af0a diff --git a/trunk/sound/soc/blackfin/bf5xx-i2s-pcm.c b/trunk/sound/soc/blackfin/bf5xx-i2s-pcm.c index 4a805a859723..61ddf942fd4d 100644 --- a/trunk/sound/soc/blackfin/bf5xx-i2s-pcm.c +++ b/trunk/sound/soc/blackfin/bf5xx-i2s-pcm.c @@ -138,11 +138,20 @@ static snd_pcm_uframes_t bf5xx_pcm_pointer(struct snd_pcm_substream *substream) pr_debug("%s enter\n", __func__); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { diff = sport_curr_offset_tx(sport); - frames = bytes_to_frames(substream->runtime, diff); } else { diff = sport_curr_offset_rx(sport); - frames = bytes_to_frames(substream->runtime, diff); } + + /* + * TX at least can report one frame beyond the end of the + * buffer if we hit the wraparound case - clamp to within the + * buffer as the ALSA APIs require. + */ + if (diff == snd_pcm_lib_buffer_bytes(substream)) + diff = 0; + + frames = bytes_to_frames(substream->runtime, diff); + return frames; }