TLV320AIC3204 Driver will support for AGX Orin 64GB SOM?

Hello Sameer,

Thanks for your reply,

Yes, the audio codec will be a slave device and Orin dev is the master I2S.
As you suggested I did those changes in DT but the output is the same as above comments.

DT changes are now.


        i2c@c250000 {
                fsync-width = <0>;
                aic32x4: tlv320aic32x4.1-0018@18 {
                        compatible = "ti,tlv320aic32x4";
                        status = "okay";
                        reg = <0x18>;
                        clocks = <&bpmp TEGRA234_CLK_AUD_MCLK>;
                        clock-names = "mclk";
                        dv-supply = <&battery_reg>;
                        av-supply = <&battery_reg>;
                        iov-supply = <&battery_reg>;
                        sound-name-prefix = "TI-TLV320";
                        #sound-dai-cells = <1>;
                };
        };

        clocks {
                aic32x4_mclk: aic32x4_mclk {
                        compatible = "fixed-clock";
                        #clock-cells = <0>;
                        clock-frequency = <12288000>;
                        clock-output-names = "aic32x4-mclk";
                        status = "okay";
                };
        };
......
        tegra_sound: sound {
                status = "okay";
                compatible = "nvidia,tegra186-ape";
                nvidia-audio-card,name = "NVIDIA Jetson AGX Orin APE";
                clocks = <&bpmp_clks TEGRA234_CLK_PLLA>,
                         <&bpmp_clks TEGRA234_CLK_PLLA_OUT0>,
                         <&bpmp_clks TEGRA234_CLK_AUD_MCLK>;
                clock-names = "pll_a", "pll_a_out0", "extern1";
                assigned-clocks = <&bpmp_clks TEGRA234_CLK_AUD_MCLK>;
                assigned-clock-parents = <&bpmp_clks TEGRA234_CLK_PLLA_OUT0>;
                        nvidia-audio-card,widgets =
                                "Headphone",    "TI-TLV320 Headphone",
                                //"Microphone",   "TI-TLV320 Mic",
                                "Line",         "TI-TLV320 Line In",
                                "Line",         "TI-TLV320 Line Out";

                        nvidia-audio-card,routing =
                                "TI-TLV320 Headphone", "TI-TLV320 LOL",
                                "TI-TLV320 Headphone", "TI-TLV320 LOR",
                                "TI-TLV320 Headphone", "TI-TLV320 HPL",
                                "TI-TLV320 Headphone", "TI-TLV320 HPR",
                                "TI-TLV320 Left DAC", "TI-TLV320 Playback",
                                "TI-TLV320 Right DAC", "TI-TLV320 Playback",
                                 "TI-TLV320 Capture", "TI-TLV320 Left ADC",
                                "TI-TLV320 Capture", "TI-TLV320 Right ADC";
                        nvidia-audio-card,mclk-fs = <256>;
                       ......

hdr40_snd_link_i2s: &i2s2_to_codec {
        link-name = "ti-capture";
        //bitclock-master;
        //frame-master;
        codec {
                sound-dai = <&aic32x4 0>;
                prefix = "TI-TLV320";
        };
};

We would be grateful for any assistance.

Thanks,
Parashuram

Just to confirm, aplay exits immediately?
You still don’t see clock transition after configuring Tegra I2S as producer?
Can you please share kernel logs when you are running playback?

I have added bitclock and frame as slave in DT.

hdr40_snd_link_i2s: &i2s2_to_codec {
        link-name = "ti-capture";
        bitclock-slave;
        frame-slave;  
        codec {
                sound-dai = <&aic32x4 0>;
                prefix = "TI-TLV320";
        };
};

No, aplay is exits once the audio duration reached.

No, I didn’t any transition in I2S lanes.

Please find tha attached kernel log.
dmesg.log (81.7 KB)

Thanks,
Parashuram

Hello Sameer,

I’m not sure what these below-mentioned messages in the dmesg log are.

ALSA: Control name 'TI-TLV320 DAC Left Playback PowerTune Switch' truncated to 'TI-TLV320 DAC Left Playback PowerTune Switc'
...

I didn’t get the APE codec name in the cards list.

I’d appreciate it if you could tell me how to listen to sound from a codec. If there are any code changes, please let us know.

Regards,
Parashuram

This is probably because the control name is overflowing.
Please use a smaller prefix instead of “TI-TLV320”. Check with something like “TLV”.

This is fine, you won’t see codec name in the cards list.
In your codec driver, you can put prints in hw_params() to confirm that the call happens whenever you run aplay.

This means there is no clock issue.

I don’t think these are necessary.

I am not sure what else you are missing. The playback runs for required duration and I expect no pinmux problem. So I expect the clocks to be seen. What are the pins you are probing?

Hello Sameer,

I probed I2S fs_clk, mclk, sclk, and dout while running the aplay command (aplay -D hw:APE,1 test.wav). however, there is no transition In any lanes.
sclk ->yellow
mclk ->blue
fs_clk ->pink
Dout ->green

for your reference please find the attached logs.
dmesg.log (78.3 KB)
mixer.sh (1.4 KB)
mixer_output.txt (4.0 KB)

Thanks,
Parashuram

Did you confirm this?

It has following amixer errors…,
amixer: Cannot find the given element from control hw:1
amixer: Cannot find the given element from control hw:1
amixer: Cannot find the given element from control hw:1
amixer: Cannot find the given element from control hw:1
amixer: Cannot find the given element from control hw:1
amixer: Cannot find the given element from control hw:1

You may have to fix few control settings.

Can you confirm if the codec is connected to Tegra I2S2? Please share schematics of the connection.
Also please probe the signals without codec connection. Sometimes the codec board can affect the signals. When you do this testing, you have to disable the codec path in DT.

Changes are made in the machine driver Linux_for_Tegra/sources/kernel/nvidia/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver.c file is not reflected on the board. Even though I purposely created some syntax errors, it didn’t through any errors while compiling. I asked this question in the forum and the guy responded is redirected to this post.

@@ -263,12 +274,15 @@ static int tegra_machine_pcm_hw_params(struct snd_pcm_substream *substream,
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_soc_card *card = rtd->card;
        int err;
+        printk("aic32x4: codec test\n");
 
        err = tegra_machine_dai_init(rtd, params_rate(params),
                                     params_channels(params),
                                     1ULL << params_format(params));
        if (err < 0) {
                dev_err(card->dev, "Failed dai init\n");
+                printk(KERN_ERR "aic32x4: codec error\n");
+                printk("aic32x4: codec error2\n");
                return err;
        }

I believe that any changes made to the machine driver file for the codec have no effect on the codec or board.

Yes, For Tegra I2S2 is connected to the audio codec. Here IS2-> I2S2
Please find the attached schematic of codec



same codec and schematic I worked with jetson tx2i Jetpack 4.3 last year and it was successfully worked you can have look at it here

I disconnected the Tegra I2S2 lanes from the codec and tested the pins 7 mclk, 35 fsck, 12 sclk, and 40 dout in the Orin dev kit 40 Pin header, but there is no signal in any of the pins.

Thanks,
Parashuram

You are making changes in wrong place.
Please refer Audio Setup and Development — Jetson Linux Developer Guide documentation to edit the right machine driver.

As per the schematic, the “AUDIO_I2S” label points to I2S1_xxx. It seems like you are using Tegra I2S1. You may have used I2S2 on TX2, but don’t assume it will be the case on AGX Orin too. Please cross check on this.

If indeed you are using I2S1, then you need to update your DT bindings accordingly for I2S1 usage. Also update amixer commands to use I2S1 and then check.

Hello Sameer,

As we used the same path for Tx2i, we assumed that it might be the same way here.
Thanks for correcting me.

I’ve done the necessary changes after following the audio setup and development wiki.
however, the problem remains the same.
I’m using the Tegra I2S2 and am sure that the hardware is fine.
aplay command it works fine and I can see that APE in /proc/asound/cards.
I have probed the I2S pins and still, there is no transition in any pins

Could you please let me know, and please see the attached git diff for the audio codec’s updated changes
git_diff.txt (16.0 KB)
components.txt (886 Bytes)
dmesg.log (79.9 KB)

Thanks,
Parahsuram

Hello Sameer,

I added the printk message to the source files tegra codec.c and tegra machine driver.c. I didn’t see any added messages in kernel logs. Please find the modified files that are attached.
tegra_codecs.c.diff (2.9 KB)
tegra_machine_driver.c.diff (1.8 KB)
tlv320aic32x4.c.diff (2.0 KB)
Kconfig.dif (618 Bytes)
tegra234-p3737-audio.dtsi.diff (3.3 KB)

I got the probe error for the audio codec in the kernel log as shown below.

tlv320aic32x4: probe of 7-0018 failed with error -110

If I’m not mistaken, the I2S2 Mclk signal should come first when the codec starts.
I would be very grateful if you could tell us how to fix this.
dmesg.log (74.9 KB)
kern.log (224.8 KB)

Regards,
Parashuram

I guess you mean Tegra I2S1 here? Please use I2S1 reference to avoid more confusion.

what are the amixer commands you are using?

you need to add codec under I2S1 node.

+&i2s1_to_codec {
+        link-name = "ti-capture";
+        format = "dsp_a";
+
+        codec {
+            sound-dai = <&aic32x4 0>;
+            prefix = "tlv";
+        };
+};

I cannot comment on this as to why this fails. You need to check why it reports failure. This was working earlier, so review the changes you made.

Okay, Now I used Tegra I2S1.

amixer -c APE sset ‘ADMAIF2 Mux’ ‘I2S1’
amixer -c APE sset ‘I2S1 Mux’ ‘ADMAIF2’

amixer -c APE cset name=‘tlv Auto-mute Switch’ 0
amixer -c APE cset name=‘tlv HP DAC Playback Switch’ 1
amixer -c APE cset name=‘tlv HP Driver Gain Volume’ 0
amixer -c APE cset name=‘tlv HPL Output Mixer IN1_L Switch’ 0
amixer -c APE cset name=‘tlv HPR Output Mixer IN1_R Switch’ 0
amixer -c APE cset name=‘tlv HPL Output Mixer L_DAC Switch’ 1
amixer -c APE cset name=‘tlv HPR Output Mixer R_DAC Switch’ 1
amixer -c APE cset name=‘tlv LO DAC Playback Switch’ 1

Added I2S1 codec changes in DT.

Yes, the error got resolved.

There was no printk message in the kernel log, which I added in the source file.

while running the aplay command captured traces log please find.
I probed I2S lanes and there is no transition in any pins.

dmesg.log (78.6 KB)
kern.log (109.2 KB)
components.txt (886 Bytes)
dt.log (491.3 KB)
traces.txt (9.7 KB)

Regards,
Parashuram

Traces look fine as I can see the DAPM path include your audio codec as well.
It also has I2S2 in the path. I think you still have it connected in the path. Please disconnect I2S2 path as you are not using it with following command:

amixer -c APE cset name="I2S2 Mux" "None"

Even with above I was expecting you would see clock transitions on the I2S1.
I believe aplay is running for required duration for you and the configuration looks good to me. Please double check your probe points and check if you can measure this as close as possible to the SOM to rule out any platform issues. The signals would be available only when the audio session is running.

Hello Sameer,

Thanks for your reply,

I’m working on I2S1 hardware modifications and will get back to you once I’m done with it.

Reagrds,
Parashuram

Hi Parashuram,

Is this still an issue to support? Any result can be shared? Thanks

Hello Kayccc,

I appreciate your response.
A carrier card is having some problems, and work is being done to fix it. I’ll get back to you in a couple of days.

Thanks,
Parashuram

Hello Team,

I have switched the BSP from the previous L4T package R35.1 to the latest R35.3.1. I’m Integrating the Audio Codec changes and will update you on the audio codec results.

Regards,
Parashuram

Hello,

I received the board and resumed work on the audio codec, and I will give a summary next week.

Regards,
Parashuram

Sorry for the late response, have you managed to get issue resolved or still need the support? Thanks