I2S codec die not register in NX

Hello team,

I have one custom device based on Nvidia jetson xavier NX. I need to check I2S interface. We are using 40 pin connector for this. I tired below changes in
in driver and device tree file. I am mentioning the changes of dts file here.

hdr40_i2c1: i2c@31e0000 {
pinctrl-names = “default”;
pinctrl-0 = <&dpaux_default>;

    #size-cells = <0>;
    #address-cells = <1>;
    ssm2518: ssm2518@34 {
        compatible = "adi,ssm2518";
            reg = <0x34>;
            gpios = <&tegra_main_gpio TEGRA194_MAIN_GPIO(Q, 1) GPIO_ACTIVE_HIGH>;
            status = "okay";
    };

};

tegra_sound: sound {
status = “okay”;
compatible = “nvidia,tegra-audio-t186ref-mobile-rt565x”;
nvidia,model = “jetson-xaviernx-ape”;
nvidia,num-codec-link = <2>;
clocks = <&bpmp_clks TEGRA194_CLK_PLLA>,
<&bpmp_clks TEGRA194_CLK_PLLA_OUT0>,
<&bpmp_clks TEGRA194_CLK_AUD_MCLK>;
clock-names = “pll_a”, “pll_a_out0”, “extern1”;
assigned-clocks = <&bpmp_clks TEGRA194_CLK_PLLA_OUT0>,
<&bpmp_clks TEGRA194_CLK_AUD_MCLK>;
assigned-clock-parents = <&bpmp_clks TEGRA194_CLK_PLLA>,
<&bpmp_clks TEGRA194_CLK_PLLA_OUT0>;

    nvidia,audio-routing =
              "x Headphone",          "x OUT",
                  "x IN",                 "x Mic",
                  "y Headphone",          "y OUT",
                  "y IN",                 "y Mic",
                  "z Headphone",          "z OUT",
                  "z IN",                 "z Mic",
                  "m Headphone",          "m OUT",
                  "m IN",                 "m Mic",
                  "n Headphone",          "n OUT",
                  "n IN",                 "n Mic",
                  "o Headphone",          "o OUT",
                  "o IN",                 "o Mic",
                  "a IN",                 "a Mic",
                  "b IN",                 "b Mic",
                  "c IN",                 "c Mic",
                  "d IN",                 "d Mic",
                  "d1 Headphone",         "d1 OUT",
                  "d2 Headphone",         "d2 OUT";

mclk-fs = <256>;
    nvidia,dai-link-1 {
        name-prefix = "n";
    };
    hdr40_snd_link_i2s: nvidia,dai-link-1 {
	name-prefix = "x";
};

    ssm2518_snd_link_i2s: nvidia,dai-link-5 {
        link-name = "ssm2518-codec";
            cpu-dai = <&tegra_i2s5>;
            codec-dai = <&ssm2518>;
            cpu-dai-name = "I2S5";
            codec-dai-name = "ssm2518";
            format = "i2s";
            bitclock-slave;
            frame-slave;
            bitclock-noninversion;
            bit-format = "s16_le";
            srate = <48000>;
            num-channel = <2>;
            bclk_ratio = <1>;
            ignore_suspend;
            name-prefix = "x";
            status = "okay";
};

};

Can you please check once with this changes. we put our kernel driver on kernel-4.9/sound/soc/codec directory.
Linux_for_Tegra/source/public/kernel/kernel-4.9/sound/soc/codecs/ssm2518.c
Linux_for_Tegra/source/public/kernel/kernel-4.9/sound/soc/codecs/ssm2518.h
Made require changes related to SSM2518 in below files:
Linux_for_Tegra/source/public/kernel/kernel-4.9/sound/soc/codecs/Kconfig
Linux_for_Tegra/source/public/kernel/kernel-4.9/sound/soc/codecs/Makefile
sound/soc/tegra-alt/Kconfig

Whenever I am tring to detect sound card, it will give the below error:
" [ 6.453753] tegra-asoc: sound: ASoC: CODEC DAI ssm2518 not registered
[ 6.453968] tegra-asoc: sound: snd_soc_register_card failed (-517)
"
I had added the debug logs for the same. It if failed in “soc_bind_dai_link” API, it will check the list of registered codecs.

Also I had checked the codec list:
nx@nx-desktop:~$ sudo cat /sys/kernel/debug/asoc/codecs
[sudo] password for nx:
ssm2518.8-0034
tegra186-dspk.1
tegra186-dspk.0
tegra186-asrc
tegra186-arad
tegra210-ope.0
tegra210-mvc.1
tegra210-mvc.0
tegra186-afc.5
tegra186-afc.4
tegra186-afc.3
tegra186-afc.2
tegra186-afc.1
tegra186-afc.0
tegra210-sfc.3
tegra210-sfc.2
tegra210-sfc.1
tegra210-sfc.0
tegra210-mixer
tegra210-adx.3
tegra210-adx.2
tegra210-adx.1
tegra210-adx.0
tegra210-amx.3
tegra210-amx.2
tegra210-amx.1
tegra210-amx.0
tegra210-dmic.3
tegra210-dmic.2
tegra210-dmic.1
tegra210-dmic.0
tegra210-i2s.5
tegra210-i2s.4
tegra210-i2s.3
tegra210-i2s.2
tegra210-i2s.1
tegra210-i2s.0
tegra186-admaif
tegra210-axbar
spdif_dit:spdif-dit.13@d
spdif_dit:spdif-dit.12@c
spdif_dit:spdif-dit.11@b
spdif_dit:spdif-dit.10@a
spdif_dit:spdif-dit.9@9
spdif_dit:spdif-dit.8@8
spdif_dit:spdif-dit.7@7
spdif_dit:spdif-dit.6@6
spdif_dit:spdif-dit.5@5
spdif_dit:spdif-dit.4@4
spdif_dit:spdif-dit.3@3
spdif_dit:spdif-dit.2@2
spdif_dit:spdif-dit.1@1
spdif_dit:spdif-dit.0@0
snd-soc-dummy
nx@nx-desktop:~$

I2C detect logs:

nx@nx-desktop:~$ i2cdetect -y -a -r 8
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – – – – – – – – – – – – – – – –
10: – – – – – – – – – – – – – – – –
20: – – – – – – – – – – – – – – – –
30: – – – – UU – – – – – – – – – – –
40: – – – – – – – – – – – – – – – –
50: – – – – – – – – – – – – – – – –
60: – – – – – – – – – – – – – – – –
70: – – – – – – – – – – – – – – – –
nx@nx-desktop:~$

I2C device is detected properly and read/write operation is also working fine. I validated with one more change like, executeing below command for enable
I2S5 interface and reboot the device, but not getting success.
$ sudo /opt/nvidia/jetson-io/config-by-function.py -o dtbo i2s5

Can you please help us to resolve this issue asap, as we have to give release on urgent basis.

Thanks and regards
Harsh

Have you checked below Troubleshooting section at the NVIDIA Jetson Linux Driver Package Software Features : Audio Setup and Development | NVIDIA Docs ?

Hello,

I am clarifying our connections of I2S and I2C for 40-pin connector. I am using SSM2518 I2S codec. I connected I2C line to nx devkit 40-pin connector I2C0 interface and I connected I2S line to the I2S1 pins which is mentioned in below image.

I2S-pins

I made below changes in device tree file:
File : tegra194-audio-p3668.dtsi
changes in tegra_sound: sound node for codec dai configurations:

hdr40_snd_link_i2s: nvidia,dai-link-5 {
name-prefix = “x”;
link-name = “ssm2518-codec”;
codec-dai = <&ssm2518>;
codec-dai-name = “ssm2518”;
};

I2C related changes:
i2c@c240000{
ssm2518: ssm2518@34 {
compatible = “adi,ssm2518”;
reg = <0x34>;
gpios = <&tegra_main_gpio TEGRA194_MAIN_GPIO(Q, 1) GPIO_ACTIVE_LOW>;
};
};

I also updated the sound asoc driver: I am attaching the patch for our changes related to ssm2518.
patch : nvidia-asoc-driver-changes-ssm2518.patch
nvidia-asoc-driver-changes-ssm2518.patch (10.3 KB)

Once I updated the image with this latest configurations, I am facing same issue as above.
"tegra-asoc: sound: ASoC: CODEC DAI ssm2518 not registered"

We tried below cases:

  1. Using enabled i2s5 using below commands:
    $ sudo /opt/nvidia/jetson-io/config-by-function.py -o dtbo i2s5
    $ fdtoverlay -i <current_kernel.dtb> -o <new_kernel.dtb> <overlay.dtbo>
    Result will be same

  2. Codec device is detected on I2C bus, we checked it without loading ssm2518 driver and we are able to read and write device registers.

  3. Updated I2C0 to I2C1, and made changes in device tree file but facing same issue.

  4. Verified this attached link : NVIDIA Jetson Linux Driver Package Software Features : Audio Setup and Development | NVIDIA Docs but not able to solve.

Can you please check the attached device tree configuration and our patch and please let us know which configuration I missed in driver or device tree.

Thank You.

Hello,

One update in this thread is like, we are now able to detect MCLK of 12.3 MHZ. But if I made setup as bitclock-master and frame-master in dai configurations, it gives below error:
ASoC: Failed to set DAI format: -22

I verified here, this error is coming on particular codec(SSM2518) which we have connected. Can you please help us to resolve this issue?

We are configuring NX SOM as a master device and codec as slave device.

Thanks and regards
Harsh

Hello,

Our next experiment is like, we have to configure the codec as a slave device and xavier NX SOM as a master device. All the required clocks are generating from the xavier NX SOM only and from codec side, it will only receive the clocks and data.

For that configurations, we updated the HDR40_pin header in dts file, and set all the pins direction as output. But still we are not able to get any clocks (BCLK and WCLK). MCLK is generating properly.

So can you please help me out to get those clocks? Do we require to do any changes in tegra ASOC driver?

Thanks and regards

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.