Commit 72d74664 authored by Daniel Mack's avatar Daniel Mack Committed by Mark Brown

ASoC: switch PXA SSP driver from network mode to PSP

This switches the pxa ssp port usage from network mode to PSP mode.
Removed some comments and checks for configured TDM channels.
A special case is added to support configuration where BCLK = 64fs. We
need to do some black magic in this case which doesn't look nice but
there is unfortunately no other option than that.
Diagnosed-by: default avatarTim Ruetz <tim@caiaq.de>
Signed-off-by: default avatarDaniel Mack <daniel@caiaq.de>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 77dd7e17
...@@ -558,18 +558,17 @@ static int pxa_ssp_set_dai_fmt(struct snd_soc_dai *cpu_dai, ...@@ -558,18 +558,17 @@ static int pxa_ssp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
case SND_SOC_DAIFMT_I2S: case SND_SOC_DAIFMT_I2S:
sscr0 |= SSCR0_MOD | SSCR0_PSP; sscr0 |= SSCR0_PSP;
sscr1 |= SSCR1_RWOT | SSCR1_TRAIL; sscr1 |= SSCR1_RWOT | SSCR1_TRAIL;
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:
sspsp |= SSPSP_FSRT;
break; break;
case SND_SOC_DAIFMT_NB_IF: case SND_SOC_DAIFMT_NB_IF:
sspsp |= SSPSP_SFRMP | SSPSP_FSRT; sspsp |= SSPSP_SFRMP;
break; break;
case SND_SOC_DAIFMT_IB_IF: case SND_SOC_DAIFMT_IB_IF:
sspsp |= SSPSP_SFRMP; sspsp |= SSPSP_SFRMP | SSPSP_SCMODE(3);
break; break;
default: default:
return -EINVAL; return -EINVAL;
...@@ -655,33 +654,56 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream, ...@@ -655,33 +654,56 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
sscr0 |= SSCR0_FPCKE; sscr0 |= SSCR0_FPCKE;
#endif #endif
sscr0 |= SSCR0_DataSize(16); sscr0 |= SSCR0_DataSize(16);
/* use network mode (2 slots) for 16 bit stereo */
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case SNDRV_PCM_FORMAT_S24_LE:
sscr0 |= (SSCR0_EDSS | SSCR0_DataSize(8)); sscr0 |= (SSCR0_EDSS | SSCR0_DataSize(8));
/* we must be in network mode (2 slots) for 24 bit stereo */
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case SNDRV_PCM_FORMAT_S32_LE:
sscr0 |= (SSCR0_EDSS | SSCR0_DataSize(16)); sscr0 |= (SSCR0_EDSS | SSCR0_DataSize(16));
/* we must be in network mode (2 slots) for 32 bit stereo */
break; break;
} }
ssp_write_reg(ssp, SSCR0, sscr0); ssp_write_reg(ssp, SSCR0, sscr0);
switch (priv->dai_fmt & SND_SOC_DAIFMT_FORMAT_MASK) { switch (priv->dai_fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
case SND_SOC_DAIFMT_I2S: case SND_SOC_DAIFMT_I2S:
/* Cleared when the DAI format is set */ sspsp = ssp_read_reg(ssp, SSPSP);
sspsp = ssp_read_reg(ssp, SSPSP) | SSPSP_SFRMWDTH(width);
if (((sscr0 & SSCR0_SCR) == SSCR0_SerClkDiv(4)) &&
(width == 16)) {
/* This is a special case where the bitclk is 64fs
* and we're not dealing with 2*32 bits of audio
* samples.
*
* The SSP values used for that are all found out by
* trying and failing a lot; some of the registers
* needed for that mode are only available on PXA3xx.
*/
#ifdef CONFIG_PXA3xx
if (!cpu_is_pxa3xx())
return -EINVAL;
sspsp |= SSPSP_SFRMWDTH(width * 2);
sspsp |= SSPSP_SFRMDLY(width * 4);
sspsp |= SSPSP_EDMYSTOP(3);
sspsp |= SSPSP_DMYSTOP(3);
sspsp |= SSPSP_DMYSTRT(1);
#else
return -EINVAL;
#endif
} else
sspsp |= SSPSP_SFRMWDTH(width);
ssp_write_reg(ssp, SSPSP, sspsp); ssp_write_reg(ssp, SSPSP, sspsp);
break; break;
default: default:
break; break;
} }
/* We always use a network mode so we always require TDM slots /* When we use a network mode, we always require TDM slots
* - complain loudly and fail if they've not been set up yet. * - complain loudly and fail if they've not been set up yet.
*/ */
if (!(ssp_read_reg(ssp, SSTSA) & 0xf)) { if ((sscr0 & SSCR0_MOD) && !(ssp_read_reg(ssp, SSTSA) & 0xf)) {
dev_err(&ssp->pdev->dev, "No TDM timeslot configured\n"); dev_err(&ssp->pdev->dev, "No TDM timeslot configured\n");
return -EINVAL; return -EINVAL;
} }
......
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