aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorMark Brown2011-06-29 09:49:04 -0700
committerMark Brown2011-06-29 09:49:04 -0700
commit57cc2432e172b191db488ec8ad430b283807af0a (patch)
tree09e673d9fbf593455ebf7048407aed4326f65bb7 /sound
parent4e8e78e37c615e7904f51e62b5a06cb8fa3b3b53 (diff)
parente999dc50404d401150a5429b6459473a691fd1a0 (diff)
Merge branch 'for-3.0' into for-3.1
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/blackfin/bf5xx-i2s-pcm.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sound/soc/blackfin/bf5xx-i2s-pcm.c b/sound/soc/blackfin/bf5xx-i2s-pcm.c
index 4a805a859723..61ddf942fd4d 100644
--- a/sound/soc/blackfin/bf5xx-i2s-pcm.c
+++ b/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;
}