Commit 91a18ae8 authored by Jarkko Nikula's avatar Jarkko Nikula Committed by Mark Brown

ASoC: omap-mcbsp: Fix FS polarity for LEFT_J, DSP_A and DSP_B formats

Commit 75d9ac46 ("ASoC: Allow DAI formats to be specified in the dai_link")
changed DAI format flag values and we cannot simply invert anymore e.g.
frame-sync with ^= SND_SOC_DAIFMT_NB_IF (which was anyway misuse) as there
is no anymore fixed bit position for bit-clock or frame-sync inversion.

Fix this by relying only on DAI format flag values passed to us and by not
making any assumption on individual bit positions.
Signed-off-by: default avatarJarkko Nikula <jarkko.nikula@bitmer.com>
Acked-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent f34dafb2
...@@ -398,7 +398,7 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai, ...@@ -398,7 +398,7 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai,
{ {
struct omap_mcbsp_data *mcbsp_data = snd_soc_dai_get_drvdata(cpu_dai); struct omap_mcbsp_data *mcbsp_data = snd_soc_dai_get_drvdata(cpu_dai);
struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs; struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs;
unsigned int temp_fmt = fmt; bool inv_fs = false;
if (mcbsp_data->configured) if (mcbsp_data->configured)
return 0; return 0;
...@@ -430,21 +430,21 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai, ...@@ -430,21 +430,21 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai,
regs->xcr2 |= XDATDLY(0); regs->xcr2 |= XDATDLY(0);
regs->spcr1 |= RJUST(2); regs->spcr1 |= RJUST(2);
/* Invert FS polarity configuration */ /* Invert FS polarity configuration */
temp_fmt ^= SND_SOC_DAIFMT_NB_IF; inv_fs = true;
break; break;
case SND_SOC_DAIFMT_DSP_A: case SND_SOC_DAIFMT_DSP_A:
/* 1-bit data delay */ /* 1-bit data delay */
regs->rcr2 |= RDATDLY(1); regs->rcr2 |= RDATDLY(1);
regs->xcr2 |= XDATDLY(1); regs->xcr2 |= XDATDLY(1);
/* Invert FS polarity configuration */ /* Invert FS polarity configuration */
temp_fmt ^= SND_SOC_DAIFMT_NB_IF; inv_fs = true;
break; break;
case SND_SOC_DAIFMT_DSP_B: case SND_SOC_DAIFMT_DSP_B:
/* 0-bit data delay */ /* 0-bit data delay */
regs->rcr2 |= RDATDLY(0); regs->rcr2 |= RDATDLY(0);
regs->xcr2 |= XDATDLY(0); regs->xcr2 |= XDATDLY(0);
/* Invert FS polarity configuration */ /* Invert FS polarity configuration */
temp_fmt ^= SND_SOC_DAIFMT_NB_IF; inv_fs = true;
break; break;
default: default:
/* Unsupported data format */ /* Unsupported data format */
...@@ -468,7 +468,7 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai, ...@@ -468,7 +468,7 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai,
} }
/* Set bit clock (CLKX/CLKR) and FS polarities */ /* Set bit clock (CLKX/CLKR) and FS polarities */
switch (temp_fmt & SND_SOC_DAIFMT_INV_MASK) { switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
case SND_SOC_DAIFMT_NB_NF: case SND_SOC_DAIFMT_NB_NF:
/* /*
* Normal BCLK + FS. * Normal BCLK + FS.
...@@ -489,6 +489,8 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai, ...@@ -489,6 +489,8 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai,
default: default:
return -EINVAL; return -EINVAL;
} }
if (inv_fs == true)
regs->pcr0 ^= FSXP | FSRP;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment