aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/omap/omap-pcm.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/omap/omap-pcm.c')
-rw-r--r--sound/soc/omap/omap-pcm.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
index 825db385f01f..1e521904ea64 100644
--- a/sound/soc/omap/omap-pcm.c
+++ b/sound/soc/omap/omap-pcm.c
@@ -23,6 +23,7 @@
23 */ 23 */
24 24
25#include <linux/dma-mapping.h> 25#include <linux/dma-mapping.h>
26#include <linux/slab.h>
26#include <sound/core.h> 27#include <sound/core.h>
27#include <sound/pcm.h> 28#include <sound/pcm.h>
28#include <sound/pcm_params.h> 29#include <sound/pcm_params.h>
@@ -60,12 +61,11 @@ static void omap_pcm_dma_irq(int ch, u16 stat, void *data)
60 struct omap_runtime_data *prtd = runtime->private_data; 61 struct omap_runtime_data *prtd = runtime->private_data;
61 unsigned long flags; 62 unsigned long flags;
62 63
63 if ((cpu_is_omap1510()) && 64 if ((cpu_is_omap1510())) {
64 (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)) {
65 /* 65 /*
66 * OMAP1510 doesn't fully support DMA progress counter 66 * OMAP1510 doesn't fully support DMA progress counter
67 * and there is no software emulation implemented yet, 67 * and there is no software emulation implemented yet,
68 * so have to maintain our own playback progress counter 68 * so have to maintain our own progress counters
69 * that can be used by omap_pcm_pointer() instead. 69 * that can be used by omap_pcm_pointer() instead.
70 */ 70 */
71 spin_lock_irqsave(&prtd->lock, flags); 71 spin_lock_irqsave(&prtd->lock, flags);
@@ -100,9 +100,11 @@ static int omap_pcm_hw_params(struct snd_pcm_substream *substream,
100 struct snd_pcm_runtime *runtime = substream->runtime; 100 struct snd_pcm_runtime *runtime = substream->runtime;
101 struct snd_soc_pcm_runtime *rtd = substream->private_data; 101 struct snd_soc_pcm_runtime *rtd = substream->private_data;
102 struct omap_runtime_data *prtd = runtime->private_data; 102 struct omap_runtime_data *prtd = runtime->private_data;
103 struct omap_pcm_dma_data *dma_data = rtd->dai->cpu_dai->dma_data; 103 struct omap_pcm_dma_data *dma_data;
104 int err = 0; 104 int err = 0;
105 105
106 dma_data = snd_soc_dai_get_dma_data(rtd->dai->cpu_dai, substream);
107
106 /* return if this is a bufferless transfer e.g. 108 /* return if this is a bufferless transfer e.g.
107 * codec <--> BT codec or GSM modem -- lg FIXME */ 109 * codec <--> BT codec or GSM modem -- lg FIXME */
108 if (!dma_data) 110 if (!dma_data)
@@ -189,8 +191,7 @@ static int omap_pcm_prepare(struct snd_pcm_substream *substream)
189 dma_params.frame_count = runtime->periods; 191 dma_params.frame_count = runtime->periods;
190 omap_set_dma_params(prtd->dma_ch, &dma_params); 192 omap_set_dma_params(prtd->dma_ch, &dma_params);
191 193
192 if ((cpu_is_omap1510()) && 194 if ((cpu_is_omap1510()))
193 (substream->stream == SNDRV_PCM_STREAM_PLAYBACK))
194 omap_enable_dma_irq(prtd->dma_ch, OMAP_DMA_FRAME_IRQ | 195 omap_enable_dma_irq(prtd->dma_ch, OMAP_DMA_FRAME_IRQ |
195 OMAP_DMA_LAST_IRQ | OMAP_DMA_BLOCK_IRQ); 196 OMAP_DMA_LAST_IRQ | OMAP_DMA_BLOCK_IRQ);
196 else 197 else
@@ -248,14 +249,15 @@ static snd_pcm_uframes_t omap_pcm_pointer(struct snd_pcm_substream *substream)
248 dma_addr_t ptr; 249 dma_addr_t ptr;
249 snd_pcm_uframes_t offset; 250 snd_pcm_uframes_t offset;
250 251
251 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { 252 if (cpu_is_omap1510()) {
253 offset = prtd->period_index * runtime->period_size;
254 } else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
252 ptr = omap_get_dma_dst_pos(prtd->dma_ch); 255 ptr = omap_get_dma_dst_pos(prtd->dma_ch);
253 offset = bytes_to_frames(runtime, ptr - runtime->dma_addr); 256 offset = bytes_to_frames(runtime, ptr - runtime->dma_addr);
254 } else if (!(cpu_is_omap1510())) { 257 } else {
255 ptr = omap_get_dma_src_pos(prtd->dma_ch); 258 ptr = omap_get_dma_src_pos(prtd->dma_ch);
256 offset = bytes_to_frames(runtime, ptr - runtime->dma_addr); 259 offset = bytes_to_frames(runtime, ptr - runtime->dma_addr);
257 } else 260 }
258 offset = prtd->period_index * runtime->period_size;
259 261
260 if (offset >= runtime->buffer_size) 262 if (offset >= runtime->buffer_size)
261 offset = 0; 263 offset = 0;