Jetson orin nx aplay -D wav file speaker can't work

when I use jetson orin nx APE sound card to aplay with tas5805m codec , and the audio can be played normally and exit but the speaker could not sound and output this log :

[20:08:09:772] [ 2137.643751] tegra-asoc: sound: tegra-codec rtd: (null)␍␊
[20:08:09:772] [ 2137.643774] tegra-asoc: sound: tegra-codec numcodec: 1␍␊
[20:08:09:772] [ 2137.643779] tegra-asoc: sound: tas5805 pcm runtime␍␊
[20:08:09:772] [ 2137.643873] bandwidth:176␍␊
[20:08:09:772] [ 2137.643878] rate:44100␍␊
[20:08:09:772] [ 2137.643879] channels:2␍␊
[20:08:09:772] [ 2137.643881] sample_bytes:2␍␊
[20:08:09:772] [ 2137.643882] before icc_path_handle␍␊
**[20:08:09:772] [ 2137.644107] bwmgr req failed for 37**

␍
I don't know what's mean for bwmgr req failed for 37 and what part would make this problem, I could not find error when I checked my device tree and codec driver code.
Please give me some suggest. 
Here my code txt 
[tegra234-p3767-common-audio.dtsi|attachment](upload://6NgOZn8ShDZOH8Kae76Vtiz5gpX.dtsi) (8.2 KB)
[tegra_codecs.c|attachment](upload://1NjzyuUg4C3aCrKjVXFdSVb0aKT.c) (8.2 KB)

[tas5805m.c|attachment](upload://7bHpxAqtE25uQZgLH6nSaU7uY2y.c) (13.4 KB)
[tas5805m.h|attachment](upload://iYSTiBQAR5YBYfWKm2sgZGoAXsi.h) (401 Bytes)

Hi chenzijie1,

Welcome to the Jetson Developer Forum!

The error print does not seem to be related. However, please re-attach the attachments to help check further. Current, I am unable to access.

What do you mean when you say audio played normally but speaker does not sound? Do you mean aplay runs but you don’t hear sound.

Please share the mixer control settings if you have used any and the JP version you used for testing

Regards

Now problem is aplay runs but don’t hear sound.
And I didn’ have mixer control settings , I just run aplay when I add codec–“ti tas5805m”, a smart PA.
but when I run and don’t hear sound and output this log like this:
[16:15:31:128] [ 2008.321197] bwmgr req failed for 37␍␊
[16:15:31:128] [ 2008.321201] bw name: apedma␍␊

Locate here in the code:
tegra23x_icc.c line 249
static int tegra23x_icc_set(struct icc_node *src, struct icc_node *dst)

sum_bw = get_bw(&bwmgr_req, TEGRA_ICC_NONE);
	if (sum_bw || (tp->rate != tp->min_rate)) {
		/* bwmgr MRQ */
		bwmgr_req.cmd = CMD_BWMGR_CALC_RATE;
		memset(&tp->msg, 0, sizeof(struct tegra_bpmp_message));
		tp->msg.mrq = MRQ_BWMGR;
		tp->msg.tx.data = &bwmgr_req;
		tp->msg.tx.size = sizeof(bwmgr_req);
		tp->msg.rx.data = &bwmgr_resp;
		tp->msg.rx.size = sizeof(bwmgr_resp);

		ret = tegra_bpmp_transfer(tp->bpmp_dev, &tp->msg);
		if (ret < 0) {
			return ret;
		} else if (tp->msg.rx.ret < 0) {
			pr_err("bwmgr req failed for %d\n", src->id);
			printk("bw name: %s",src->name);
			return -EINVAL;
		}
	}

I think this error occurred in when audio set bandwidth but I think my driver code and device tree is OK, so I don’t know what’wrong with this problem

Hi chenzijie1,

I don’t suspect the bwmgr request failure obstructing audio. But before confirming, could you share the dapm path trace during playback through instruction from here. This gives an idea if some path is left from setup and breaking audio playback path

Also, share the attachmnets of codec driver, DTS and other code changes

Regards

Here is dapm path trace and my codec driver, DTS and other code I changes,
I don’t know whether you can see that ,but I upload in here.
tas5805_trace.txt (11.5 KB)

tas5805m.c (13.4 KB)

Beacuse I just can upload 1 file in 1 comment , may feel not good , so I am sorry about this .
tegra234-p3767-common-audio.dtsi (8.4 KB)

tas5805m.h (401 Bytes)

tegra_codecs.c (8.2 KB)

I found the problem maybe is routing or widgets wrong, here trace_pipe for play:

           aplay-980     [002] .......  1025.290678: snd_soc_dapm_path: *ADMAIF1 XBAR-RX <- (direct) <- ADMAIF1 XBAR-Playback
           aplay-980     [002] .......  1025.290894: snd_soc_dapm_path: *I2S2 Mux <- ADMAIF1 <- ADMAIF1 XBAR-RX
           aplay-980     [002] .......  1025.290896: snd_soc_dapm_path: *I2S2 XBAR-TX <- (direct) <- I2S2 Mux
           aplay-980     [002] .......  1025.290898: snd_soc_dapm_path: *I2S2 XBAR-Capture <- (direct) <- I2S2 XBAR-TX
           aplay-980     [002] .......  1025.290903: snd_soc_dapm_path: *tegra-dlink-65-playback <- (direct) <- I2S2 XBAR-Capture
           aplay-980     [002] .......  1025.290905: snd_soc_dapm_path: *I2S2 CIF-Playback <- (direct) <- tegra-dlink-65-playback
           aplay-980     [002] .......  1025.290910: snd_soc_dapm_path: *I2S2 RX <- (direct) <- I2S2 CIF-Playback
           aplay-980     [002] .......  1025.290912: snd_soc_dapm_path: *I2S2 DAP-Capture <- (direct) <- I2S2 RX
           aplay-980     [002] .......  1025.290914: snd_soc_dapm_path: *tas5805m-codec-playback <- (direct) <- I2S2 DAP-Capture
           aplay-980     [002] .......  1025.290918: snd_soc_dapm_path: *ti Playback <- (direct) <- tas5805m-codec-playback
           aplay-980     [002] .......  1025.290920: snd_soc_dapm_path: *ti OUT <- (direct) <- ti Playback
           aplay-980     [002] .......  1025.290921: snd_soc_dapm_path: *ti Playback <- (direct) <- ti OUT

Can you give me some suggets for it to debug or have some samples can help, thanks!

Hi chenzijie1,

Apologies for delayed reply. Are you seeing “Master Playback Volume” control in the amixer controls. You can attach o/p of “amixer -c 1 contents” to check if its available. Could set it to higher volume and try playback once.

I am referring the driver from Linux v6.5-rc1 - sound/soc/codecs/tas5805m.c as you seem to have attached only the i2c driver. Also, why is your driver different from the above driver? Can you get suitable driver from codec vendor for the K5.10 if needed.

Hope you have altered widgets and routes in your DT suitably
ex: nvidia-audio-card,widgets =
“Line”, “ti Line Out”;

nvidia-audio-card,routing =
“ti Line Out”, “ti OUT”;

If still facing issue, put prints in codec driver and see if required function calls in the codec are being executed.

Also, do share o/p of “cat /sys/kernel/debug/asoc/components”

Thanks

Here is o/p of " cat /sys/kernel/debug/asoc/components"

root@apollo-nx:~# cat /sys/kernel/debug/asoc/components
2902600.sfc
2902400.sfc
2902200.sfc
2902000.sfc
2908000.ope
290a200.mvc
290a000.mvc
290bb00.amixer
290e000.iqc
2901500.i2s
2901400.i2s
2901300.i2s
2901200.i2s
2901100.i2s
2901000.i2s
2904300.dmic
2904200.dmic
2904100.dmic
2904000.dmic
2903300.amx
2903200.amx
2903100.amx
2903000.amx
2905100.dspk
2905000.dspk
290e400.arad
2910000.asrc
2907500.afc
2907400.afc
2907300.afc
2907200.afc
2907100.afc
2907000.afc
2903b00.adx
2903a00.adx
2903900.adx
2903800.adx
290f000.admaif
2900800.ahub
tegra210-adsp
tas5805m.1-002c
snd-soc-dummy
snd-soc-dummy

because this device is a smart PA and I used OK in AGX orin with same code.
I put prints in code and find when I aplay would print dev->init_name is null , I don’t know witch place make it ,or it‘s just like this.

rtd = get_pcm_runtime(card, "tas5805m-codec");
		dev_err(card->dev,"tegra-codec rtd: %s",rtd->dev->init_name);
		dev_err(card->dev,"tegra-codec numcodec: %d",rtd->num_codecs);
		
		if (rtd) {
		dev_err(card->dev, "tas5805 pcm runtime\n");
		dai_params =
		(struct snd_soc_pcm_stream *)rtd->dai_link->params;
		}

[15:17:05:173] [  343.702168] tegra-asoc: sound: tegra-codec rtd: (null)␍␊
[15:17:05:173] [  343.702200] tegra-asoc: sound: tegra-codec numcodec: 1␍␊
[15:17:05:173] [  343.702203] tegra-asoc: sound: tas5805 pcm runtime␍␊

Hi chenziie1,

Do you mean with same code(JP version + Orin Audio DT change to integrate tas5805m), playback is fine? Then you may have to test the pinmux setting of I2S2

Refer link and ensure pinmux is set or set explicitly with Jetson-IO tool if not done already.

Thanks

This way I already test, it’s same both AGX and orin nx, and I tested I2S2 SCLK , LRCK and DATA signal on the oscilloscope when running aplay like this:


Y → SCLK
B → LRCLK
last one → DATA/SDOUT

The DATA/SDOUT signal is wrong, look like have data out but is not normal

Hi chenzijie,

Routing and codec registration seems fine. Did you try playing around with Master Playback Volume mixer setting?

Thanks

Didn’t try playing around with Master Playback Volume mixer setting?
Is that amixer -c ?

Hi,

It should be accessible through

amixer -c 1 cset name=“ti Master Playback Volume” <value>

If not, share o/p of “amixer -c 1 contents”

Thanks

Hi:
I checked register for volume and found it didn’t be setted mute, and I try amixer also could not hear sound , it’s same problem log out . I didn’t know whether is my routing wrong make this.
Here are my new change in code, and check I2S2 in hdr40 pinmux register setting
Memory mapped at address 0xffffb0d88000.
Read at address 0x02434088 (0xffffb0d88088): 0x00001445
root@apollo-nx:~# devmem2 0x2434090
/dev/mem opened.
Memory mapped at address 0xffff8cb37000.
Read at address 0x02434090 (0xffff8cb37090): 0x00000405
root@apollo-nx:~# devmem2 0x2434098
/dev/mem opened.
Memory mapped at address 0xffff9ce84000.
Read at address 0x02434098 (0xffff9ce84098): 0x00001455
root@apollo-nx:~# devmem2 0x24340a0
/dev/mem opened.
Memory mapped at address 0xffff9d872000.
Read at address 0x024340A0 (0xffff9d8720a0): 0x00001445

tegra234-p3767-common-audio.dtsi (8.1 KB)

tas5805m.c (14.7 KB)

Hi,

Apologies for delayed reply. Kindly check volume setting through the provided mixer control as suggested in my earlier comment. Also share o/p of amixer -c 1 contents.

Pinmux, DT and audio route looks fine

I2S2_SCLK(0x02434088) = 0x00001445
I2S2_DOUT(0x02434090) = 0x00000405
I2S2_DIN(0x02434098) = 0x00001455
I2S2_FS(0x024340a0) = 0x00001445

Have a few more queries. Request you to answer each of them inline

  1. For how long is the aplay running and what is the duration of the waveform. Also share the waveform you are playing

  2. As clocks and trace are fine, doubt if DOUT connection has some issue. Could you not connect just the DOUT line to codec and probe that while retaining FS and BCLK connections to codec

if 2 cannot be tried you could loopback DOUT to DIN (i.e connect) and start arecord as well to observe data is fine so that we can ensure there is no issue with Jetson I2S

  1. Also, if possible run the usecase on Orin as you said its working fine and compare DAPM trace once

Thanks