diff options
author | Wan ZongShun <mcuos.com@gmail.com> | 2010-06-02 01:54:25 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-06-02 06:47:06 -0400 |
commit | 018334c045c95793ab58948fe1f63282459c4f8d (patch) | |
tree | afc1618892d81dc16b04d060f1cc24cb0fc46fe5 /sound/soc/nuc900 | |
parent | 1fab79b8a1bf0d46a7c7e6a1c06dbed1803f403c (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')
-rw-r--r-- | sound/soc/nuc900/nuc900-ac97.c | 6 | ||||
-rw-r--r-- | sound/soc/nuc900/nuc900-auido.h | 4 | ||||
-rw-r--r-- | sound/soc/nuc900/nuc900-pcm.c | 18 |
3 files changed, 13 insertions, 15 deletions
diff --git a/sound/soc/nuc900/nuc900-ac97.c b/sound/soc/nuc900/nuc900-ac97.c index f7b44e081420..e1634a2f1701 100644 --- a/sound/soc/nuc900/nuc900-ac97.c +++ b/sound/soc/nuc900/nuc900-ac97.c | |||
@@ -222,7 +222,7 @@ static int nuc900_ac97_trigger(struct snd_pcm_substream *substream, | |||
222 | int cmd, struct snd_soc_dai *dai) | 222 | int cmd, struct snd_soc_dai *dai) |
223 | { | 223 | { |
224 | struct nuc900_audio *nuc900_audio = nuc900_ac97_data; | 224 | struct nuc900_audio *nuc900_audio = nuc900_ac97_data; |
225 | int ret, stype = SUBSTREAM_TYPE(substream); | 225 | int ret; |
226 | unsigned long val, tmp; | 226 | unsigned long val, tmp; |
227 | 227 | ||
228 | ret = 0; | 228 | ret = 0; |
@@ -231,7 +231,7 @@ static int nuc900_ac97_trigger(struct snd_pcm_substream *substream, | |||
231 | case SNDRV_PCM_TRIGGER_START: | 231 | case SNDRV_PCM_TRIGGER_START: |
232 | case SNDRV_PCM_TRIGGER_RESUME: | 232 | case SNDRV_PCM_TRIGGER_RESUME: |
233 | val = AUDIO_READ(nuc900_audio->mmio + ACTL_RESET); | 233 | val = AUDIO_READ(nuc900_audio->mmio + ACTL_RESET); |
234 | if (PCM_TX == stype) { | 234 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
235 | tmp = AUDIO_READ(nuc900_audio->mmio + ACTL_ACOS0); | 235 | tmp = AUDIO_READ(nuc900_audio->mmio + ACTL_ACOS0); |
236 | tmp |= (SLOT3_VALID | SLOT4_VALID | VALID_FRAME); | 236 | tmp |= (SLOT3_VALID | SLOT4_VALID | VALID_FRAME); |
237 | AUDIO_WRITE(nuc900_audio->mmio + ACTL_ACOS0, tmp); | 237 | AUDIO_WRITE(nuc900_audio->mmio + ACTL_ACOS0, tmp); |
@@ -254,7 +254,7 @@ static int nuc900_ac97_trigger(struct snd_pcm_substream *substream, | |||
254 | case SNDRV_PCM_TRIGGER_STOP: | 254 | case SNDRV_PCM_TRIGGER_STOP: |
255 | case SNDRV_PCM_TRIGGER_SUSPEND: | 255 | case SNDRV_PCM_TRIGGER_SUSPEND: |
256 | val = AUDIO_READ(nuc900_audio->mmio + ACTL_RESET); | 256 | val = AUDIO_READ(nuc900_audio->mmio + ACTL_RESET); |
257 | if (PCM_TX == stype) { | 257 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
258 | tmp = AUDIO_READ(nuc900_audio->mmio + ACTL_ACOS0); | 258 | tmp = AUDIO_READ(nuc900_audio->mmio + ACTL_ACOS0); |
259 | tmp &= ~(SLOT3_VALID | SLOT4_VALID); | 259 | tmp &= ~(SLOT3_VALID | SLOT4_VALID); |
260 | AUDIO_WRITE(nuc900_audio->mmio + ACTL_ACOS0, tmp); | 260 | AUDIO_WRITE(nuc900_audio->mmio + ACTL_ACOS0, tmp); |
diff --git a/sound/soc/nuc900/nuc900-auido.h b/sound/soc/nuc900/nuc900-auido.h index 95ac4ef2f353..3038f519729f 100644 --- a/sound/soc/nuc900/nuc900-auido.h +++ b/sound/soc/nuc900/nuc900-auido.h | |||
@@ -96,10 +96,6 @@ | |||
96 | #define RESET_PRSR 0x00 | 96 | #define RESET_PRSR 0x00 |
97 | #define AUDIO_WRITE(addr, val) __raw_writel(val, addr) | 97 | #define AUDIO_WRITE(addr, val) __raw_writel(val, addr) |
98 | #define AUDIO_READ(addr) __raw_readl(addr) | 98 | #define AUDIO_READ(addr) __raw_readl(addr) |
99 | #define PCM_TX 0 | ||
100 | #define PCM_RX 1 | ||
101 | #define SUBSTREAM_TYPE(substream) \ | ||
102 | ((substream)->stream == SNDRV_PCM_STREAM_PLAYBACK ? PCM_TX : PCM_RX) | ||
103 | 99 | ||
104 | struct nuc900_audio { | 100 | struct nuc900_audio { |
105 | void __iomem *mmio; | 101 | void __iomem *mmio; |
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); |