I’m having difficulties successfully getting audio to play out of TX2. We’re using a WM8731 codec connected to the first I2S interface (so that’s I2S1 or I2S0 depending on where you look), as well as to the tegra MCLK and an i2c bus. The codec is connected to a TRRS (headset) jack with a jack detect pin, which is going to a tegra GPIO.
I’ve duplicated and modified the default tegra_t186ref_mobile_rt565x.c kernel “ASoC machine” driver to essentially remove the RT565x-specific code and add support for parsing and using the jack detect GPIO from the device tree.
The driver code, as well as a portion of the device tree files (showing codec instantiation and the modified sound node) are here: https://gist.github.com/rpavlik/675dde5bd622bcb0d132f95906901c5c
I’ve sniffed the i2c bus and concluded that the WM8731 driver is successfully communicating at startup with the chip, as confirmed by the successful load of the driver without any warnings. I also no longer see any audio-related errors in the serial console/dmesg: the related lines are:
[ 5.352407] nvadsp 2993000.adsp: in probe()...
[ 5.368449] nvadsp 2993000.adsp: Registering AMC Error Interrupt
[ 5.375012] nvadsp 2993000.adsp: AMC/ARAM initialized.
[ 5.381458] nvadsp 2993000.adsp: nvadsp_app_module_probe
...
[ 6.916096] tegra210_adsp_audio_platform_probe: platform probe started
[ 6.923407] tegra210-adsp adsp_audio: Default param-type to BYTE for mp3-dec1
[ 6.931041] tegra210-adsp adsp_audio: Default param-type to BYTE for spkprot
[ 6.938641] tegra210-adsp adsp_audio: Default param-type to BYTE for src
[ 6.945726] tegra210-adsp adsp_audio: Default param-type to BYTE for aac-dec1
[ 6.953358] tegra210-adsp adsp_audio: Default param-type to BYTE for aec
[ 6.960078] tegra210-adsp adsp_audio: adma channel page address dt entry not found
[ 6.967648] tegra210-adsp adsp_audio: using adma channel page 0
[ 6.973691] tegra210_adsp_audio_platform_probe probe successfull.
[ 6.991351] OPE platform probe
[ 6.994825] OPE platform probe successful
[ 7.093596] tegra-snd-t186ref-generic sound: ADMAIF1 <-> ADMAIF1 mapping ok
[ 7.100735] tegra-snd-t186ref-generic sound: ADMAIF2 <-> ADMAIF2 mapping ok
[ 7.107816] tegra-snd-t186ref-generic sound: ADMAIF3 <-> ADMAIF3 mapping ok
[ 7.115003] tegra-snd-t186ref-generic sound: ADMAIF4 <-> ADMAIF4 mapping ok
[ 7.122093] tegra-snd-t186ref-generic sound: ADMAIF5 <-> ADMAIF5 mapping ok
[ 7.129171] tegra-snd-t186ref-generic sound: ADMAIF6 <-> ADMAIF6 mapping ok
[ 7.136293] tegra-snd-t186ref-generic sound: ADMAIF7 <-> ADMAIF7 mapping ok
[ 7.143400] tegra-snd-t186ref-generic sound: ADMAIF8 <-> ADMAIF8 mapping ok
[ 7.150489] tegra-snd-t186ref-generic sound: ADMAIF9 <-> ADMAIF9 mapping ok
[ 7.157610] tegra-snd-t186ref-generic sound: ADMAIF10 <-> ADMAIF10 mapping ok
[ 7.164895] tegra-snd-t186ref-generic sound: ADMAIF11 <-> ADMAIF11 mapping ok
[ 7.172196] tegra-snd-t186ref-generic sound: ADMAIF12 <-> ADMAIF12 mapping ok
[ 7.179474] tegra-snd-t186ref-generic sound: ADMAIF13 <-> ADMAIF13 mapping ok
[ 7.186723] tegra-snd-t186ref-generic sound: ADMAIF14 <-> ADMAIF14 mapping ok
[ 7.194045] tegra-snd-t186ref-generic sound: ADMAIF15 <-> ADMAIF15 mapping ok
[ 7.201298] tegra-snd-t186ref-generic sound: ADMAIF16 <-> ADMAIF16 mapping ok
[ 7.208548] tegra-snd-t186ref-generic sound: ADMAIF17 <-> ADMAIF17 mapping ok
[ 7.215874] tegra-snd-t186ref-generic sound: ADMAIF18 <-> ADMAIF18 mapping ok
[ 7.223173] tegra-snd-t186ref-generic sound: ADMAIF19 <-> ADMAIF19 mapping ok
[ 7.230429] tegra-snd-t186ref-generic sound: ADMAIF20 <-> ADMAIF20 mapping ok
[ 7.240997] tegra-snd-t186ref-generic sound: ADSP-FE1 <-> ADSP PCM1 mapping ok
[ 7.248363] tegra-snd-t186ref-generic sound: ADSP-FE2 <-> ADSP PCM2 mapping ok
[ 7.255654] compress asoc: ADSP-FE3 <-> ADSP COMPR1 mapping ok
[ 7.261540] compress asoc: ADSP-FE4 <-> ADSP COMPR2 mapping ok
[ 7.294324] input: tegra-snd-t186-amati-wm8731 Headphone Jack as /devices/sound/sound/card1/input2
[ 7.303852] tegra-snd-t186ref-generic sound: codec-dai "wm8731-hifi" registered
However, a few things don’t work right:
- Jack detect appears to not be working: when I check the status using sysfs/debugfs, it says that it's not plugged in (and I never see the debug prints in the console) even though I've checked the jack detect voltage levels and have plugged/unplugged the plug.
- There are very many /dev/snd/pcmC1D* devices (I've determined that C0 is HDA audio via HDMI, and C1 is the main audio hardware "card" on the Tegra), and I can't figure out which one I should be directing audio to in order to just play it out the headphones: I know (at least the codec-side) DAPM names and DAI links involved, but can't figure out a mapping from device index to any of these.
- Not sure if this matters, but when looking using the command line mixer at the available controls on card 1, I get "tegra210-adsp adsp_audio: Plugin not yet initialized" in the serial console.
Any help on any of the 3 points would be appreciated.
Ryan
I’ve pasted the “interesting” looking controls from the command line mixer below:
567 BOOL 1 I2S1 Loopback Off
568 ENUM 1 I2S1 input bit format 16
569 ENUM 1 I2S1 codec bit format None
570 INT 1 I2S1 Sample Rate 0
571 INT 1 I2S1 Channels 0
572 ENUM 1 I2S1 RX stereo to mono conv None
573 ENUM 1 I2S1 RX mono to stereo conv None
574 ENUM 1 I2S1 TX stereo to mono conv None
575 ENUM 1 I2S1 TX mono to stereo conv None
576 INT 2 x Master Playback Volume 121 121
577 BOOL 2 x Master Playback ZC Switch Off Off
578 INT 2 x Capture Volume 23 23
579 BOOL 2 x Line Capture Switch Off Off
580 INT 1 x Mic Boost Volume 0
581 BOOL 1 x Mic Capture Switch Off
582 INT 1 x Sidetone Playback Volume 3
583 BOOL 1 x ADC High Pass Filter Switch On
584 BOOL 1 x Store DC Offset Switch Off
585 BOOL 1 x Playback Deemphasis Switch Off
586 BOOL 1 x Int Spk Switch Off
587 BOOL 1 x Headphone Jack Switch Off
588 BOOL 1 x Mic Jack Switch Off
589 BOOL 1 x Int Mic Switch Off
590 ENUM 1 codec-x rate None
591 ENUM 1 codec-x format None
592 ENUM 1 Jack-state None
593 ENUM 1 ADMAIF1 Mux I2S1
594 ENUM 1 ADMAIF2 Mux I2S6
599 ENUM 1 ADMAIF7 Mux MIXER1-1
603 ENUM 1 I2S1 Mux MIXER1-1
611 ENUM 1 SFC4 Mux MIXER1-1
612 ENUM 1 MIXER1-1 Mux ADMAIF1
613 ENUM 1 MIXER1-2 Mux ASRC1-2
617 ENUM 1 MIXER1-6 Mux ADMAIF6
654 ENUM 1 I2S6 Mux ADMAIF2
666 ENUM 1 ASRC1-2 Mux ADMAIF5
674 BOOL 1 Adder1 RX1 On
675 BOOL 1 Adder1 RX2 On
676 BOOL 1 Adder1 RX3 Off
677 BOOL 1 Adder1 RX4 Off
678 BOOL 1 Adder1 RX5 Off
679 BOOL 1 Adder1 RX6 On
724 ENUM 1 ADSP-FE1 MUX APM-OUT3
733 ENUM 1 ADSP-ADMAIF4 MUX APM-OUT1
750 ENUM 1 APM-IN1 MUX ADSP-ADMAIF3
751 ENUM 1 APM-IN2 MUX None
752 ENUM 1 APM-IN3 MUX ADSP-ADMAIF8
753 ENUM 1 APM-IN4 MUX None
754 ENUM 1 APM-IN5 MUX None
755 ENUM 1 APM-IN6 MUX None
756 ENUM 1 APM-IN7 MUX None
757 ENUM 1 APM-IN8 MUX None
758 ENUM 1 APM-OUT1 MUX ADMA2-TX
759 ENUM 1 APM-OUT2 MUX None
760 ENUM 1 APM-OUT3 MUX AEC
766 ENUM 1 ADMA1 MUX APM-IN1
767 ENUM 1 ADMA2 MUX None
768 ENUM 1 ADMA3 MUX None
769 ENUM 1 ADMA4 MUX APM-IN3
770 ENUM 1 ADMA5 MUX None
771 ENUM 1 ADMA6 MUX None
772 ENUM 1 ADMA7 MUX None
773 ENUM 1 ADMA8 MUX None
774 ENUM 1 ADMA9 MUX None
775 ENUM 1 ADMA10 MUX None
776 ENUM 1 ADMA1-TX MUX None
777 ENUM 1 ADMA2-TX MUX SPKPROT-SW
787 ENUM 1 SPKPROT-SW MUX ADMA1
788 ENUM 1 SRC MUX None
789 ENUM 1 AAC-DEC1 MUX None
790 ENUM 1 AEC MUX ADMA4
796 BOOL 1 x Output Mixer Line Bypass Switch Off
797 BOOL 1 x Output Mixer Mic Sidetone Switch Off
798 BOOL 1 x Output Mixer HiFi Playback Switch Off
799 ENUM 1 x Input Mux Line In