aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/omap/omap-mcbsp.c
diff options
context:
space:
mode:
authorJarkko Nikula <jarkko.nikula@nokia.com>2008-11-25 05:45:09 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2008-11-25 10:21:26 -0500
commit375e8a7c943d5aa8716be229e398473b23709ce9 (patch)
treeec714771f9cedd2f4098fb5b3e36a890f73e1f96 /sound/soc/omap/omap-mcbsp.c
parent0be43050d4da08295b985cb23347ecc1003cb8d6 (diff)
ASoC: OMAP: Add support for mono audio links in McBSP DAI
Patch adds support for mono audio links so that McBSP DAI can operate with real mono codecs. In I2S, the signalling remains the same but only first frame (left channel) is transmitting audio data and second frame having null data. In DSP_A, only first frame is transmitted. Signed-off-by: Jarkko Nikula <jarkko.nikula@nokia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/omap/omap-mcbsp.c')
-rw-r--r--sound/soc/omap/omap-mcbsp.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index 252bc7ebb194..e8f1314762d7 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -203,7 +203,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
203 struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data); 203 struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data);
204 struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; 204 struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs;
205 int dma, bus_id = mcbsp_data->bus_id, id = cpu_dai->id; 205 int dma, bus_id = mcbsp_data->bus_id, id = cpu_dai->id;
206 int wlen; 206 int wlen, channels;
207 unsigned long port; 207 unsigned long port;
208 208
209 if (cpu_class_is_omap1()) { 209 if (cpu_class_is_omap1()) {
@@ -232,12 +232,17 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
232 return 0; 232 return 0;
233 } 233 }
234 234
235 switch (params_channels(params)) { 235 channels = params_channels(params);
236 switch (channels) {
236 case 2: 237 case 2:
237 /* Set 1 word per (McBPSP) frame and use dual-phase frames */ 238 /* Use dual-phase frames */
238 regs->rcr2 |= RFRLEN2(1 - 1) | RPHASE; 239 regs->rcr2 |= RPHASE;
240 regs->xcr2 |= XPHASE;
241 case 1:
242 /* Set 1 word per (McBSP) frame */
243 regs->rcr2 |= RFRLEN2(1 - 1);
239 regs->rcr1 |= RFRLEN1(1 - 1); 244 regs->rcr1 |= RFRLEN1(1 - 1);
240 regs->xcr2 |= XFRLEN2(1 - 1) | XPHASE; 245 regs->xcr2 |= XFRLEN2(1 - 1);
241 regs->xcr1 |= XFRLEN1(1 - 1); 246 regs->xcr1 |= XFRLEN1(1 - 1);
242 break; 247 break;
243 default: 248 default:
@@ -266,8 +271,8 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
266 regs->srgr1 |= FWID(wlen - 1); 271 regs->srgr1 |= FWID(wlen - 1);
267 break; 272 break;
268 case SND_SOC_DAIFMT_DSP_A: 273 case SND_SOC_DAIFMT_DSP_A:
269 regs->srgr2 |= FPER(wlen * 2 - 1); 274 regs->srgr2 |= FPER(wlen * channels - 1);
270 regs->srgr1 |= FWID(wlen * 2 - 2); 275 regs->srgr1 |= FWID(wlen * channels - 2);
271 break; 276 break;
272 } 277 }
273 278
@@ -457,13 +462,13 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
457 .name = "omap-mcbsp-dai-"#link_id, \ 462 .name = "omap-mcbsp-dai-"#link_id, \
458 .id = (link_id), \ 463 .id = (link_id), \
459 .playback = { \ 464 .playback = { \
460 .channels_min = 2, \ 465 .channels_min = 1, \
461 .channels_max = 2, \ 466 .channels_max = 2, \
462 .rates = OMAP_MCBSP_RATES, \ 467 .rates = OMAP_MCBSP_RATES, \
463 .formats = SNDRV_PCM_FMTBIT_S16_LE, \ 468 .formats = SNDRV_PCM_FMTBIT_S16_LE, \
464 }, \ 469 }, \
465 .capture = { \ 470 .capture = { \
466 .channels_min = 2, \ 471 .channels_min = 1, \
467 .channels_max = 2, \ 472 .channels_max = 2, \
468 .rates = OMAP_MCBSP_RATES, \ 473 .rates = OMAP_MCBSP_RATES, \
469 .formats = SNDRV_PCM_FMTBIT_S16_LE, \ 474 .formats = SNDRV_PCM_FMTBIT_S16_LE, \