aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-s3c2410/include/mach/dma.h7
-rw-r--r--arch/arm/mach-s3c6400/include/mach/dma.h5
-rw-r--r--sound/soc/s3c24xx/s3c24xx-pcm.c17
3 files changed, 27 insertions, 2 deletions
diff --git a/arch/arm/mach-s3c2410/include/mach/dma.h b/arch/arm/mach-s3c2410/include/mach/dma.h
index c3a2629e0de..92e2687009e 100644
--- a/arch/arm/mach-s3c2410/include/mach/dma.h
+++ b/arch/arm/mach-s3c2410/include/mach/dma.h
@@ -110,6 +110,8 @@ enum s3c2410_dma_loadst {
110 * waiting for reloads */ 110 * waiting for reloads */
111#define S3C2410_DMAF_AUTOSTART (1<<1) /* auto-start if buffer queued */ 111#define S3C2410_DMAF_AUTOSTART (1<<1) /* auto-start if buffer queued */
112 112
113#define S3C2410_DMAF_CIRCULAR (1 << 2) /* no circular dma support */
114
113/* dma buffer */ 115/* dma buffer */
114 116
115struct s3c2410_dma_buf; 117struct s3c2410_dma_buf;
@@ -194,4 +196,9 @@ struct s3c2410_dma_chan {
194 196
195typedef unsigned long dma_device_t; 197typedef unsigned long dma_device_t;
196 198
199static inline bool s3c_dma_has_circular(void)
200{
201 return false;
202}
203
197#endif /* __ASM_ARCH_DMA_H */ 204#endif /* __ASM_ARCH_DMA_H */
diff --git a/arch/arm/mach-s3c6400/include/mach/dma.h b/arch/arm/mach-s3c6400/include/mach/dma.h
index 1067619f0ba..004edab2395 100644
--- a/arch/arm/mach-s3c6400/include/mach/dma.h
+++ b/arch/arm/mach-s3c6400/include/mach/dma.h
@@ -68,6 +68,11 @@ static __inline__ int s3c_dma_has_circular(void)
68 68
69#define S3C2410_DMAF_CIRCULAR (1 << 0) 69#define S3C2410_DMAF_CIRCULAR (1 << 0)
70 70
71static inline bool s3c_dma_has_circular(void)
72{
73 return false;
74}
75
71#include <plat/dma.h> 76#include <plat/dma.h>
72 77
73#endif /* __ASM_ARCH_IRQ_H */ 78#endif /* __ASM_ARCH_IRQ_H */
diff --git a/sound/soc/s3c24xx/s3c24xx-pcm.c b/sound/soc/s3c24xx/s3c24xx-pcm.c
index 5cbbdc80fde..1f35c6fcf5f 100644
--- a/sound/soc/s3c24xx/s3c24xx-pcm.c
+++ b/sound/soc/s3c24xx/s3c24xx-pcm.c
@@ -75,11 +75,19 @@ static void s3c24xx_pcm_enqueue(struct snd_pcm_substream *substream)
75{ 75{
76 struct s3c24xx_runtime_data *prtd = substream->runtime->private_data; 76 struct s3c24xx_runtime_data *prtd = substream->runtime->private_data;
77 dma_addr_t pos = prtd->dma_pos; 77 dma_addr_t pos = prtd->dma_pos;
78 unsigned int limit;
78 int ret; 79 int ret;
79 80
80 pr_debug("Entered %s\n", __func__); 81 pr_debug("Entered %s\n", __func__);
81 82
82 while (prtd->dma_loaded < prtd->dma_limit) { 83 if (s3c_dma_has_circular()) {
84 limit = (prtd->dma_end - prtd->dma_start) / prtd->dma_period;
85 } else
86 limit = prtd->dma_limit;
87
88 pr_debug("%s: loaded %d, limit %d\n", __func__, prtd->dma_loaded, limit);
89
90 while (prtd->dma_loaded < limit) {
83 unsigned long len = prtd->dma_period; 91 unsigned long len = prtd->dma_period;
84 92
85 pr_debug("dma_loaded: %d\n", prtd->dma_loaded); 93 pr_debug("dma_loaded: %d\n", prtd->dma_loaded);
@@ -123,7 +131,7 @@ static void s3c24xx_audio_buffdone(struct s3c2410_dma_chan *channel,
123 snd_pcm_period_elapsed(substream); 131 snd_pcm_period_elapsed(substream);
124 132
125 spin_lock(&prtd->lock); 133 spin_lock(&prtd->lock);
126 if (prtd->state & ST_RUNNING) { 134 if (prtd->state & ST_RUNNING && !s3c_dma_has_circular()) {
127 prtd->dma_loaded--; 135 prtd->dma_loaded--;
128 s3c24xx_pcm_enqueue(substream); 136 s3c24xx_pcm_enqueue(substream);
129 } 137 }
@@ -164,6 +172,11 @@ static int s3c24xx_pcm_hw_params(struct snd_pcm_substream *substream,
164 printk(KERN_ERR "failed to get dma channel\n"); 172 printk(KERN_ERR "failed to get dma channel\n");
165 return ret; 173 return ret;
166 } 174 }
175
176 /* use the circular buffering if we have it available. */
177 if (s3c_dma_has_circular())
178 s3c2410_dma_setflags(prtd->params->channel,
179 S3C2410_DMAF_CIRCULAR);
167 } 180 }
168 181
169 s3c2410_dma_set_buffdone_fn(prtd->params->channel, 182 s3c2410_dma_set_buffdone_fn(prtd->params->channel,