summaryrefslogtreecommitdiffstats
path: root/sound/soc/blackfin/bf5xx-i2s-pcm.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-07-09 11:56:43 +0200
committerTakashi Iwai <tiwai@suse.de>2011-07-09 11:56:43 +0200
commite8fd86efaa09445ca1afc1aea08d4666c966ed03 (patch)
treee6b42da2811b9ca49529195a3a66f7f2ddebe2f3 /sound/soc/blackfin/bf5xx-i2s-pcm.c
parentALSA: hda - Fix a copmile warning (diff)
parentMerge branch 'for-3.0' of git://git.kernel.org/pub/scm/linux/kernel/git/broon... (diff)
downloadlinux-e8fd86efaa09445ca1afc1aea08d4666c966ed03.tar.xz
linux-e8fd86efaa09445ca1afc1aea08d4666c966ed03.zip
Merge branch 'fix/asoc' into for-linus
Diffstat (limited to 'sound/soc/blackfin/bf5xx-i2s-pcm.c')
-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 b5101efd1c87..f1fd95bb6416 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;
}