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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

1,499 Views
aolek
Contributor I

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

Labels (1)
Tags (3)
0 Kudos
Reply
2 Replies

885 Views
igorpadykov
NXP Employee
NXP Employee

Hi Adam

seems this signal format is close to SSI TDM mode with two time slots,
one can check suggestion on

https://community.nxp.com/message/669120

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

885 Views
aolek
Contributor I

Hello Igor,

thank you for your fast reply.

I read this topic. So I should use simple-card.c driver? And it should be used together with sgtl5000 drivers?

Yesterday I started adding new node in device-tree for simple-card driver but still I wonder if it is good idea to go this way.

For me it seems OK because I can't see anyother place where I could define TDM parameters. Or maybe I am wrong and TDM parameters should be defined somewhere else?

Regards,

Adam

0 Kudos
Reply