diff options
author | Troy Kisky <troy.kisky@boundarydevices.com> | 2009-07-04 22:29:51 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-07-05 07:59:06 -0400 |
commit | 35cf63583d8d81d8ac261e944db9eeb44a60692d (patch) | |
tree | 521881f51c6282e341cd165d2ae39d19df3efbaf /sound/soc/davinci | |
parent | 6814044324e745e7c55aaf4bd47bdfd9a51d842a (diff) |
ASoC: DaVinci: i2s, remove MOD_REG_BIT macro
No functional changes. Rename variable w to something
more meaningful. Remove code obfuscating macro MOD_REG_BIT.
Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/davinci')
-rw-r--r-- | sound/soc/davinci/davinci-i2s.c | 96 |
1 files changed, 44 insertions, 52 deletions
diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c index b1ea52fc83c7..bf5ec4b2f7f5 100644 --- a/sound/soc/davinci/davinci-i2s.c +++ b/sound/soc/davinci/davinci-i2s.c | |||
@@ -85,14 +85,6 @@ | |||
85 | #define DAVINCI_MCBSP_PCR_FSRM (1 << 10) | 85 | #define DAVINCI_MCBSP_PCR_FSRM (1 << 10) |
86 | #define DAVINCI_MCBSP_PCR_FSXM (1 << 11) | 86 | #define DAVINCI_MCBSP_PCR_FSXM (1 << 11) |
87 | 87 | ||
88 | #define MOD_REG_BIT(val, mask, set) do { \ | ||
89 | if (set) { \ | ||
90 | val |= mask; \ | ||
91 | } else { \ | ||
92 | val &= ~mask; \ | ||
93 | } \ | ||
94 | } while (0) | ||
95 | |||
96 | enum { | 88 | enum { |
97 | DAVINCI_MCBSP_WORD_8 = 0, | 89 | DAVINCI_MCBSP_WORD_8 = 0, |
98 | DAVINCI_MCBSP_WORD_12, | 90 | DAVINCI_MCBSP_WORD_12, |
@@ -133,13 +125,13 @@ static void davinci_mcbsp_start(struct snd_pcm_substream *substream) | |||
133 | struct davinci_mcbsp_dev *dev = rtd->dai->cpu_dai->private_data; | 125 | struct davinci_mcbsp_dev *dev = rtd->dai->cpu_dai->private_data; |
134 | struct snd_soc_device *socdev = rtd->socdev; | 126 | struct snd_soc_device *socdev = rtd->socdev; |
135 | struct snd_soc_platform *platform = socdev->card->platform; | 127 | struct snd_soc_platform *platform = socdev->card->platform; |
136 | u32 w; | 128 | u32 spcr; |
137 | int ret; | 129 | int ret; |
138 | 130 | ||
139 | /* Start the sample generator and enable transmitter/receiver */ | 131 | /* Start the sample generator and enable transmitter/receiver */ |
140 | w = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); | 132 | spcr = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); |
141 | MOD_REG_BIT(w, DAVINCI_MCBSP_SPCR_GRST, 1); | 133 | spcr |= DAVINCI_MCBSP_SPCR_GRST; |
142 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, w); | 134 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, spcr); |
143 | 135 | ||
144 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | 136 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
145 | /* Stop the DMA to avoid data loss */ | 137 | /* Stop the DMA to avoid data loss */ |
@@ -152,17 +144,17 @@ static void davinci_mcbsp_start(struct snd_pcm_substream *substream) | |||
152 | } | 144 | } |
153 | 145 | ||
154 | /* Enable the transmitter */ | 146 | /* Enable the transmitter */ |
155 | w = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); | 147 | spcr = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); |
156 | MOD_REG_BIT(w, DAVINCI_MCBSP_SPCR_XRST, 1); | 148 | spcr |= DAVINCI_MCBSP_SPCR_XRST; |
157 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, w); | 149 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, spcr); |
158 | 150 | ||
159 | /* wait for any unexpected frame sync error to occur */ | 151 | /* wait for any unexpected frame sync error to occur */ |
160 | udelay(100); | 152 | udelay(100); |
161 | 153 | ||
162 | /* Disable the transmitter to clear any outstanding XSYNCERR */ | 154 | /* Disable the transmitter to clear any outstanding XSYNCERR */ |
163 | w = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); | 155 | spcr = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); |
164 | MOD_REG_BIT(w, DAVINCI_MCBSP_SPCR_XRST, 0); | 156 | spcr &= ~DAVINCI_MCBSP_SPCR_XRST; |
165 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, w); | 157 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, spcr); |
166 | 158 | ||
167 | /* Restart the DMA */ | 159 | /* Restart the DMA */ |
168 | if (platform->pcm_ops->trigger) { | 160 | if (platform->pcm_ops->trigger) { |
@@ -172,40 +164,39 @@ static void davinci_mcbsp_start(struct snd_pcm_substream *substream) | |||
172 | printk(KERN_DEBUG "Playback DMA start failed\n"); | 164 | printk(KERN_DEBUG "Playback DMA start failed\n"); |
173 | } | 165 | } |
174 | /* Enable the transmitter */ | 166 | /* Enable the transmitter */ |
175 | w = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); | 167 | spcr = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); |
176 | MOD_REG_BIT(w, DAVINCI_MCBSP_SPCR_XRST, 1); | 168 | spcr |= DAVINCI_MCBSP_SPCR_XRST; |
177 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, w); | 169 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, spcr); |
178 | 170 | ||
179 | } else { | 171 | } else { |
180 | 172 | ||
181 | /* Enable the reciever */ | 173 | /* Enable the reciever */ |
182 | w = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); | 174 | spcr = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); |
183 | MOD_REG_BIT(w, DAVINCI_MCBSP_SPCR_RRST, 1); | 175 | spcr |= DAVINCI_MCBSP_SPCR_RRST; |
184 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, w); | 176 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, spcr); |
185 | } | 177 | } |
186 | 178 | ||
187 | 179 | ||
188 | /* Start frame sync */ | 180 | /* Start frame sync */ |
189 | w = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); | 181 | spcr = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); |
190 | MOD_REG_BIT(w, DAVINCI_MCBSP_SPCR_FRST, 1); | 182 | spcr |= DAVINCI_MCBSP_SPCR_FRST; |
191 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, w); | 183 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, spcr); |
192 | } | 184 | } |
193 | 185 | ||
194 | static void davinci_mcbsp_stop(struct snd_pcm_substream *substream) | 186 | static void davinci_mcbsp_stop(struct snd_pcm_substream *substream) |
195 | { | 187 | { |
196 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 188 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
197 | struct davinci_mcbsp_dev *dev = rtd->dai->cpu_dai->private_data; | 189 | struct davinci_mcbsp_dev *dev = rtd->dai->cpu_dai->private_data; |
198 | u32 w; | 190 | u32 spcr; |
199 | 191 | ||
200 | /* Reset transmitter/receiver and sample rate/frame sync generators */ | 192 | /* Reset transmitter/receiver and sample rate/frame sync generators */ |
201 | w = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); | 193 | spcr = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); |
202 | MOD_REG_BIT(w, DAVINCI_MCBSP_SPCR_GRST | | 194 | spcr &= ~(DAVINCI_MCBSP_SPCR_GRST | DAVINCI_MCBSP_SPCR_FRST); |
203 | DAVINCI_MCBSP_SPCR_FRST, 0); | ||
204 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 195 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
205 | MOD_REG_BIT(w, DAVINCI_MCBSP_SPCR_XRST, 0); | 196 | spcr &= ~DAVINCI_MCBSP_SPCR_XRST; |
206 | else | 197 | else |
207 | MOD_REG_BIT(w, DAVINCI_MCBSP_SPCR_RRST, 0); | 198 | spcr &= ~DAVINCI_MCBSP_SPCR_RRST; |
208 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, w); | 199 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, spcr); |
209 | } | 200 | } |
210 | 201 | ||
211 | static int davinci_i2s_startup(struct snd_pcm_substream *substream, | 202 | static int davinci_i2s_startup(struct snd_pcm_substream *substream, |
@@ -358,25 +349,26 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream, | |||
358 | struct davinci_mcbsp_dev *dev = rtd->dai->cpu_dai->private_data; | 349 | struct davinci_mcbsp_dev *dev = rtd->dai->cpu_dai->private_data; |
359 | struct snd_interval *i = NULL; | 350 | struct snd_interval *i = NULL; |
360 | int mcbsp_word_length; | 351 | int mcbsp_word_length; |
361 | u32 w; | 352 | unsigned int rcr, xcr, srgr; |
353 | u32 spcr; | ||
362 | 354 | ||
363 | /* general line settings */ | 355 | /* general line settings */ |
364 | w = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); | 356 | spcr = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_SPCR_REG); |
365 | if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { | 357 | if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { |
366 | w |= DAVINCI_MCBSP_SPCR_RINTM(3) | DAVINCI_MCBSP_SPCR_FREE; | 358 | spcr |= DAVINCI_MCBSP_SPCR_RINTM(3) | DAVINCI_MCBSP_SPCR_FREE; |
367 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, w); | 359 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, spcr); |
368 | } else { | 360 | } else { |
369 | w |= DAVINCI_MCBSP_SPCR_XINTM(3) | DAVINCI_MCBSP_SPCR_FREE; | 361 | spcr |= DAVINCI_MCBSP_SPCR_XINTM(3) | DAVINCI_MCBSP_SPCR_FREE; |
370 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, w); | 362 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, spcr); |
371 | } | 363 | } |
372 | 364 | ||
373 | i = hw_param_interval(params, SNDRV_PCM_HW_PARAM_SAMPLE_BITS); | 365 | i = hw_param_interval(params, SNDRV_PCM_HW_PARAM_SAMPLE_BITS); |
374 | w = DAVINCI_MCBSP_SRGR_FSGM; | 366 | srgr = DAVINCI_MCBSP_SRGR_FSGM; |
375 | MOD_REG_BIT(w, DAVINCI_MCBSP_SRGR_FWID(snd_interval_value(i) - 1), 1); | 367 | srgr |= DAVINCI_MCBSP_SRGR_FWID(snd_interval_value(i) - 1); |
376 | 368 | ||
377 | i = hw_param_interval(params, SNDRV_PCM_HW_PARAM_FRAME_BITS); | 369 | i = hw_param_interval(params, SNDRV_PCM_HW_PARAM_FRAME_BITS); |
378 | MOD_REG_BIT(w, DAVINCI_MCBSP_SRGR_FPER(snd_interval_value(i) - 1), 1); | 370 | srgr |= DAVINCI_MCBSP_SRGR_FPER(snd_interval_value(i) - 1); |
379 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SRGR_REG, w); | 371 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SRGR_REG, srgr); |
380 | 372 | ||
381 | /* Determine xfer data type */ | 373 | /* Determine xfer data type */ |
382 | switch (params_format(params)) { | 374 | switch (params_format(params)) { |
@@ -398,16 +390,16 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream, | |||
398 | } | 390 | } |
399 | 391 | ||
400 | if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { | 392 | if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { |
401 | w = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_RCR_REG); | 393 | rcr = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_RCR_REG); |
402 | MOD_REG_BIT(w, DAVINCI_MCBSP_RCR_RWDLEN1(mcbsp_word_length) | | 394 | rcr |= DAVINCI_MCBSP_RCR_RWDLEN1(mcbsp_word_length) | |
403 | DAVINCI_MCBSP_RCR_RWDLEN2(mcbsp_word_length), 1); | 395 | DAVINCI_MCBSP_RCR_RWDLEN2(mcbsp_word_length); |
404 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_RCR_REG, w); | 396 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_RCR_REG, rcr); |
405 | 397 | ||
406 | } else { | 398 | } else { |
407 | w = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_XCR_REG); | 399 | xcr = davinci_mcbsp_read_reg(dev, DAVINCI_MCBSP_XCR_REG); |
408 | MOD_REG_BIT(w, DAVINCI_MCBSP_XCR_XWDLEN1(mcbsp_word_length) | | 400 | xcr |= DAVINCI_MCBSP_XCR_XWDLEN1(mcbsp_word_length) | |
409 | DAVINCI_MCBSP_XCR_XWDLEN2(mcbsp_word_length), 1); | 401 | DAVINCI_MCBSP_XCR_XWDLEN2(mcbsp_word_length); |
410 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_XCR_REG, w); | 402 | davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_XCR_REG, xcr); |
411 | 403 | ||
412 | } | 404 | } |
413 | return 0; | 405 | return 0; |