TX1 config for I2S

Hello,

I use the TX1 and have an ALC5639 module now.
I want to connect it by I2S.
But when I connect I2S with ALC5639 and play some music,
no sound signal was found.
Do anyone know how to config the TX1 with I2S?
Thanks a lot.

Hi IH,
Please refer to the post
https://devtalk.nvidia.com/default/topic/985516/jetson-tx1/acl5639-audio-codec-on-tx1/post/5145533/#5145533

Hello,

Do you know any way to forward sound data to I2S without codec?
We want to test the I2S as loopback, then without codec we want find a way to send signal to I2S directly.
Is it possible?
Thanks a lot.

Hi IsaHuang, for I2S loopback, is it a valid usecase, or for test only?

Please try

$ amixer -c 1 sset "ADMAIF2 Mux" "ADMAIF1"
$ amixer -c 1 sset "I2S1 Mux" "ADMAIF1"
$ aplay -Dhw:1,0 test_stereo_44100Hz_16bit_PCM.wav & arecord -D hw:1,1 -c 2 -d 5 -r 44100 -f S16_LE loopback_recording_test.wav

Hello DaneLLL,

I want to use it for test only.
It can record a loopback_recording_test.wav file by using the commands you provided.
But I doubt no matter I connect the SDIN & SDOUT or not, the file can be generated normally.
Is it correct for loopback test?
Thanks a lot.

Yes, it is correct for loopback test.
The setting for routing to rt5639 is like:
https://devtalk.nvidia.com/default/topic/985516/jetson-tx1/acl5639-audio-codec-on-tx1/post/5049189/#5049189

Hello DaneLLL,

We will use Realtek ALC5672 for audio codec now and had connected it via i2c & i2s pins to TX1 board.
Would you give me some hints about how to modify the dts file?
Thanks a lot.

Please refer to [Tegra ASoC Driver] in
https://developer.nvidia.com/embedded/dlc/l4t-documentation-24-2-1

Hi, Dane

I want to implement similar case, where I have i2s input/output without codec. This thread on forum did it for tk1. https://devtalk.nvidia.com/default/topic/961507/?comment=5018096
For TX1, Do I need to implement same machine driver and dummy codec as well? or there are existing driver/codec can do the work?

thanks
Xiaoyong

Hi xiaoyongtijee,
It the loopback case good for you?

amixer -c 1 sset "ADMAIF2 Mux" "ADMAIF1" // set the source of ADMAIF2 Mux as ADMAIF1
amixer -c 1 sset "I2S1 Mux" "ADMAIF1" // set the source of I2S1 Mux as ADMAIF1
aplay -Dhw:1,0 test_stereo_44100Hz_16bit_PCM.wav // play a wav file to ADMAIF1
arecord -D hw:1,1 -c 2 -d 5 -r 44100 -f S16_LE loopback_recording_test.wav // record audio from ADMAIF2 Mux

It is from the post https://devtalk.nvidia.com/default/topic/960938/jetson-tx1/configure-tegra-asoc-driver-for-custom-hardware-with-ti-audio-codec/post/4986602/#4986602

Hi, Dane

Is this I2S1 loopback or ADMAIF1 loopback? These commands works fine and I can save wave through ADMAIF2, but I’m not sure how is it loopback in I2S?
I see below in the i2s codec driver, but I’m completely new in dealing with alsa soc system so haven’t get much idea on how to change it. Any pointer would be really appreciated.

static const struct snd_kcontrol_new tegra210_i2s_controls = {
SOC_SINGLE_EXT(“Loopback”, SND_SOC_NOPM, 0, 1, 0,
tegra210_i2s_loopback_get, tegra210_i2s_loopback_put),
SOC_ENUM_EXT(“input bit format”, tegra210_i2s_format_enum,
tegra210_i2s_get_format, tegra210_i2s_put_format),
SOC_ENUM_EXT(“codec bit format”, tegra210_i2s_format_enum,
tegra210_i2s_get_format, tegra210_i2s_put_format),
};

thanks
xiaoyong

Learned a little more about amixer and I found I can change the I2S setting using it.
amixer controls | grep I2S1

numid=287, iface=MIXER, name=‘I2S1 Loopback’
amixer cset numid=287 1
amixer -c 1 sset “I2S1 Mux” “ADMAIF1”
amixer -c 1 sset “ADMAIF2 Mux” “I2S1”

after this I can play to ADMAIF1 and record on ADMAIF2 and get same audio.

Who can help me?

You can add or modify your sound card definition in your device tree file as below and it will use a dummy codec for codec dai. after that, do
amixer -c 1 sset “ADMAIF2 Mux” “ADMAIF1” // set the source of ADMAIF2 Mux as ADMAIF1
amixer -c 1 sset “I2S1 Mux” “ADMAIF1” // set the source of I2S1 Mux as ADMAIF1
aplay -Dhw:1,0 test_stereo_44100Hz_16bit_PCM.wav // play a wav file to ADMAIF1

this should send ADMAIF1 to I2S1

sound_card: sound {
	compatible = "nvidia,tegra-audio-t210ref-mobile-rt565x";
	nvidia,model = "tegra-snd-t210ref-mobile-rt565x";

	nvidia,num-codec-link = <1>;

	nvidia,audio-routing =
	  "x Headphone Jack", "x HPO L Playback",
	  "x Headphone Jack", "x HPO R Playback",
	  "x MICBIAS1",   "x Mic Jack",
	  "x IN1P",   "x Mic Jack",
	  "x Mic Det Power",  "x Mic Jack",
	  "x Int Spk",    "x SPO Playback",
	  "x DMIC L1",            "x Int Mic",
	  "x DMIC L2",            "x Int Mic",
	  "x DMIC R1",            "x Int Mic",
	  "x DMIC R2",            "x Int Mic",
	  "x Headphone",    "x OUT",
	  "x IN",     "x Mic",
	  "y Headphone",    "y OUT",
	  "y IN",     "y Mic",
	  "l IN",     "l OUT",
	  "s Headphone",    "s OUT",
	  "s IN",     "s Mic";

	nvidia,xbar = <&tegra_axbar>;

	/* The codec-dai here is initialized to dummy and will be   */
	/* replaced with rt565x codec-dai on detecting super-module */
	nvidia,dai-link-1 {
	  link-name = "rt565x-playback";
	  cpu-dai = <&tegra_i2s1>;
	  codec-dai = <&spdif_dit4>;
	  cpu-dai-name = "I2S1";
	  codec-dai-name = "dit-hifi";
	  format = "i2s";
	  bitclock-master;
	  frame-master;
	  bitclock-noninversion;
	  frame-noninversion;
          bit-format = "s16_le";
	  bclk_ratio = <0>;
	  srate = <48000>;
	  num-channel = <2>;
	  ignore_suspend;
	  name-prefix = "x";
	};

}

Hello Dane,

Now we change the audio codec to ALC5645,
I see it has the audio codec driver in sound/soc/tegra/tegra_rt5645.c,
would you give me some hints for how to modify the device tree file to enable it?
Thanks a lot.

Hi IsaHung,
If you are on r28.1 and the device is connected to I2S1, you need the patch below:
https://devtalk.nvidia.com/default/topic/1024422/jetson-tx1/rt5639-audio-routing-on-r28/post/5211969/#5211969

The driver is the default one in kernel 4.4. Ideally it should work, but we do not verify it because we don’t have the device.

Please check [Tegra ASoC Driver] in document.

we want to test the same I2S as loopback in tx2. what is the procedure to do that?

Hi vimalan.93,

Please file your issue with detials in TX2 forum - https://devtalk.nvidia.com/default/board/188/jetson-tx2/
We will support you through there.

Thanks

I have Jetson Tx1 development kit opened the box but not used. I had bought for a Project but the Project got cancelled. So I was not able to use this Kit. I am now selling this development kit of Rs 48000/-. (negotiable). Please contact me on email id as.k231216@gmail.com. You guys can call me or mail me for the recent pictures of the kit. It will be helpful if anyone needs it.