TLV320AIC32x4 evaluation board with TX2

Oh I see it here …

I think that the key thing to understand here is …

“Once I fixed that, the audio path became very clear, and a few mixer settings completed the route (the CODEC disabled all output by default)”

So yes probably just a few key codec mixer settings we are missing.

Jon

Hi Igal,

I have reviewed the AIC32x4 setup from the TI TLV320AIC3204 Application Reference Guide document [0]. Looking at the examples section I used the following as a basis, concentrating on the highlighted part which sets up the routing …

4.0.1 Stereo DAC Playback with 48ksps Sample Rate and High Performance.
Assumption
AVdd = 1.8V, DVdd = 1.8V
MCLK = 12.288MHz
Ext C = 47uF
Based on C the wait time will change.
Wait time = N*Rpop*C + 4* Offset ramp time
Default settings used.
PLL Disabled
DOSR 128
# Initialize to Page 0
w 30 00 00
# Initialize the device through software reset
w 30 01 01
# Power up the NDAC divider with value 1
w 30 0b 81
# Power up the MDAC divider with value 2
w 30 0c 82
# Program the OSR of DAC to 128
w 30 0d 00
w 30 0e 80
# Set the word length of Audio Interface to 20bits PTM_P4
w 30 1b 10
# Set the DAC Mode to PRB_P8
w 30 3c 08
# Select Page 1
w 30 00 01
# Disable Internal Crude AVdd in presence of external AVdd supply or before
#powering up internal AVdd LDO
w 30 01 08
# Enable Master Analog Power Control
w 30 02 00
# Set the REF charging time to 40ms
w 30 7b 01
# HP soft stepping settings for optimal pop performance at power up
# Rpop used is 6k with N = 6 and soft step = 20usec. This should work with 47uF coupling
# capacitor. Can try N=5,6 or 7 time constants as well. Trade-off delay vs “pop” sound.
w 30 14 25
# Set the Input Common Mode to 0.9V and Output Common Mode for Headphone to
# Input Common Mode
w 30 0a 00
[b]# Route Left DAC to HPL
w 30 0c 08
# Route Right DAC to HPR
w 30 0d 08[/b]
# Set the DAC PTM mode to PTM_P3/4
w 30 03 00
w 30 04 00
# Set the HPL gain to 0dB
w 30 10 00
# Set the HPR gain to 0dB
w 30 11 00
[b]# Power up HPL and HPR drivers
w 30 09 30[/b]
# Wait for 2.5 sec for soft stepping to take effect
# Else read Page 1, Register 63d, D(7:6). When = “11” soft-stepping is complete
# Select Page 0
w 30 00 00
[b]# Power up the Left and Right DAC Channels with route the Left Audio digital data to
# Left Channel DAC and Right Audio digital data to Right Channel DAC
w 30 3f d6
# Unmute the DAC digital volume control
w 30 40 00[/b]

Please note that this is example is based upon using the headphones as the output and not the line-out. However, looking at the registers in the same guide it is easy to adapt to line out. So based upon the above I believe that the following need to be set …

# Ensure DAC not muxed to headphones
amixer -c <scard-name> cset name="z HPL Output Mixer" 0
amixer -c <scard-name> cset name="z HPR Output Mixer" 0
# Mux DAC to line-out
amixer -c <scard-name> cset name="z LOL Output Mixer" 1
amixer -c <scard-name> cset name="z LOR Output Mixer" 1
# Power up line-outs
amixer -c <scard-name> cset name="z LOL Power" 1
amixer -c <scard-name> cset name="z LOR Power" 1
# Enable DACs
amixer -c <scard-name> cset name=z Left DAC" 1
amixer -c <scard-name> cset name="z Right DAC" 1
# Disable auto-mute
amixer -c <scard-name> cset name="z Auto-mute Switch" 0

I assume that this is correct based upon the driver names, but it is obviously completely untested as I don’t have one of these codecs available. There maybe some other settings that you need to tweak for example, the instructions from TI say to write 0x00 to 0x40 (register page 0) to unmute the DACs. By default the L/R DACs are muted and there is no mixer control to do this. Looking at the driver I think you need to call “->digital_mute()” function to do this.

Regards,
Jon

[0] http://www.ti.com/lit/pdf/slaa557

Jon, hi,

I was trying to set the amixer per you proposed settings, but the amixer replied with the following error for most of the options: amixer: Cannot find the given element from control hw:1. The only one that applied the settings was “z Auto-mute Switch”.

an example:

amixer -c tegrasndt186ref cset name="z LOL Output Mixer" 1

Any suggestions?

Regrads,
Igal

Hi Igal,

What does the following return …

amixer -c tegrasndt186ref | grep "LOL\|LOR\|HPL\|HPR\|DAC"

Regards,
Jon

Jon, hi,

Simple mixer control 'z HP DAC',0
Simple mixer control 'z HPL Output Mixer IN1_L',0
Simple mixer control 'z HPL Output Mixer L_DAC',0
Simple mixer control 'z HPR Output Mixer R_DAC',0
Simple mixer control 'z LO DAC',0
Simple mixer control 'z LOL Output Mixer L_DAC',0
Simple mixer control 'z LOR Output Mixer R_DAC',0

It looks to me like a combination of some dapm(s).

Regrads,

Igal

Hi Igal,

Yes that is the mistake I made. I see this is also the case of the mixer controls for the rt565x codec. So I think you want to enable …

‘z LOL Output Mixer L_DAC’
‘z LOR Output Mixer R_DAC’
‘z Auto-mute Switch’

Regards,
Jon

Hi Igal,

I see that you have already set these before. Looking at your past trace, what is missing is the connection from “LOx Output Mixer” → “LOx Power” → “LOx” → I2S. There must be another mixer setting that missing.

Jon

Jon, hi,

moreover the dapm(s) as you have mentioned in message #126 are not recognized, I assume that the word “switch” has to be postfixed: z LOL Output Mixer L_DAC switch as I have used in message #104.

Regards,
Igal

Hi Igal,

Yes that is possible. Is there switch called “z OUT”? If so you probably need to enable that too.

Looking back at your comment #104, I think that your right, the connection from the Left/Right DAC → Left/Right Playback is missing. According to [0], “Left/Right Playback” seems to be the right prefix label for the DAC but it is still not making this link.

Regards,
Jon

[0] DAPM - AlsaProject

Jon, hi,

there in no switch “z OUT”.

Is it correct that when I grep for a switch the name that is provided is without the word switch at the end but if I need to cset it then I have to add the word switch? Moreover, when I cset it (with the word switch) the original switch is not modified.I guess that the switches cannot be turned on until the full route is connected, per the link in message #129.
Regards,
Igal

Jon, hi,

Can you make the extra amixer configuration available?

Regards,
Igal

nvidia@tegra-ubuntu:~$ sudo cat /sys/kernel/debug/asoc/codecs
[sudo] password for nvidia: 
tegra186-dspk.1
tegra186-dspk.0
tegra210-afc.5
tegra210-afc.4
tegra210-afc.3
tegra210-afc.2
tegra210-afc.1
tegra210-afc.0
tegra186-asrc
tegra210-ope.0
tegra210-spdif
tegra210-mvc.1
tegra210-mvc.0
tegra210-dmic.3
tegra210-dmic.2
tegra210-dmic.1
tegra210-dmic.0
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-i2s.5
tegra210-i2s.4
tegra210-i2s.3
tegra210-i2s.2
tegra210-i2s.1
tegra210-i2s.0
tegra210-mixer
tegra210-sfc.3
tegra210-sfc.2
tegra210-sfc.1
tegra210-sfc.0
tegra210-admaif
2900800.ahub
adsp_audio
wm8978.1-001a
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

I found a problem
Audio is tegra210 but I am tx2
i2s1 corresponding tegra210?

Calmcar-Bao, hi,

I think that your CODEC is wm8978.1-001a
BTW I have the same list but with tlv320aic32x4.1-0018.

Or do you mean that the amixer (tegra210-mixer) is the problem ?

Regards,
Igal

Yes, I use wm8978

I meant, look in the list your CODEC is in the list.

Hi Igal,

Can you add the following to the ‘tegra_t186ref_controls’ struct in tegra_t186ref_mobile_rt565x.c …

SOC_DAPM_PIN_SWITCH("z OUT"),

This should give you a switch you can enable.

Can you also cat the following (assuming the path is correct) …

$ sudo cat /sys/kernel/debug/asoc/tegra-snd-t186ref-mobile-rt565x/dapm/z\ OUT

Regards,
Jon

This is not a problem. The I2S driver is common between Tegra210 and Tegra186 and because Tegra210 was the earlier device it uses its name. Furthermore, Tegra210 does not have any DSPK devices and so this is why this one has the Tegra186 prefix.

Regards,
Jon

Jon, hi,
in file tegra_t186ref_mobile_rt565x.c the z IN and z OUT are defines as SND_SOC_DAPM_LINE in the tegra_t186ref_dapm_widget (type struct snd_soc_dapm_widget)
Do you mean to add another widget of type SOC_DAPM_PIN_SWITCH or replace SND_SOC_DAPM_LINE?

$ sudo cat /sys/kernel/debug/asoc/tegra-snd-t186ref-mobile-rt565x/dapm/z\ OUT:

z OUT: off  in 0 out 1
in "static" "z LOL"
in "static" "z LOR"

Regrads,
Igal

Hi Igal,

Yes add another in addition to the DAPM_LINE.

Regards,
Jon

Jon, hi,

I have added the SOC_DAPM_PIN_SWITCH(“z OUT”) to tegra_t186ref_controls.

I have also added to my user space script

amixer -c tegrasndt186ref cset name="z OUT Switch" 1

No change: the aplay completes quickly and no sound is generated.

Any suggestions?

Regards,
Igal