aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/nuc900/nuc900-pcm.c
diff options
context:
space:
mode:
authorWan ZongShun <mcuos.com@gmail.com>2010-06-02 01:54:25 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-06-02 06:47:06 -0400
commit018334c045c95793ab58948fe1f63282459c4f8d (patch)
treeafc1618892d81dc16b04d060f1cc24cb0fc46fe5 /sound/soc/nuc900/nuc900-pcm.c
parent1fab79b8a1bf0d46a7c7e6a1c06dbed1803f403c (diff)
ASoC: nuc900: patch for SUBSTREAM_TYPE', 'PCM_TX' and 'PCM_RX' removal
This patch is to remove the 'SUBSTREAM_TYPE','PCM_TX' and 'PCM_RX' definition. There is no need to redefine SNDRV_PCM_STREAM_PLAYBACK as PCM_TX, the SUBSTREAM_TYPE(substream) can be deleted too, the playback or record can be judged by 'if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)' directly rather than 'if (PCM_TX == stype)', which makes the codes easy to read. Signed-off-by: Wan ZongShun <mcuos.com@gmail.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/nuc900/nuc900-pcm.c')
-rw-r--r--sound/soc/nuc900/nuc900-pcm.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/sound/soc/nuc900/nuc900-pcm.c b/sound/soc/nuc900/nuc900-pcm.c
index 32a503c1c4be..445a18011d8e 100644
--- a/sound/soc/nuc900/nuc900-pcm.c
+++ b/sound/soc/nuc900/nuc900-pcm.c
@@ -47,7 +47,7 @@ static int nuc900_dma_hw_params(struct snd_pcm_substream *substream,
47{ 47{
48 struct snd_pcm_runtime *runtime = substream->runtime; 48 struct snd_pcm_runtime *runtime = substream->runtime;
49 struct nuc900_audio *nuc900_audio = runtime->private_data; 49 struct nuc900_audio *nuc900_audio = runtime->private_data;
50 unsigned long flags, stype = SUBSTREAM_TYPE(substream); 50 unsigned long flags;
51 int ret = 0; 51 int ret = 0;
52 52
53 spin_lock_irqsave(&nuc900_audio->lock, flags); 53 spin_lock_irqsave(&nuc900_audio->lock, flags);
@@ -57,8 +57,9 @@ static int nuc900_dma_hw_params(struct snd_pcm_substream *substream,
57 return ret; 57 return ret;
58 58
59 nuc900_audio->substream = substream; 59 nuc900_audio->substream = substream;
60 nuc900_audio->dma_addr[stype] = runtime->dma_addr; 60 nuc900_audio->dma_addr[substream->stream] = runtime->dma_addr;
61 nuc900_audio->buffersize[stype] = params_buffer_bytes(params); 61 nuc900_audio->buffersize[substream->stream] =
62 params_buffer_bytes(params);
62 63
63 spin_unlock_irqrestore(&nuc900_audio->lock, flags); 64 spin_unlock_irqrestore(&nuc900_audio->lock, flags);
64 65
@@ -72,7 +73,7 @@ static void nuc900_update_dma_register(struct snd_pcm_substream *substream,
72 struct nuc900_audio *nuc900_audio = runtime->private_data; 73 struct nuc900_audio *nuc900_audio = runtime->private_data;
73 void __iomem *mmio_addr, *mmio_len; 74 void __iomem *mmio_addr, *mmio_len;
74 75
75 if (SUBSTREAM_TYPE(substream) == PCM_TX) { 76 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
76 mmio_addr = nuc900_audio->mmio + ACTL_PDSTB; 77 mmio_addr = nuc900_audio->mmio + ACTL_PDSTB;
77 mmio_len = nuc900_audio->mmio + ACTL_PDST_LENGTH; 78 mmio_len = nuc900_audio->mmio + ACTL_PDST_LENGTH;
78 } else { 79 } else {
@@ -167,18 +168,19 @@ static int nuc900_dma_prepare(struct snd_pcm_substream *substream)
167{ 168{
168 struct snd_pcm_runtime *runtime = substream->runtime; 169 struct snd_pcm_runtime *runtime = substream->runtime;
169 struct nuc900_audio *nuc900_audio = runtime->private_data; 170 struct nuc900_audio *nuc900_audio = runtime->private_data;
170 unsigned long flags, val, stype = SUBSTREAM_TYPE(substream);; 171 unsigned long flags, val;
171 172
172 spin_lock_irqsave(&nuc900_audio->lock, flags); 173 spin_lock_irqsave(&nuc900_audio->lock, flags);
173 174
174 nuc900_update_dma_register(substream, 175 nuc900_update_dma_register(substream,
175 nuc900_audio->dma_addr[stype], nuc900_audio->buffersize[stype]); 176 nuc900_audio->dma_addr[substream->stream],
177 nuc900_audio->buffersize[substream->stream]);
176 178
177 val = AUDIO_READ(nuc900_audio->mmio + ACTL_RESET); 179 val = AUDIO_READ(nuc900_audio->mmio + ACTL_RESET);
178 180
179 switch (runtime->channels) { 181 switch (runtime->channels) {
180 case 1: 182 case 1:
181 if (PCM_TX == stype) { 183 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
182 val &= ~(PLAY_LEFT_CHNNEL | PLAY_RIGHT_CHNNEL); 184 val &= ~(PLAY_LEFT_CHNNEL | PLAY_RIGHT_CHNNEL);
183 val |= PLAY_RIGHT_CHNNEL; 185 val |= PLAY_RIGHT_CHNNEL;
184 } else { 186 } else {
@@ -188,7 +190,7 @@ static int nuc900_dma_prepare(struct snd_pcm_substream *substream)
188 AUDIO_WRITE(nuc900_audio->mmio + ACTL_RESET, val); 190 AUDIO_WRITE(nuc900_audio->mmio + ACTL_RESET, val);
189 break; 191 break;
190 case 2: 192 case 2:
191 if (PCM_TX == stype) 193 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
192 val |= (PLAY_LEFT_CHNNEL | PLAY_RIGHT_CHNNEL); 194 val |= (PLAY_LEFT_CHNNEL | PLAY_RIGHT_CHNNEL);
193 else 195 else
194 val |= (RECORD_LEFT_CHNNEL | RECORD_RIGHT_CHNNEL); 196 val |= (RECORD_LEFT_CHNNEL | RECORD_RIGHT_CHNNEL);