aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2015-03-15 07:15:24 -0400
committerMark Brown <broonie@kernel.org>2015-03-16 07:40:52 -0400
commitfa41181fe37530d78acb25b4e2c9c019241cbbf6 (patch)
treee972ee953cc76fa1cca455eafcc051b971a66412 /sound
parentc517d838eb7d07bbe9507871fab3931deccff539 (diff)
ASoC: nuc900: No need to track the dma buffer in the driver state struct
The DMA buffer and address can be accessed through the snd_pcm_runtime. There is no need to manually track them in the driver's state struct. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/nuc900/nuc900-audio.h3
-rw-r--r--sound/soc/nuc900/nuc900-pcm.c31
2 files changed, 5 insertions, 29 deletions
diff --git a/sound/soc/nuc900/nuc900-audio.h b/sound/soc/nuc900/nuc900-audio.h
index 59f7e8ed1a68..d0b725705914 100644
--- a/sound/soc/nuc900/nuc900-audio.h
+++ b/sound/soc/nuc900/nuc900-audio.h
@@ -100,10 +100,7 @@
100struct nuc900_audio { 100struct nuc900_audio {
101 void __iomem *mmio; 101 void __iomem *mmio;
102 spinlock_t lock; 102 spinlock_t lock;
103 dma_addr_t dma_addr[2];
104 unsigned long buffersize[2];
105 unsigned long irq_num; 103 unsigned long irq_num;
106 struct snd_pcm_substream *substream;
107 struct resource *res; 104 struct resource *res;
108 struct clk *clk; 105 struct clk *clk;
109 struct device *dev; 106 struct device *dev;
diff --git a/sound/soc/nuc900/nuc900-pcm.c b/sound/soc/nuc900/nuc900-pcm.c
index b809fa909e4d..5ae5ca15b6d6 100644
--- a/sound/soc/nuc900/nuc900-pcm.c
+++ b/sound/soc/nuc900/nuc900-pcm.c
@@ -42,29 +42,10 @@ static const struct snd_pcm_hardware nuc900_pcm_hardware = {
42static int nuc900_dma_hw_params(struct snd_pcm_substream *substream, 42static int nuc900_dma_hw_params(struct snd_pcm_substream *substream,
43 struct snd_pcm_hw_params *params) 43 struct snd_pcm_hw_params *params)
44{ 44{
45 struct snd_pcm_runtime *runtime = substream->runtime; 45 return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params));
46 struct nuc900_audio *nuc900_audio = runtime->private_data;
47 unsigned long flags;
48 int ret = 0;
49
50 ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params));
51 if (ret < 0)
52 return ret;
53
54 spin_lock_irqsave(&nuc900_audio->lock, flags);
55
56 nuc900_audio->substream = substream;
57 nuc900_audio->dma_addr[substream->stream] = runtime->dma_addr;
58 nuc900_audio->buffersize[substream->stream] =
59 params_buffer_bytes(params);
60
61 spin_unlock_irqrestore(&nuc900_audio->lock, flags);
62
63 return ret;
64} 46}
65 47
66static void nuc900_update_dma_register(struct snd_pcm_substream *substream, 48static void nuc900_update_dma_register(struct snd_pcm_substream *substream)
67 dma_addr_t dma_addr, size_t count)
68{ 49{
69 struct snd_pcm_runtime *runtime = substream->runtime; 50 struct snd_pcm_runtime *runtime = substream->runtime;
70 struct nuc900_audio *nuc900_audio = runtime->private_data; 51 struct nuc900_audio *nuc900_audio = runtime->private_data;
@@ -78,8 +59,8 @@ static void nuc900_update_dma_register(struct snd_pcm_substream *substream,
78 mmio_len = nuc900_audio->mmio + ACTL_RDST_LENGTH; 59 mmio_len = nuc900_audio->mmio + ACTL_RDST_LENGTH;
79 } 60 }
80 61
81 AUDIO_WRITE(mmio_addr, dma_addr); 62 AUDIO_WRITE(mmio_addr, runtime->dma_addr);
82 AUDIO_WRITE(mmio_len, count); 63 AUDIO_WRITE(mmio_len, runtime->dma_bytes);
83} 64}
84 65
85static void nuc900_dma_start(struct snd_pcm_substream *substream) 66static void nuc900_dma_start(struct snd_pcm_substream *substream)
@@ -170,9 +151,7 @@ static int nuc900_dma_prepare(struct snd_pcm_substream *substream)
170 151
171 spin_lock_irqsave(&nuc900_audio->lock, flags); 152 spin_lock_irqsave(&nuc900_audio->lock, flags);
172 153
173 nuc900_update_dma_register(substream, 154 nuc900_update_dma_register(substream);
174 nuc900_audio->dma_addr[substream->stream],
175 nuc900_audio->buffersize[substream->stream]);
176 155
177 val = AUDIO_READ(nuc900_audio->mmio + ACTL_RESET); 156 val = AUDIO_READ(nuc900_audio->mmio + ACTL_RESET);
178 157