diff options
author | Peter Ujfalusi <peter.ujfalusi@nokia.com> | 2009-04-15 08:38:55 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-04-16 09:04:09 -0400 |
commit | c29b206ffd0700acb2dc1fdb70856cc4b907216c (patch) | |
tree | 218f9dfb8684cc7d4ce93a721853c19610752cf4 /sound/soc | |
parent | 0d960e8891459f5af85e5781bce3f1da5f7db0fb (diff) |
ASoC: OMAP: Use single-phase for DSP mode
Use single-phase mode for the DSP mode and keep the dual phase
mode for the I2S mode.
The mono (1 channel) mode already used single phase mode,
now it is more cleaner. There is no need to configure the
second phase, when the single phase is used.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Jarkko Nikula <jarkko.nikula@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/omap/omap-mcbsp.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index 9c09b94f0cf8..402a1eb7bd3f 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c | |||
@@ -214,8 +214,9 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, | |||
214 | struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); | 214 | struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); |
215 | struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; | 215 | struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; |
216 | int dma, bus_id = mcbsp_data->bus_id, id = cpu_dai->id; | 216 | int dma, bus_id = mcbsp_data->bus_id, id = cpu_dai->id; |
217 | int wlen, channels; | 217 | int wlen, channels, wpf; |
218 | unsigned long port; | 218 | unsigned long port; |
219 | unsigned int format; | ||
219 | 220 | ||
220 | if (cpu_class_is_omap1()) { | 221 | if (cpu_class_is_omap1()) { |
221 | dma = omap1_dma_reqs[bus_id][substream->stream]; | 222 | dma = omap1_dma_reqs[bus_id][substream->stream]; |
@@ -243,18 +244,23 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, | |||
243 | return 0; | 244 | return 0; |
244 | } | 245 | } |
245 | 246 | ||
246 | channels = params_channels(params); | 247 | format = mcbsp_data->fmt & SND_SOC_DAIFMT_FORMAT_MASK; |
248 | wpf = channels = params_channels(params); | ||
247 | switch (channels) { | 249 | switch (channels) { |
248 | case 2: | 250 | case 2: |
249 | /* Use dual-phase frames */ | 251 | if (format == SND_SOC_DAIFMT_I2S) { |
250 | regs->rcr2 |= RPHASE; | 252 | /* Use dual-phase frames */ |
251 | regs->xcr2 |= XPHASE; | 253 | regs->rcr2 |= RPHASE; |
254 | regs->xcr2 |= XPHASE; | ||
255 | /* Set 1 word per (McBSP) frame for phase1 and phase2 */ | ||
256 | wpf--; | ||
257 | regs->rcr2 |= RFRLEN2(wpf - 1); | ||
258 | regs->xcr2 |= XFRLEN2(wpf - 1); | ||
259 | } | ||
252 | case 1: | 260 | case 1: |
253 | /* Set 1 word per (McBSP) frame */ | 261 | /* Set word per (McBSP) frame for phase1 */ |
254 | regs->rcr2 |= RFRLEN2(1 - 1); | 262 | regs->rcr1 |= RFRLEN1(wpf - 1); |
255 | regs->rcr1 |= RFRLEN1(1 - 1); | 263 | regs->xcr1 |= XFRLEN1(wpf - 1); |
256 | regs->xcr2 |= XFRLEN2(1 - 1); | ||
257 | regs->xcr1 |= XFRLEN1(1 - 1); | ||
258 | break; | 264 | break; |
259 | default: | 265 | default: |
260 | /* Unsupported number of channels */ | 266 | /* Unsupported number of channels */ |
@@ -276,9 +282,9 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream, | |||
276 | } | 282 | } |
277 | 283 | ||
278 | /* Set FS period and length in terms of bit clock periods */ | 284 | /* Set FS period and length in terms of bit clock periods */ |
279 | switch (mcbsp_data->fmt & SND_SOC_DAIFMT_FORMAT_MASK) { | 285 | switch (format) { |
280 | case SND_SOC_DAIFMT_I2S: | 286 | case SND_SOC_DAIFMT_I2S: |
281 | regs->srgr2 |= FPER(wlen * 2 - 1); | 287 | regs->srgr2 |= FPER(wlen * channels - 1); |
282 | regs->srgr1 |= FWID(wlen - 1); | 288 | regs->srgr1 |= FWID(wlen - 1); |
283 | break; | 289 | break; |
284 | case SND_SOC_DAIFMT_DSP_B: | 290 | case SND_SOC_DAIFMT_DSP_B: |