AnsweredAssumed Answered

Set I2S communication between i.MX6 and SGTL5000 in DSP_A mode in Linux

Question asked by Adam Olek on Nov 18, 2016
Latest reply on Nov 22, 2016 by Adam Olek

Hello,

for last few days I'm trying to set I2S communication in DSP_A mode(or PCM mode according to SGTL5000 datasheet) between i.MX6 and SGTL5000 codec in Linux. I am using the following drivers:

Linux/sound/soc/codecs/sgtl5000.c - Linux Cross Reference - Free Electrons 

Linux/sound/soc/fsl/imx-sgtl5000.c - Linux Cross Reference - Free Electrons 

Linux/sound/soc/fsl/fsl_ssi.c - Linux Cross Reference - Free Electrons 

 

In imx-sgtl5000.c driver I have changed line 145 to set I2S bus to DSP_A mode:

data->dai.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM;

was changed to:

data->dai.dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM;

 

I also added bit shift in sgtl5000.c driver in switch instruction which starts at line 466(I am using kernel 3.18 where it was missing).

 

I checked I2S bus lines with logical analyzer and BCLK and LRCLK busses looks fine but there is no data transmission while aplay is runnig. Also aplay informs about an error:

$ aplay Crash-Cymbal-1.wav
Playing WAVE 'Crash-Cymbal-1.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
aplay: pcm_write:1939: write error: Input/output error

 

Audio card is visible in system.

Everything is working fine when I2S is set to normal I2S mode.

 

To summarize:

I am using OpenWrt 15.05 with kernel 3.18. SGTL5000 has to be master in I2S communication.

 

Should be anything else be changed in driver? Maybe any other driver should be used? Or any other setting in Linux should be changed?

 

Regards,

Adam

Outcomes