i.mx6 i2s setup and audio amplifier

cancel
Showing results for 
Search instead for 
Did you mean: 

i.mx6 i2s setup and audio amplifier

Jump to solution
6,416 Views
arisav
Contributor III

Hi

We have developed board which uses SMARC-sAMX6i module from Kontron. In SSI bus we have MAX98357A PCM input class D audio amplifier which takes either I^2S or TDM data

and acts as slave for SSI bus. We are using kernel 3.14 so which are the stpes to get SSI bus and maxim working?

- dts configure settings so we can write raw data to /dev/i2s device

  or

- Do we need create ALSA driver for that or is there driver already in kernel which have to activate in device tree?

- Something else ?

Thanks,

Ari Savolainen

Labels (2)
0 Kudos
1 Solution
3,152 Views
igorpadykov
NXP TechSupport
NXP TechSupport

Hi Ari

one can follow steps described in attached Porting Guide

Chapter 8 Porting Audio Codecs to a Custom Board

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

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

-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
16 Replies
3,150 Views
arisav
Contributor III

HI

Now sound is working :smileyhappy:

Problem was that original qcom,storm driver from kernel 4.4 tree did not adjust i2S bus to master mode and probably audmux was not set correctly. Many thanks to igorpadykov for tips and suggestions.

Problem was solved taking max98357a driver from kernel 4.4 and using imx-si476x.c driver file as example for codec link driver.

Ari

3,150 Views
arisinisalo
Contributor I

hei,

Would you Ari be willing to share the code you have for MAX98357a? I quess that MAX98357a driver is the one directly from the existing tree but the qcom storm driver and needed bindings for device tree and build instructions are what I need.

I am facing same issue now and would be thankful if I could share your implementation.

br AriS

0 Kudos
3,150 Views
arisav
Contributor III

Hi Ari Sinisalo

Check attached zip file. There you can find three files. Files are

- sound.dts (This is device tree source which combines actual sound card driver and codec. Also sets SSI bus to master mode)

- imx-pt10ex.c (sound card driver)

- max98357a.c (codec)

We are using modified kernel 3.14.28 and these files are extracted directly from kernel tree. You have to also create kernel Makefile changes accordingly

Best Regards

Ari Savolainen

0 Kudos
3,148 Views
eoin_oconnell
Contributor I

I tried to follow your instructions, I am using the same amplifier but its on the imx7, this is the error I get:

[ 2.043559] imx-pt10ex-audio sound1: imx_pt10ex2_probe called.
[ 2.050896] imx-pt10ex-audio sound1: int_port set to value 1
[ 2.057974] imx-pt10ex-audio sound1: ext-port set to value 3
[ 2.065091] imx-pt10ex-audio sound1: Platform device disabled. i2c not used by sound card
[ 2.075958] imx-pt10ex-audio sound1: ASoC: CODEC DAI max98357a not registered
[ 2.084525] imx-pt10ex-audio sound1: Failed to register card: -517

My device tree file looks like this now:

<p>/ {
   codec_mono: max98357a@0 {
   compatible = "maxim,max98357a";
   #sound-dai-cells = <0>;
   };

   sound1 {
   compatible = "pt,pt10ex-audio";
   pt,model = "pt10ex";
   ssi-controller = <&sai2>;
   codec = <&codec_mono>;
   };

};

&sai2 {
fsl,mode = "i2s-master";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai2>;
assigned-clocks = <&clks IMX7D_SAI2_ROOT_SRC>,
<&clks IMX7D_SAI2_ROOT_CLK>;
assigned-clock-parents = <&clks IMX7D_PLL_AUDIO_POST_DIV>;
assigned-clock-rates = <0>, <36864000>;
status = "okay";

};</p>

Do you have any ideas?

0 Kudos
3,148 Views
arisav
Contributor III

It seems that max98357a codec is not loaded. Check that driver is built with kernel or has built as module

0 Kudos
3,149 Views
arisav
Contributor III

Hi

We are struggling with this case still. aplay -D hw:0,0 <some file> works fine but there is no sound. Data is not sended to SSI bus. That is verified with oscilloscope from LRCLK, BCLK and SDATA pins.

ALSA drivers is debug traced so they seems to work OK, so fsl_ssi / AUDMUX is probable not working. Is there some sample DTS settings for SSI1 as master config available somewhere so we can check our own config?

0 Kudos
3,153 Views
igorpadykov
NXP TechSupport
NXP TechSupport

Hi Ari

one can follow steps described in attached Porting Guide

Chapter 8 Porting Audio Codecs to a Custom Board

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

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

-----------------------------------------------------------------------------------------------------------------------

0 Kudos
3,149 Views
arisav
Contributor III

igorpadykov kirjoitti:

Hi Ari

one can follow steps described in attached Porting Guide

Chapter 8 Porting Audio Codecs to a Custom Board

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

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

-----------------------------------------------------------------------------------------------------------------------

I found drivers from kernel 4.4 tree for Maxim 98357a , so now I have alsa device in kernel. Files which was adapted and edited was max98357a.c and storm.c

So now we have

  • CPU DAI fsl-ssi
  • CODEC DAI max98357a (from kernel 4.4)
  • DAI LINK Driver imx-pt10ex (from kernel 4.4 storm.c and edited acoordingly)

I created dts bindings also so now there is alsa device in /proc/asound/cards

900001:~# cat /proc/asound/cards

0 [pt10ex         ]: pt10ex - pt10ex

                      pt10ex

1 [imxhdmisoc     ]: imx-hdmi-soc - imx-hdmi-soc

                      imx-hdmi-soc

And drivers gets loaded normally

900001:~# dmesg | grep 'max\|pt10ex\|ssi'

imx-sdma 20ec000.sdma: no iram assigned, using external mem

max98357a:max98357a_platform_probe

fsl_ssi:fsl_ssi_probe OK

pt10ex-audio:pt10ex_parse_of OK

max98357a:max98357a_codec_probe OK

pt10ex-audio sound.29: HiFi <-> 2028000.ssi mapping ok

pt10ex-audio:pt10ex_platform_probe OK, ret=0, name=pt10ex, Long name=(null), dev->init_name=(null)

  #0: pt10ex

pt10ex-audio: pt10ex_ops_hw_params OK

For some reason there is no sound when I try to test card.

900001:~# aplay -f S16_LE  -Dhw:0,0 /dev/urandom

Playing raw data '/dev/urandom' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono

Aborted by signal Interrupt...

Can I debug trace SSI bus somehow in kernel side so I can find that data is sended to max98357a codec?

Ari

0 Kudos
3,150 Views
igorpadykov
NXP TechSupport
NXP TechSupport

also one can try unit-test:

mxc_ssi_test/

http://repository.timesys.com/buildsources/i/imx-test/imx-test-3.14.28-1.0.0/

or Chapter 28 attached Linux Manual, sect.28.5 Unit Test

Best regards

igor

3,149 Views
arisav
Contributor III

Hi

One more question:

Because Maxim 98357a codec acts as  slave for SSI do I have to congigure SSI1 somehow? We have have only activated SSI from device tree.

Ari

0 Kudos
3,149 Views
igorpadykov
NXP TechSupport
NXP TechSupport
0 Kudos
3,149 Views
arisav
Contributor III

Thanks for your quick reply. Is there any quick way to test new hardware before developing driver? For example

cat /dev/urandom > /dev/SSI1

or something like that?

0 Kudos
3,150 Views
felipeneira
Contributor I

Hi Ari,

If you want to test the MAX98357A you can order a Evaluation Kit from our website

MAX98357DEV#WLP Evaluation System for the MAX98357A and MAX98357B (WLP) - Maxim

Otherwise, you can generate a I2S or TDM sample signal from you microprocessor unit and make sure you follow the datasheet voltage requirements for the MAX98357A PCM Input Class D Audio Power Amplifiers - Maxim

I hope this helps!

- Felipe

0 Kudos
3,150 Views
arisav
Contributor III

Hi Felipe

We have used your evaluation kit already and that is OK. Max98357A takes i2s or TDM data and question is how can we offer it from Linux system.

0 Kudos
3,151 Views
saurabh206
Senior Contributor III

aplay /dev/urandom

0 Kudos
3,151 Views
arisav
Contributor III

You cannot use aplay /dev/urandom if you do not have alsa driver yet.

0 Kudos