TLV320AIC32x4 evaluation board with TX2

hi,

I have summarized all that I’ve learnt during the above 243 messages thanks to jonathanh.
It took me quite a while to arrange the sources again and make sure that they actually are working for.
Anyone can use these modification hoping that NVidia will find the time to embed these modifications or others to support future uses who intend to use audio CODECs like the TLV320AIC32x4.

Assumptions:

  1. A remote PC was installed with Jetpack 3 (https://www.youtube.com/watch?v=D7lkth34rgM)
  2. The target Jetson TX2 is programmed with L4T 28.2.1 (by above Jetpack)
  3. the target Jetson TX2 is programmed with Kernel sources(https://www.jetsonhacks.com/2017/03/25/build-kernel-and-modules-nvidia-jetson-tx2/)

Procedure

  1. Apply the following :
    • Replace tegra186-quill-common.dtsi with /usr/src/hardware/nvidia/platform/t18x/common/kernel-dts/t18x-common-platforms/tegra186-quill-common.dtsi
    • Replace tlv320aic32x4.c with /usr/src/kernel/kernel-4.4/sound/soc/codecs/tlv320aic32x4.c
    • Replace tegra_asoc_utils_alt.c with /usr/src/kernel/kernel-4.4/sound/soc/tegra-alt/tegra_asoc_utils_alt.c
    • Replace Kconfig with /usr/src/kernel/kernel-4.4/sound/soc/codecs/Kconfig
    • Replace tegra18_defconfig with /usr/src/kernel/kernel-4.4/arch/arm64/configs/tegra18_defconfig
    • Replace tegra_t186ref_mobile_rt565x.c with /usr/src/kernel/t18x/sound/soc/tegra-alt/tegra_t186ref_mobile_rt565x.c
    • Replace Kconfig.t18x with /usr/src/kernel/t18x/sound/soc/tegra-alt/Kconfig.t18x

    Pay attention to the exact files’ path.
    Please do consider compare the attached files with the original files just to make sure that you are comfortable with these changes. Again these changes and the reasons are extensively depicted within this post (again a big thanks to jonathanh).


  2. Do not forget to remove the .txt extension
    I have also added a batch file which has to be positioned in a local directory with the source files (attached) and activate from with a terminal which pointing to the same directory.

  3. Enter the kernel configuration so one is able to select the tlv320aic32x4 driver from kernel (GUI) configuration.
    cd /usr/src/kernel/kernel-4.4
    sudo make xconfig
    

    Verify that the driver TLV320AIC32x4 driver is selected. CTRL+F to find the driver, one can see that the driver is selected, I do not know but I could not deselect it, maybe some other changes have to be applied to the configuration files.

  4. Compile the kernel, so all added files will take affect
    cd /home/nvidia/buildjetsontx2kernel
    sudo ./makeKernel.sh
    sudo ./copyImage.sh
    
  5. Compile Device Tree with the modified tegra186-quill-common.dtsi file
    cd /usr/src/kernel/kernel-4.4
    sudo make dtbs
    

    TX2: copy the file /usr/src/kernel/kernel-4.4/arch/arm64/boot/dts/tegra186-quill-p3310-1000-c03-00-base.dtb to a remote station for programming the Device Tree file.
    TX2i: copy the file /usr/src/kernel/kernel-4.4/arch/arm64/boot/dts/tegra186-quill-p3489-1000-a00-00-ucm1.dtb to a remote station for programming the Device Tree file.
    If someone wants to verify that the changes in tegra186-quill-common.dtsi were applied to the dtb file then de-compile the file (TX2: /usr/src/kernel/kernel-4.4/arch/arm64/boot/dts/tegra186-quill-p3310-1000-c03-00-base.dtb or TX2i: /usr/src/kernel/kernel-4.4/arch/arm64/boot/dts/tegra186-quill-p3489-1000-a00-00-ucm1.dtb[/b]) and look for the changes:
    TX2:

    /usr/bin/dtc -I dtb -O dts -o tegra186-quill-p3310-1000-c03-00-base.dts tegra186-quill-p3310-1000-c03-00-base.dtb
    

    TX2i:

    /usr/bin/dtc -I dtb -O dts -o tegra186-quill-p3489-1000-a00-00-ucm1.dts tegra186-quill-p3489-1000-a00-00-ucm1.dtb
    
  6. Program the Device Tree file from a Remote Machine (this way the Jetson will get to knwo that there is an I2C driver for the TLV320AIC32x4 and the sound configuration with all DAIs Replace new dtb file with TX2:JetPack/3.1/64_TX2/Linux_for_Tegra_64_tx2/kernel/dtb/tegra186-quill-p3310-1000-c03-00-base.dtb or TX2i:JetPack/3.1/64_TX2/Linux_for_Tegra_64_tx2/kernel/dtb/tegra186-quill-p3489-1000-a00-00-ucm1.dtb(please verify that the Jetpack was extracted to the above directory if not then modify the directory above.)
    sudo ./flash.sh -r -k kernel-dtb jetson-tx2 mmcblk0p1
    
  7. Reboot
  8. Watch the terminal via the RS232 and verify that there are no errors - I had none. It is time to connect the evaluation board of the TLV320AIC32x4 with the Jetson TX2 evaluation board. I have attached a connection table. DO NOT FORGET TO CONNECT A GND CABLE BETWEEN THE BOARDS - I used dedicated pins on connectors P22 on the TLV320AIC32x4 and J21 on the Jetson. Do not connect the MCLK - I experienced noises during playback.

    Connect analog input via Input jack (not headphones) and output to speakers.

    Activate the

    ./Record.sh
    

    script to record a file on the eMMC and then the

    ./Play.sh
    

    script to playback the recently recorded file.

    Igal

    tegra_asoc_utils_alt.c (14.9 KB)
    tegra_t186ref_mobile_rt565x.c (33.2 KB)
    tlv320aic32x4.c (27.9 KB)
    CopyAudioFiles.sh.txt (681 Bytes)
    Kconfig.t18x.txt (4.43 KB)
    Kconfig.txt (19.2 KB)
    tegra18_defconfig.txt (15.2 KB)
    tegra186-quill-common.dtsi.txt (35.9 KB)
    Play.sh.txt (1.68 KB)
    Record.sh.txt (1.7 KB)