I2S on IMX6 through SAI

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

I2S on IMX6 through SAI

3,379 Views
dperez1
Contributor I

Hi,

I have an imx6ull and I want to connect it to and FPGA. I need 4 audio channels so I'm going to use the 3 SAI ports and the SPDIF.

I have succesfully made the SPDIF conection adding the followings to the device tree: SPDIF - Pastebin.com 

I want to do the same thing for the I2S connection, but im not having any positive results. Here is what I got so far:

  1. sai@02028000 {
  2.     compatible = "fsl,imx6ul-sai", "fsl,imx6sx-sai";
  3.     reg = <0x2028000 0x4000>;
  4.     interrupts = <0x0 0x61 0x4>;
  5.     clocks = <0x1 0xb3 0x1 0x0 0x1 0xb2 0x1 0x0 0x1 0x0>;
  6.     clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3";
  7.     dma-names = "rx", "tx";
  8.     dmas = <0x8 0x23 0x18 0x0 0x8 0x24 0x18 0x0>;
  9.     status = "okay";
  10.     pinctrl-names = "default";
  11.     pinctrl-0 = <0x47>;
  12.     assigned-clocks = <0x1 0x46 0x1 0xb2>;
  13.     assigned-clock-parents = <0x1 0x32>;
  14.     assigned-clock-rates = <0x0 0x1770000>;
  15.     fsl,mode = "i2s-master";
  16.     linux,phandle = <0x44>;
  17.     phandle = <0x44>;
  18. };
  19. sai1grp {
  20.     fsl,pins = <0x120 0x3ac 0x5e8 0x8 0x0 0x17088
  21.         0x11c 0x3a8 0x5ec 0x8 0x0 0x17088
  22.         0x128 0x3b4 0x0 0x8 0x0 0x11088
  23.         0x124 0x3b0 0x5e4 0x8 0x0 0x11088
  24.         0x118 0x3a4 0x5e0 0x8 0x1 0x17088>;
  25.     linux,phandle = <0x47>;
  26.     phandle = <0x47>;
  27. };
  28. codec_test: codec_test {
  29.     compatible = "linux,snd-soc-dummy";
  30.     #sound-dai-cells = <0>;
  31.     status="okay";
  32. };
  33. sound-sai {
  34.     status = "okay";
  35.     compatible = "simple-audio-card";
  36.     simple-audio-card,name = "sound_sai";
  37.     simple-audio-card,format = "i2s";
  38.     simple-audio-card,frame-master = <&sound_sai_cpu>;
  39.     simple-audio-card,bitclock-master = <&sound_sai_cpu>;
  40.  
  41.     ound_sai_cpu: simple-audio-card,cpu {
  42.         sound-dai = <0x44>;
  43.         system-clock-frequency = <1536000>;
  44.         dai-tdm-slot-num = <8>;
  45.         dai-tdm-slot-width = <16>;
  46.     };
  47.                
  48.     sound_sai_codec: simple-audio-card,codec {
  49.         sound-dai = <&codec_test>;
  50.     };
  51. };

Using aplay -l only shows the SPDIF:

root@imx6ull:~# aplay -l

**** List of PLAYBACK Hardware Devices ****

card 0: imxspdif [imx-spdif], device 0: S/PDIF PCM snd-soc-dummy-dai-0 []

Subdevices: 1/1

Subdevice #0: subdevice #0

In the boot messages there is only information about the SPDIF. No error or anything about SAI. 

[ 2.093160] imx-spdif sound-spdif: snd-soc-dummy-dai <-> 2004000.spdif mapping ok

[ 2.310174] ALSA device list:

[ 2.311849] #0: imx-spdif

I have also tried applying this patch (https://patchwork.kernel.org/patch/7679391/) but the results are the same.

Labels (4)
0 Kudos
3 Replies

2,200 Views
igorpadykov
NXP Employee
NXP Employee

Hi Daniel

i.MX6ULL EVK has wm8960 codec which works in i2s mode, its dts example :

linux/arch/arm/boot/dts/imx6ull-14x14-evk.dts

imx6ull-14x14-evk.dts\dts\boot\arm\arch - linux-imx - i.MX Linux kernel 

latest nxp linux L4.14.78

linux-imx - i.MX Linux kernel 

Linux Documentation:

i.MX Software | NXP 

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

0 Kudos

2,200 Views
dperez1
Contributor I

Hi Igor,

I know that it has that codec, I had it working with SAI2 interface. However, I dont want to use the wm8960 codec to send audio to some speaker or headphones. I need to use the SAI (I2S) interfaces to transfer the digital audio to an FPGA. I don't think I need any codec for that, I just need to connect the 3 pins of I2S (SYNC, BCLK and DATA) to the same 3 pins on an FPGA. Isn't that possible?

Best regards,

Dani

0 Kudos

2,200 Views
igorpadykov
NXP Employee
NXP Employee

Hi Dani

yes this is possible in similar way as in "simple-audio-card" configuration

i.MX7Dual + SGTL5000 no data on SAI output 

I.MX6ULL has similar sai as i.MX7.

Best regards
igor

0 Kudos