Skip to content

Commit

Permalink
ASoC: OMAP: Add support for mono audio links in McBSP DAI
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jarkko Nikula authored and Mark Brown committed Nov 25, 2008
1 parent 0be4305 commit 375e8a7
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions sound/soc/omap/omap-mcbsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data);
struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs;
int dma, bus_id = mcbsp_data->bus_id, id = cpu_dai->id;
int wlen;
int wlen, channels;
unsigned long port;

if (cpu_class_is_omap1()) {
Expand Down Expand Up @@ -232,12 +232,17 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
return 0;
}

switch (params_channels(params)) {
channels = params_channels(params);
switch (channels) {
case 2:
/* Set 1 word per (McBPSP) frame and use dual-phase frames */
regs->rcr2 |= RFRLEN2(1 - 1) | RPHASE;
/* Use dual-phase frames */
regs->rcr2 |= RPHASE;
regs->xcr2 |= XPHASE;
case 1:
/* Set 1 word per (McBSP) frame */
regs->rcr2 |= RFRLEN2(1 - 1);
regs->rcr1 |= RFRLEN1(1 - 1);
regs->xcr2 |= XFRLEN2(1 - 1) | XPHASE;
regs->xcr2 |= XFRLEN2(1 - 1);
regs->xcr1 |= XFRLEN1(1 - 1);
break;
default:
Expand Down Expand Up @@ -266,8 +271,8 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
regs->srgr1 |= FWID(wlen - 1);
break;
case SND_SOC_DAIFMT_DSP_A:
regs->srgr2 |= FPER(wlen * 2 - 1);
regs->srgr1 |= FWID(wlen * 2 - 2);
regs->srgr2 |= FPER(wlen * channels - 1);
regs->srgr1 |= FWID(wlen * channels - 2);
break;
}

Expand Down Expand Up @@ -457,13 +462,13 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
.name = "omap-mcbsp-dai-"#link_id, \
.id = (link_id), \
.playback = { \
.channels_min = 2, \
.channels_min = 1, \
.channels_max = 2, \
.rates = OMAP_MCBSP_RATES, \
.formats = SNDRV_PCM_FMTBIT_S16_LE, \
}, \
.capture = { \
.channels_min = 2, \
.channels_min = 1, \
.channels_max = 2, \
.rates = OMAP_MCBSP_RATES, \
.formats = SNDRV_PCM_FMTBIT_S16_LE, \
Expand Down

0 comments on commit 375e8a7

Please sign in to comment.