Other Parts Discussed in Thread: AM67A,
Tool/software:
In our application, the TLV320AIC3106 codec has an external 12.288Mhz oscillator connected and then the codec is conncted to mcasp0 interface of an AM67a SoC. Please refer the device tree excerpts below. Since MCLK is not connected to the SoC mcasp interface, the codec is the clock master.
main_mcasp0_pins_default: main-mcasp0-default-pins {
pinctrl-single,pins = <
J722S_IOPAD(0x1a4, PIN_INPUT, 0) /* (D25) MCASP0_ACLKX <- BCLK from codec */
J722S_IOPAD(0x1a8, PIN_INPUT, 0) /* (C26) MCASP0_AFSX <- LRCLK from codec */
J722S_IOPAD(0x1a0, PIN_OUTPUT, 0) /* (F23) MCASP0_AXR0 -> TX to codec */
J722S_IOPAD(0x19c, PIN_INPUT, 0) /* (B25) MCASP0_AXR1 <- RX from codec */
>;
};
clk_audio_osc: clk-audio-osc {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <12288000>;
clock-output-names = "tlv320aic3106-mclk";
};
codec_audio: sound {
compatible = "simple-audio-card";
simple-audio-card,name = "J722S-EVM";
simple-audio-card,widgets =
"Headphone", "Headphone Jack",
"Line", "Line In",
"Microphone", "Microphone Jack";
simple-audio-card,routing =
"Headphone Jack", "HPLOUT",
"Headphone Jack", "HPROUT",
"LINE1L", "Line In",
"LINE1R", "Line In",
"MIC3R", "Microphone Jack",
"Microphone Jack", "Mic Bias";
simple-audio-card,format = "dsp_b";
simple-audio-card,bitclock-master = <&sound_master>;
simple-audio-card,frame-master = <&sound_master>;
simple-audio-card,bitclock-inversion;
simple-audio-card,cpu {
sound-dai = <&mcasp0>;
};
sound_master: simple-audio-card,codec {
sound-dai = <&tlv320aic3106>;
clocks = <&clk_audio_osc>;
};
};
tlv320aic3106: audio-codec@1b {
#sound-dai-cells = <0>;
compatible = "ti,tlv320aic3106";
reg = <0x1b>;
ai3x-micbias-vg = <1>; /* 2.0V */
AVDD-supply = <&vcodec_3v3>;
IOVDD-supply = <&vcodec_3v3>;
DRVDD-supply = <&vcodec_3v3>;
DVDD-supply = <&vcodec_1v8>;
};
&mcasp0 {
status = "okay";
#sound-dai-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&main_mcasp0_pins_default>;
op-mode = <0>; /* MCASP_IIS_MODE */
tdm-slots = <2>;
serial-dir = < /* 0: INACTIVE, 1: TX, 2: RX */
1 0 2 0
0 0 0 0
0 0 0 0
0 0 0 0
>;
};
The codec gets detected and the sound card is visible for aplay -l command ,
root@j722s-evm:/home/root# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Dummy [Dummy], device 0: Dummy PCM [Dummy PCM]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 1: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM]
Subdevices: 7/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 1: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 2: J722SEVM [J722S-EVM], device 0: 2b00000.audio-controller-tlv320aic3x-hifi tlv320aic3x-hifi-0 [2b00000.audio-controller-tlv320aic3x-hifi tlv320aic3x-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
However, when a file is played, an error is thrown.
root@j722s-evm:/home/root# aplay -D plughw:2,0 test.wav
Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
aplay: pcm_write:2178: write error: Input/output error
When debug is enabled, the following is printed to dmesg
[Jun30 09:47] 2b00000.audio-controller-tlv320aic3x-hifi: ASoC: tlv320aic3x-hifi <-> 2b00000.audio-controller info:
[ +0.011289] 2b00000.audio-controller-tlv320aic3x-hifi: ASoC: rate mask 0x7fe
[ +0.007870] 2b00000.audio-controller-tlv320aic3x-hifi: ASoC: ch min 2 max 2
[ +0.008033] 2b00000.audio-controller-tlv320aic3x-hifi: ASoC: rate min 8000 max 96000
[ +0.010331] tlv320aic3x 3-001b: Update DAI routes for tlv320aic3x-hifi playback
[ +0.008084] davinci-mcasp 2b00000.audio-controller: Update DAI routes for 2b00000.audio-controller playback
[ +0.642632] asoc-simple-card sound: playback write timeout (DMA or IRQ trouble?)
[ +0.671987] asoc-simple-card sound: playback write timeout (DMA or IRQ trouble?)
[ +5.215939] 2b00000.audio-controller-tlv320aic3x-hifi: ASoC: pop wq checking: Playback status: inactive waiting: yes
Please suggest what is missing in our configuration.