Skip to contentSkip to conversation

imx-ssi.c: fix I2S slave setup

PATCH In review Eric Bénard 3 participants 5 messages May 26, 2010 – May 27, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 imx-ssi.c: fix I2S slave setup

* without this fix, the waveform on the SSI port are not real I2S signal (at least on i.MX27's SSI4)

* original Freescale's driver has

	if (((fmt & SND_SOC_DAIFMT_FORMAT_MASK) == SND_SOC_DAIFMT_I2S)
	    && ssi_mode->network_mode) {
		scr &= ~SSI_SCR_I2S_MODE_MASK;
		scr |= SSI_SCR_I2S_MODE_SLAVE;
	}

So as now the SSI is set in network mode as a default when running in I2S format, it seems reasonable to also set I2S_MODE_SLAVE

---
 sound/soc/imx/imx-ssi.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
sound/soc/imx/imx-ssi.c +1 -3
index 80b4fee..c5e1626 100644
@@ -83,8 +83,6 @@ static int imx_ssi_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai,
 /*
  * SSI DAI format configuration.
  * Should only be called when port is inactive (i.e. SSIEN = 0).
- * Note: We don't use the I2S modes but instead manually configure the
- * SSI for I2S because the I2S mode is only a register preset.
  */
 static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
 {
@@ -98,7 +96,7 @@ static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
 	case SND_SOC_DAIFMT_I2S:
 		/* data on rising edge of bclk, frame low 1clk before data */
 		strcr |= SSI_STCR_TFSI | SSI_STCR_TEFS | SSI_STCR_TXBIT0;
-		scr |= SSI_SCR_NET;
+		scr |= SSI_SCR_NET | SSI_SCR_I2S_MODE_SLAVE;
 		break;
 	case SND_SOC_DAIFMT_LEFT_J:
 		/* data on rising edge of bclk, frame high with data */
Signature · 1 line
1.6.3.3
#1 lore raw
Quoted 2 lines · Eric B??nard

* without this fix, the waveform on the SSI port are not real I2S signal (at least on i.MX27's SSI4)

As I said in reply to your previous patch the current mainline i.MX driver is not able to master the clocks at all?

#2 lore raw

Hi Mark,

Le 27/05/2010 02:57, Mark Brown a ?crit :

Quoted 7 lines · Eric B??nard
Quoted 2 lines

* without this fix, the waveform on the SSI port are not real I2S signal (at least on i.MX27's SSI4)

As I said in reply to your previous patch the current mainline i.MX driver is not able to master the clocks at all?

the problem in not on the clocks (which are generated by the external codec which is the master), but on the way the i.MX's SSI outputs the data vs the framesync provided by the external codec.

If this setting is not the right one (even if sound works perfectly here with it), then there is a bug somewhere else preventing the i.MX's SSI to provide he right data to my TLV320AIC23B using I2S.

Please find attached the patches which add the TLV320 support to our i.MX27 board because the bug may be there :-)

Eric

#3 lore raw
In reply to Eric Bénard
Quoted 2 lines · Eric B??nard

* without this fix, the waveform on the SSI port are not real I2S signal (at least on i.MX27's SSI4)

BTW, please do also remember to CC maintainers on patches as documented in Documentation/SubmittingPatches.

maintainer
#4 lore raw
In reply to Eric Bénard
Quoted 31 lines · Eric B?nard

* without this fix, the waveform on the SSI port are not real I2S signal (at least on i.MX27's SSI4)

* original Freescale's driver has

	if (((fmt & SND_SOC_DAIFMT_FORMAT_MASK) == SND_SOC_DAIFMT_I2S)
	    && ssi_mode->network_mode) {
		scr &= ~SSI_SCR_I2S_MODE_MASK;
		scr |= SSI_SCR_I2S_MODE_SLAVE;
	}

So as now the SSI is set in network mode as a default when running in I2S format, it seems reasonable to also set I2S_MODE_SLAVE

---
 sound/soc/imx/imx-ssi.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
sound/soc/imx/imx-ssi.c +0 -2
index 80b4fee..c5e1626 100644
@@ -83,8 +83,6 @@ static int imx_ssi_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai,
 /*
  * SSI DAI format configuration.
  * Should only be called when port is inactive (i.e. SSIEN = 0).
- * Note: We don't use the I2S modes but instead manually configure the
- * SSI for I2S because the I2S mode is only a register preset.
  */
 static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
 {

sound/soc/imx/imx-ssi.c static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) · line 99

Quoted 5 lines
sound/soc/imx/imx-ssi.c +1 -1
@@ -98,7 +96,7 @@ static int imx_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
 	case SND_SOC_DAIFMT_I2S:
 		/* data on rising edge of bclk, frame low 1clk before data */
 		strcr |= SSI_STCR_TFSI | SSI_STCR_TEFS | SSI_STCR_TXBIT0;
-		scr |= SSI_SCR_NET;
+		scr |= SSI_SCR_NET | SSI_SCR_I2S_MODE_SLAVE;

You should also zero out the SSI_I2S_MODE_MASK in the scr = readl()... above.
Otherwise I'm ok with this patch.

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |