Jeston TX2 Devkit with TI Codec(AIC32x4)

Hi Community member,

Now I would like to add the audio codec to JetsonTX2 Devkit with Jestpack 3.2.1. But it could not work well with following links.
https://devtalk.nvidia.com/default/topic/1027508/jetson-tx2/tlv320aic32x4-evaluation-board-with-tx2
https://devtalk.nvidia.com/default/topic/1036139/jetson-tx2/tx2-asoc-with-tlv320aic32x4

Here is the way to do it.

  1. Get the kernel
    git clone https://github.com/jetsonhacks/buildJetsonTX2Kernel.git
    cd buildJetsonTX2Kernel
    sudo ./getKernelSources.sh

  2. Edit the following C files.
    usr/src/kernel/kernel-4.4/sound/soc/codecs/tlc320aic32x4.c
    usr/src/kernel/t18x/sound/soc/tegra-alt/tegra_t186ref_mobile_rt565x.c
    usr/src/kernel/kernel-4.4/sound/soc/tegra-alt/tegra_asoc_utils_alt.c

  3. Edit the tegra186-quill-common.dtsi like below.


    i2c@3160000 {
    status = “okay”;
    aic32x4: tlv320aic32x4.1-0018@18 {
    compatible = “ti,tlv320aic32x4”;
    status = “okay”;
    reg = <0x18>;
    clocks = <&tegra_car TEGRA186_CLK_AUD_MCLK>;
    clock-names = “mclk”;
    };
    --------
    tegra_sound: sound {
    compatible = “nvidia,tegra-audio-t186ref-mobile-rt565x”;
    nvidia,model = “tegra-snd-t186ref-mobile-rt565x”;
    nvidia,num-codec-link = <13>;
    nvidia,num-clk = <8>;
    nvidia,clk-rates = < 270950400 /* PLLA_x11025_RATE /
    11289600 /
    AUD_MCLK_x11025_RATE /
    45158400 /
    PLLA_OUT0_x11025_RATE /
    45158400 /
    AHUB_x11025_RATE /
    245760000 /
    PLLA_x8000_RATE /
    12288000 /
    AUD_MCLK_x8000_RATE /
    49152000 /
    PLLA_OUT0_x8000_RATE /
    49152000 >;/
    AHUB_x8000_RATE */
    clocks = <&tegra_car TEGRA186_CLK_PLLP_OUT0>,
    <&tegra_car TEGRA186_CLK_PLLA>,
    <&tegra_car TEGRA186_CLK_PLL_A_OUT0>,
    <&tegra_car TEGRA186_CLK_AHUB>,
    <&tegra_car TEGRA186_CLK_CLK_M>,
    <&tegra_car TEGRA186_CLK_AUD_MCLK>;
    clock-names = “pll_p_out1”, “pll_a”, “pll_a_out0”, “ahub”,
    “clk_m”, “extern1”;
    resets = <&tegra_car TEGRA186_RESET_AUD_MCLK>;
    reset-names = “extern1_rst”;

    status = "okay";
    nvidia,audio-routing =
    	"z IN1_L",		"z IN",				
    	"z IN1_R",		"z IN", 			
    	"z OUT",		"z LOL",			
    	"z OUT",		"z LOR";
    nvidia,xbar = <&tegra_axbar>;
    
    rt565x_dai_link: nvidia,dai-link-1 {
    	link-name = "rt565x-playback";
    	cpu-dai = <&tegra_i2s2>;
    	codec-dai = <&spdif_dit0>;
    	cpu-dai-name = "I2S2";
    	codec-dai-name = "dit-hifi";
    	format = "i2s";
    	bitclock-slave;
    	frame-slave;
    	bitclock-noninversion;
    	frame-noninversion;
    	bit-format = "s16_le";
    	bclk_ratio = <0>;
    	srate = <48000>;
    	num-channel = <2>;
    	ignore_suspend;
    	name-prefix = "x";
    	status = "okay";
    };
    nvidia,dai-link-2 {
    	link-name = "ti-capture";
    	cpu-dai = <&tegra_i2s1>;
    	codec-dai = <&aic32x4>;
    	cpu-dai-name = "I2S1";
    	codec-dai-name = "tlv320aic32x4-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 = "z";
    	status = "okay";
    };
    nvidia,dai-link-3 {
    	link-name = "spdif-dit-2";
    	cpu-dai = <&tegra_i2s3>;
    	codec-dai = <&spdif_dit2>;
    	cpu-dai-name = "I2S3";
    	codec-dai-name = "dit-hifi";
    	format = "i2s";
    	bitclock-slave;
    	frame-slave;
    	bitclock-noninversion;
    	frame-noninversion;
    	bit-format = "s16_le";
    	bclk_ratio = <1>;
    	srate = <48000>;
    	num-channel = <2>;
    	ignore_suspend;
    	name-prefix = "d3";
    	status = "okay";
    };
    nvidia,dai-link-4 {
    	link-name = "spdif-dit-3";
      ----------------
    

  4. Build the kernel and copy the Image
    sudo ./makeKernel.sh
    sudo ./copyImage.sh

  5. Copy some the device tree files at “/usr/src/kernel/kernel-4.4/arch/arm64/boot/dts” directory to the “<JETPACK_DIR>/64_TX2/Linux_for_Tegra/kenel/dtb” at Host PC
    DTB files

    • tegra186-quill-p3310-1000-c03-00-base.dtb
    • tegra186-quill-p3310-1000-a00-00-base.dtb
    • tegra186-quill-p3310-1000-c03-00-dsi-hdmi-dp.dtb
    • tegra186-quill-p3489-1000-a00-00-ucm1.dtb
    • tegra186-quill-p3489-1000-a00-00-ucm2.dtb
  6. Enter the recovery mode

  7. Flash the dtb files.
    sudo ./flash.sh -r -k kernel-dtb jetson-tx2 mmcblk0p1

But the codecs is listed the I2C bit not list at “/sys/kernel/debug/asoc/codecs”.
So, would you please teach me your kind advice?

If you have any questions, please let me know.
Best regards.
Kaka
tegra_t186ref_mobile_rt565x.c (33.4 KB)
tlv320aic32x4.c (26 KB)
tegra_asoc_utils_alt.c (15.1 KB)
boot_log.txt (64.7 KB)
tegra186-quill-common.dtsi.txt (35.7 KB)

Please have a check error from tegra_t186ref_mobile_rt565x.c to find the error to fixed it.

[    3.785044] tegra-snd-t186ref-mobile-rt565x sound: ASoC: CODEC DAI tlv320aic32x4-hifi not registered
[    3.785048] tegra-snd-t186ref-mobile-rt565x sound: snd_soc_register_card failed (-517)

Hi

Thank you for your response.
Could you please check my tegra_t186ref_mobile_rt565x.c file?

Best regards.
Kaka
tegra_t186ref_mobile_rt565x.c (33.4 KB)

Could you please help us?

Best regards.
Kaka