ASoC: Fix non-networked I2S mode for PXA SSP

Two issues are fixed here:

 - I2S transmits the left frame with the clock low but I don't seem to
   get LRCLK out without SFRMDLY being set so invert SFRMP and set a
   delay.
 - I2S has a clock cycle prior to the first data byte in each channel
   so we need to delay the data by one cycle.

Tested-by: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
Mark Brown 2009-03-13 14:26:08 +00:00
Родитель 72d7466468
Коммит 0ce36c5f7f
1 изменённых файлов: 15 добавлений и 6 удалений

Просмотреть файл

@ -1,4 +1,3 @@
#define DEBUG
/* /*
* pxa-ssp.c -- ALSA Soc Audio Layer * pxa-ssp.c -- ALSA Soc Audio Layer
* *
@ -561,14 +560,15 @@ static int pxa_ssp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
sscr0 |= SSCR0_PSP; sscr0 |= SSCR0_PSP;
sscr1 |= SSCR1_RWOT | SSCR1_TRAIL; sscr1 |= SSCR1_RWOT | SSCR1_TRAIL;
/* See hw_params() */
switch (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:
break;
case SND_SOC_DAIFMT_NB_IF:
sspsp |= SSPSP_SFRMP; sspsp |= SSPSP_SFRMP;
break; break;
case SND_SOC_DAIFMT_NB_IF:
break;
case SND_SOC_DAIFMT_IB_IF: case SND_SOC_DAIFMT_IB_IF:
sspsp |= SSPSP_SFRMP | SSPSP_SCMODE(3); sspsp |= SSPSP_SCMODE(3);
break; break;
default: default:
return -EINVAL; return -EINVAL;
@ -691,8 +691,17 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
#else #else
return -EINVAL; return -EINVAL;
#endif #endif
} else } else {
sspsp |= SSPSP_SFRMWDTH(width); /* The frame width is the width the LRCLK is
* asserted for; the delay is expressed in
* half cycle units. We need the extra cycle
* because the data starts clocking out one BCLK
* after LRCLK changes polarity.
*/
sspsp |= SSPSP_SFRMWDTH(width + 1);
sspsp |= SSPSP_SFRMDLY((width + 1) * 2);
sspsp |= SSPSP_DMYSTRT(1);
}
ssp_write_reg(ssp, SSPSP, sspsp); ssp_write_reg(ssp, SSPSP, sspsp);
break; break;