diff options
Diffstat (limited to 'sound/soc/blackfin/bf5xx-i2s-pcm.c')
-rw-r--r-- | sound/soc/blackfin/bf5xx-i2s-pcm.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/sound/soc/blackfin/bf5xx-i2s-pcm.c b/sound/soc/blackfin/bf5xx-i2s-pcm.c index b5101efd1c87..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) | |||
138 | pr_debug("%s enter\n", __func__); | 138 | pr_debug("%s enter\n", __func__); |
139 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | 139 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
140 | diff = sport_curr_offset_tx(sport); | 140 | diff = sport_curr_offset_tx(sport); |
141 | frames = bytes_to_frames(substream->runtime, diff); | ||
142 | } else { | 141 | } else { |
143 | diff = sport_curr_offset_rx(sport); | 142 | diff = sport_curr_offset_rx(sport); |
144 | frames = bytes_to_frames(substream->runtime, diff); | ||
145 | } | 143 | } |
144 | |||
145 | /* | ||
146 | * TX at least can report one frame beyond the end of the | ||
147 | * buffer if we hit the wraparound case - clamp to within the | ||
148 | * buffer as the ALSA APIs require. | ||
149 | */ | ||
150 | if (diff == snd_pcm_lib_buffer_bytes(substream)) | ||
151 | diff = 0; | ||
152 | |||
153 | frames = bytes_to_frames(substream->runtime, diff); | ||
154 | |||
146 | return frames; | 155 | return frames; |
147 | } | 156 | } |
148 | 157 | ||
@@ -159,7 +168,7 @@ static int bf5xx_pcm_open(struct snd_pcm_substream *substream) | |||
159 | 168 | ||
160 | snd_soc_set_runtime_hwparams(substream, &bf5xx_pcm_hardware); | 169 | snd_soc_set_runtime_hwparams(substream, &bf5xx_pcm_hardware); |
161 | 170 | ||
162 | ret = snd_pcm_hw_constraint_integer(runtime, \ | 171 | ret = snd_pcm_hw_constraint_integer(runtime, |
163 | SNDRV_PCM_HW_PARAM_PERIODS); | 172 | SNDRV_PCM_HW_PARAM_PERIODS); |
164 | if (ret < 0) | 173 | if (ret < 0) |
165 | goto out; | 174 | goto out; |
@@ -248,9 +257,11 @@ static void bf5xx_pcm_free_dma_buffers(struct snd_pcm *pcm) | |||
248 | 257 | ||
249 | static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32); | 258 | static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32); |
250 | 259 | ||
251 | int bf5xx_pcm_i2s_new(struct snd_card *card, struct snd_soc_dai *dai, | 260 | int bf5xx_pcm_i2s_new(struct snd_soc_pcm_runtime *rtd) |
252 | struct snd_pcm *pcm) | ||
253 | { | 261 | { |
262 | struct snd_card *card = rtd->card->snd_card; | ||
263 | struct snd_soc_dai *dai = rtd->cpu_dai; | ||
264 | struct snd_pcm *pcm = rtd->pcm; | ||
254 | int ret = 0; | 265 | int ret = 0; |
255 | 266 | ||
256 | pr_debug("%s enter\n", __func__); | 267 | pr_debug("%s enter\n", __func__); |
@@ -295,8 +306,8 @@ static int __devexit bfin_i2s_soc_platform_remove(struct platform_device *pdev) | |||
295 | 306 | ||
296 | static struct platform_driver bfin_i2s_pcm_driver = { | 307 | static struct platform_driver bfin_i2s_pcm_driver = { |
297 | .driver = { | 308 | .driver = { |
298 | .name = "bfin-i2s-pcm-audio", | 309 | .name = "bfin-i2s-pcm-audio", |
299 | .owner = THIS_MODULE, | 310 | .owner = THIS_MODULE, |
300 | }, | 311 | }, |
301 | 312 | ||
302 | .probe = bfin_i2s_soc_platform_probe, | 313 | .probe = bfin_i2s_soc_platform_probe, |