Pinmux adjustments for audio codec

Hi,

I have a customized carrier board for Xavier NX Production module.
With L4T R32.4.2, I want to adjust pinmux for an audio codec as below:

  1. I2C: Pin [189, 191]. Customer Usage I2C9_CLK and I2C9_DAT. Leave it as used to be.
  2. I2S: Pin [199, 193, 195, 197]. Customer Usage I2S5_SCLK, I2S5_SDATA_OUT, I2S5_SDATA_IN, I2S5_LRCK.
  3. AUD_MCLK: Pin 211. Customer Usage AUD_MCLK.

I have done:

  1. Download Jetson Xavier NX Pinmux Table, and follow Pinmux Changes.
  2. Update new tegra19x-mb1-pinmux-p3668-a01.cfg
  3. sudo ./flash.sh p3449-0000+p3668-0001-qspi-emmc mmcblk0p1

diff --git a/bootloader/t186ref/BCT/tegra19x-mb1-pinmux-p3668-a01.cfg b/bootloader/t186ref/BCT/tegra19x-mb1-pinmux-p3668-a01.cfg
index 16ed9aa…3e65e4b 100644
— a/bootloader/t186ref/BCT/tegra19x-mb1-pinmux-p3668-a01.cfg
+++ b/bootloader/t186ref/BCT/tegra19x-mb1-pinmux-p3668-a01.cfg
@@ -1,26 +1,16 @@
##
## PLEASE DO NOT EDIT THIS FILE
## This is autogenerated file using the script pinmux-dts2cfg.py
##
pinmux.major = 1;
pinmux.minor = 0;
#### Pinmux for gpio-input pins ####
-pinmux.0x02213680 = 0x00000001; # CONFIG S4
-pinmux.0x02431020 = 0x00000000; # GPIO aud_mclk_ps4
pinmux.0x022136e0 = 0x00000001; # CONFIG S7
pinmux.0x02431008 = 0x00000000; # GPIO soc_gpio32_ps7
-pinmux.0x022138a0 = 0x00000001; # CONFIG T5
-pinmux.0x02431080 = 0x00000000; # GPIO dap5_sclk_pt5
-pinmux.0x022138c0 = 0x00000001; # CONFIG T6
-pinmux.0x02431078 = 0x00000000; # GPIO dap5_dout_pt6
-pinmux.0x022138e0 = 0x00000001; # CONFIG T7
-pinmux.0x02431070 = 0x00000000; # GPIO dap5_din_pt7
-pinmux.0x02213a00 = 0x00000001; # CONFIG U0
-pinmux.0x02431068 = 0x00000000; # GPIO dap5_fs_pu0
pinmux.0x02214000 = 0x00000001; # CONFIG G0
pinmux.0x02434058 = 0x00000000; # GPIO soc_gpio00_pg0
pinmux.0x02214080 = 0x00000001; # CONFIG G4
@@ -125,10 +115,15 @@ pinmux.0x0c2f1230 = 0x00000001; # OUTPUT CC1
pinmux.0x0c302050 = 0x00000000; # GPIO spi2_miso_pcc1

#### Pinmux for used pins ####
+pinmux.0x02431020 = 0x00000400; # aud_mclk_ps4: aud, tristate-disable, input-disable, lpdr-disable
pinmux.0x02431060 = 0x00000440; # dap3_sclk_pt1: i2s3, tristate-disable, input-enable, lpdr-disable
pinmux.0x02431058 = 0x00000400; # dap3_dout_pt2: i2s3, tristate-disable, input-disable, lpdr-disable
pinmux.0x02431050 = 0x00000450; # dap3_din_pt3: i2s3, tristate-enable, input-enable, lpdr-disable
pinmux.0x02431048 = 0x00000440; # dap3_fs_pt4: i2s3, tristate-disable, input-enable, lpdr-disable
+pinmux.0x02431080 = 0x00000440; # dap5_sclk_pt5: i2s5, tristate-disable, input-enable, lpdr-disable
+pinmux.0x02431078 = 0x00000400; # dap5_dout_pt6: i2s5, tristate-disable, input-disable, lpdr-disable
+pinmux.0x02431070 = 0x00000450; # dap5_din_pt7: i2s5, tristate-enable, input-enable, lpdr-disable
+pinmux.0x02431068 = 0x00000440; # dap5_fs_pu0: i2s5, tristate-disable, input-enable, lpdr-disable
pinmux.0x02438000 = 0x0000a460; # sdmmc1_clk_pj0: sdmmc1, tristate-disable, input-enable, loopback-enable
pinmux.0x02438008 = 0x0000a448; # sdmmc1_cmd_pj1: sdmmc1, pull-up, tristate-disable, input-enable
pinmux.0x02438030 = 0x0000a448; # sdmmc1_dat0_pj2: sdmmc1, pull-up, tristate-disable, input-enable
@@ -207,12 +202,7 @@ pinmux.0x02437050 = 0x00000520; # pex_l4_rst_n_pl1: pe4, tristate-disable, input
pinmux.0x02440030 = 0x00000450; # dp_aux_ch0_hpd_pm0: dp, tristate-enable, input-enable, io_high_voltage-disable, lpdr-disable
pinmux.0x02440038 = 0x00000450; # dp_aux_ch1_hpd_pm1: dp, tristate-enable, input-enable, io_high_voltage-disable, lpdr-disable
pinmux.0x02440050 = 0x00000460; # hdmi_cec_pm4: hdmi, tristate-disable, input-enable, io_high_voltage-enable, lpdr-disable
-pinmux.0x02431020 = 0x00000059; # aud_mclk_ps4: rsvd1, pull-up, tristate-enable, input-enable, lpdr-disable
pinmux.0x02431008 = 0x00000058; # soc_gpio32_ps7: rsvd0, pull-up, tristate-enable, input-enable, lpdr-disable
-pinmux.0x02431080 = 0x00000056; # dap5_sclk_pt5: rsvd2, pull-down, tristate-enable, input-enable, lpdr-disable
-pinmux.0x02431078 = 0x00000056; # dap5_dout_pt6: rsvd2, pull-down, tristate-enable, input-enable, lpdr-disable
-pinmux.0x02431070 = 0x00000057; # dap5_din_pt7: rsvd3, pull-down, tristate-enable, input-enable, lpdr-disable
-pinmux.0x02431068 = 0x00000057; # dap5_fs_pu0: rsvd3, pull-down, tristate-enable, input-enable, lpdr-disable
pinmux.0x02434058 = 0x00000058; # soc_gpio00_pg0: rsvd0, pull-up, tristate-enable, input-enable, lpdr-disable
pinmux.0x02434048 = 0x00000000; # soc_gpio02_pg2: rsvd0, tristate-disable, input-disable, lpdr-disable
pinmux.0x02434070 = 0x00000050; # soc_gpio08_pg4: rsvd0, tristate-enable, input-enable, lpdr-disable

Then check:

~$ sudo cat /sys/kernel/debug/tegra_pinctrl_reg | grep dap5
Bank: 0 Reg: 0x02431068 Val: 0x00000440 -> dap5_fs_pu0
Bank: 0 Reg: 0x02431070 Val: 0x00000450 -> dap5_din_pt7
Bank: 0 Reg: 0x02431078 Val: 0x00000400 -> dap5_dout_pt6
Bank: 0 Reg: 0x02431080 Val: 0x00000440 -> dap5_sclk_pt5

~$ sudo cat /sys/kernel/debug/tegra_pinctrl_reg | grep aud
Bank: 0 Reg: 0x02431020 Val: 0x00000400 -> aud_mclk_ps4

~$ sudo grep “Port:|S:” /sys/kernel/debug/tegra_gpio
Port:Pin:ENB DBC IN OUT_CTRL OUT_VAL INT_CLR
S:0 0x0 0x0 0x0 0x1 0x0 0x0
S:1 0x0 0x0 0x0 0x1 0x0 0x0
S:2 0x0 0x0 0x0 0x1 0x0 0x0
S:3 0x0 0x0 0x0 0x1 0x0 0x0
S:4 0x0 0x0 0x0 0x1 0x0 0x0
S:5 0x0 0x0 0x0 0x1 0x0 0x0
S:6 0x0 0x0 0x0 0x1 0x0 0x0
S:7 0x1 0x0 0x0 0x1 0x0 0x0

But I still can not get aud_mclk signal.
Could someone please give me some hints? Thank you.

you can try to use jetson-io to enable the I2S5

Hello!

The configuration for the AUD_MCLK looks good. The AUD_MCLK is only active during audio playback/capture. Are you monitoring the AUD_MCLK during audio playback/capture?

You can check the status of the AUD_MCLK by …

$ sudo grep "enable_cnt\|aud_mclk" /sys/kernel/debug/clk/clk_summary

To start audio playback just …

$ speaker-test -D hw:jetsonxaviernxa,0 -c 2 -r 48000 -F S16_LE -t sine -f 500

Note that I believe that ‘jetsonxaviernxa’ is the soundcard name for NX. You can check by …

$ cat /proc/asound/cards

There will be two sound cards; one for HDA (HDMI/DP) and one for I2S, DMIC, etc.

Regards,
Jon

1 Like

Hi Jonathanh,

Thanks for your help!
I just forgot that AUD_MCLK is only active during audio playback/capture.
For now the audio works as I expected.

Hello!

Great! Thanks for confirming.

Jon