Dual Audio cards configuration

Hello,

In one of my on going project I am using Jetson Xavier NX custom board and I was dealing with two audio devices through I2S interface.
The one is WM8960 which is connected to I2S0 (I2S5) port .
Other one is TC358743 which is connected to I2S1 (I2S3) port.
I2S0(I2S5)port is configured as master port because WM8960 is slave codec where as I2S1(I2S3) port is configured as slave port because TC358743 is master.

When I was making changes in DTSI only for TC358743 and consider I2S3 port as slave I can able to capture audio.
When I was add DTSI changes for WM8960 and configure it with few alsa command I can able to capture WM8960 but I can’t able to capture TC358743 audio.
DTSI changes for WM8960 are attached in file.
Please guide me how can I capture both the sound input from both the ports?
audio.dtsi (3.6 KB)

Hi rusurya,
I believe individually you are able to use both codec for capture, but when both used simultaneously you are hitting with issue. I need below info to further help on this issue.

  1. DTS files used for individual configuration of codecs which worked.
  2. Combined DTS file change made to test both at same time which not worked.
  3. Mixer controls used for the testing.

Hello,

Thanks a lot for reply.

 DTSI changes for WM8960 I have already shared.
Please find the attached DTSI file for TC358743 changes.
When I was dealing with TC358743 for capturing audio we are not making changes in audio file. I just configured I2S3 port as slave only by giving following mixer command

amixer -c jetsonxaviernxa cset name=“I2S3 codec master mode” “cbm-cfm”

and for recording I gave following command

arecord -D hw:jetsonxaviernxa,1 -c 2 -r 48000 -f S16_LE check1.wav

XavierNX_tc358743.dtsi (7.5 KB)

While dealing with WM8960 following mixer commands I used.

alsactl init jetsonxaviernxa
amixer -c jetsonxaviernxa cset name=“I2S5 Mux” “ADMAIF1”
amixer -c jetsonxaviernxa cset name=“x Left Output Mixer PCM Playback Switch” on
amixer -c jetsonxaviernxa cset name=“x Right Output Mixer PCM Playback Switch” on
amixer -c jetsonxaviernxa cset name=“x Headphone Playback Volume” 200
amixer -c jetsonxaviernxa cset name=“ADMAIF1 Mux” “I2S5”
amixer -c jetsonxaviernxa cset name=“x Capture Switch” on
amixer -c jetsonxaviernxa cset name=“x Capture Volume” 200
amixer -c jetsonxaviernxa cset name=“x Capture Volume ZC Switch” on
amixer -c jetsonxaviernxa cset name=“x Left Input Mixer Boost Switch” on
amixer -c jetsonxaviernxa cset name=“x Left Input Mixer Boost Switch” 200
amixer -c jetsonxaviernxa cset name=“x Right Boost Mixer RINPUT1 Switch” on
amixer -c jetsonxaviernxa cset name=“x Right Boost Mixer RINPUT2 Switch” on
amixer -c jetsonxaviernxa cset name=“x Right Boost Mixer RINPUT3 Switch” on
amixer -c jetsonxaviernxa cset name=“x Right Input Boost Mixer RINPUT1 Volume” 100
amixer -c jetsonxaviernxa cset name=“x Right Input Boost Mixer RINPUT2 Volume” 100
amixer -c jetsonxaviernxa cset name=“x Right Input Boost Mixer RINPUT3 Volume” 100

for recording I used following command

arecord -D hw:jetsonxaviernxa,0 -c 1 -r 48000 -f S16_LE check2.wav

I can able to record sound as well as able to play sound on WM8960.
But I cant able to record TC358743 audio data.

Please find the attached DTS where I configured DTB
for WM8960 as well as TC358743.

ch1.dts (234.8 KB)

Hi rusurya,
From your input, I assume the TC358743 codec sends I2S clock and capture data continuously in Codec Master mode as soon as codec registered with I2C?. Only based on this assumption could make your command work, please correct me if otherwise on what basis codec sends data. This can’t be from Tegra side trigger as we don’t have any codec dai linked.

Also confirm below commands are used too.
amixer -c jetsonxaviernxa cset name=“I2S3 Mux” “ADMAIF2”
amixer -c jetsonxaviernxa cset name=“ADMAIF2 Mux” “Ï2S3”

What is the behavior of arecord when things not working, is there any error thrown in log?.

Hello,

Thanks a lot for reply.
I tried above given commands after configuring I2S3 as a slave.
But gives a pcm_read:2103 error. (please check attachment)


As soon as we introduce module for WM8960 our TC358743 codec capture is not working.
Shall we need to add audio related changes of TC358743 in audio DTSI file?
Please guide me on this.

Hi rusurya,
As per your earlier comment, I understand there is no DTS change required for TC358743 codec to work. One thing you need to clear is, how TC358743 codec clock starts without any DTS entry?. Does it starts sending clock immediately after power on of codec?. Can you able to probe the signals.

If the TC358743 worked without any DTS earlier, it is not expected to add anything extra with WM8960 codec. The I2S of both codec are different. So I don’t expect any issue unless there any common stuff involving between two codec.

Hello,

Thanks a lot for reply.
 As I have attached DTSI file for TC358743, it consist of only I2C and CSI related configuration , basically it consist of video related changes only.
There is no audio related changes in DTSI.
 As TC358743 work as master codec so it generate SCLK, LRCLK and SDATA signals, we need to configure I2S port of som in slave mode. 
As soon as I insert TC358743 kernel module its start giving output.
I can able to capture audio data from shared video by following command

arecord -D hw:jetsonxaviernxa,1 -c 2 -r 48000 -f S16_LE -d 5 a1.wav
Generally TC358743 consider audio channel -D hw:jetsonxaviernxa,1.

But as soon as I introduce WM8960 DTSI changes and insert its kernel module , TC358743 capturing stopped and I am getting error on above command.

WM8960 capturing done by following command

arecord -D hw:jetsonxaviernxa,0 -c 2 -r 48000 -f S16_LE -d 5 a2.wav
Please guide me on this.

Hello,
I will try to probe the signals of TC358743.
But one thing I am realise now that , here we are dealing with two separate audio codecs means we need to define two separate sound cards for them.
As per observation when first I introduce the TC358743 kernel module it works but when I introduce WM8960 kernel module then WM8960 codec work but TC358743 codec stop recording.
This indicate that when there is nothing define in device tree TC358743 take default audio sound card that why its recording works.
But when I make changes for WM8960 then WM8960 module acquire default sound card and it start working but then TC358743 not getting any sound card because of that its not getting any audio channel for recording.
I checked arecord -l list it shows 19 channels only.
But we cant able to distinguish them which one is for WM8960 and which one is for TC358743.
I think I need to make changes in audio dtsi for WM8960 as well as TC358743.
Can you please give me some reference on, how can I define two sound cards by making audio dtsi changes?

Hi rusurya,
We don’t actually need two sound card for two codec, both can co-exist on same card as I2Sx are different for both. As TC358743 doesn’t have any DTS entries, only factor it could be effected is through mixer control reset due to some flow during your other codec initialization.

Can you help in dumping the log with # amixer -c jetsonxaviernxa contents

I would like to check if ADMAIF mixer path for both codec are set properly during initialization. Take it for all scenarios.

Hello,

Thanks a lot for reply.
Please check attached signal images of TC358743 I2S3 output.
As we are using SCLK,LRCLK and SDIN only but I attached MCLK signal image also.





Also please find the attached log file of jetsonxaviernxa contents
amixercontentdump.txt (295.9 KB)
We are trying to capture HDMI in audio but we are getting
pcm_read;2103 : read error: Input/Output error.

Hi rusurya,
Thanks for the dump info, I see I2S5 is connected to ADMAIF1 and I2S3 to ADMAIF2. So arecord command used was perfectly fine.

From the signal probe snap, LRCK is 46.7KHz (~1.3KHz difference from 48KHz) and SCLK is 3.04MHz, if “arecord -D hw:jetsonxaviernxa,1 -c 2 -r 48000 -f S16_LE -d 5 a1.wav” was working without WM8960 changes, it is expected to work with WM8960 changes too as the capture on I2S3 should not be effected by any change on I2S5 as both are different interfaces.

May be as last resort, just check the DAPM dump info on I2S3 path to confirm DAPM paths are fine and also share the dmesg log with WM8960 changes.

Hello,

Please check below logs.
I took log of all dmesg , only WM8960 related log and DAPM log.
DAPM_log.txt (1.3 KB)
alldmesg.txt (62.2 KB)
onlyWMdmesg.txt (721 Bytes)

One more thing I want to mention here that generally in normal DTS setting when we gave arecord -l command to display device list and we get following list
arecordlist.txt (2.7 KB)
But when I made DTSI changes for WM89860 and boot the SOM unless I insert kernel module for WM8960 I won’t get arecord device list.

When I was searching on forum regarding TC358743 interface, I got following link

Here they are trying to pass through TC358743 audio capture from one port and send it to other codec which connected to other I2S port.
There they got some patch which suppose to be added in soc-base.dtsi.
I think we also need to do modification either in audio dtsi or soc-base dtsi file. Still I am trying find more reference on this.
If you have some reference then please let me know.

Hi rusurya,
The DAPM log doesn’t have any useful info, I believe you have not ran the aplay/arecord command after running the dapm commands. The DAPM logs will pop up only when audio usecase starts.

Seeing below errors on dmesg log, does sound card shows up after this log?.

[ 9.970165] tegra-asoc: sound: ASoC: CODEC DAI wm8960-hifi not registered
[ 9.979737] tegra-asoc: sound: ASoC: CODEC DAI wm8960-hifi not registered
[ 9.987729] tegra-asoc: sound: ASoC: CODEC DAI wm8960-hifi not registered
[ 446.283746] wm8960: loading out-of-tree module taints kernel."

But when I made DTSI changes for WM89860 and boot the SOM unless I insert kernel module for WM8960 I won’t get arecord device list.
Is sound card registered in this case # cat /proc/asound/cards

The last point regarding I2S1 and I2S4 is not relevant for this case. In your case I2S3 clocks are coming from external codec and configuring Jetson I2S3 in slave mode which is already done should help in capture. This is working without WM8960 changes.

Can you provide me the actual dtsi files changed compared to the reference files in the bsp. What you provided me earlier is output of DTB to DTS. I need actual changes made with WM8960 on dtsi.

Hello mkumard,

Sorry for my lack of knowledge.
I was trying to take DAPM dump , so as per shown in above link I gave following command

for i in find /sys/kernel/debug/tracing/events -name "enable" | grep snd_soc_; do echo 1 > $i; done

and after that I gave this command

cat /sys/kernel/debug/tracing/trace_pipe | grep *

Is it suppose to be do like this ? please correct me if I am doing some thing wrong.

Secondly I check cat/proc/asound/cards our card get registered.
Please check the attachment
cardcheck.txt (3.0 KB)

Please check attached reference audio dtsi and wm8960 configured dtsi.
tegra194-audio-p3668.dtsi_wmchg.txt (2.4 KB)
tegra194-audio-p3668.dtsi_default.txt (2.1 KB)
Do you want actual DTB?
If you need more details please let me know.

Hi rusurya,
To get DAPM dump info, need to execute aplay/arecord after the command "cat /sys/kernel/debug/tracing/trace_pipe | grep * " in background.

I believe got the issue. Can you replace the below change for nvidia,audio-routing

nvidia,audio-routing =
“x Headphone”, “x HP_L”,
“x Headphone”, “x HP_R”,
“x LINPUT1”, “x Mic”,
“x LINPUT3”, “x Mic”,
“x RINPUT1”, “x Mic”,
“x RINPUT2”, “x Mic”,
“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”;

Hello mkumard,

I made this changes in dtsi and both the codec working.

Now I can able to record both the audio channels input.
Thanks a lot for support.
This is really helpful for my project.

Thanks,
rusurya

Hi rusurya,
You’re welcome and Good luck for your project.

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