Other Parts Discussed in Thread: PCM3168
Hi,
I'm in a project where I need to have 6 different audio communication paths. I need each channel to be able to establish calls to one or several sip phones.
In A, i have an analogic microphone and speaker.
I find the PCM3168A codec, who have 6 inputs/8 outputs, so I made a custom prototype with that codec, connected to J1001 connector of IMX8mm EVK (see schematic.pdf).
Based on https://bootlin.com/blog/eight-channels-audio-on-i-mx7-with-pcm3168/ I configured the device tree:
sound-pcm3168a {
compatible = "simple-audio-card";
simple-audio-card,name = "pcm3168a-audio";
simple-audio-card,widgets = "Speaker", "Channel1out",
"Speaker", "Channel2out",
"Speaker", "Channel3out",
"Speaker", "Channel4out",
"Speaker", "Channel5out",
"Speaker", "Channel6out",
"Microphone", "Channel1in",
"Microphone", "Channel2in",
"Microphone", "Channel3in",
"Microphone", "Channel4in",
"Microphone", "Channel5in",
"Microphone", "Channel6in";
simple-audio-card,routing = "Channel1out", "AOUT1L",
"Channel2out", "AOUT1R",
"Channel3out", "AOUT2L",
"Channel4out", "AOUT2R",
"Channel5out", "AOUT3L",
"Channel6out", "AOUT3R",
"Channel1in", "AIN1L",
"Channel2in", "AIN1R",
"Channel3in", "AIN2L",
"Channel4in", "AIN2R",
"Channel5in", "AIN3L",
"Channel6in", "AIN3R";
simple-audio-card,dai-link@1 {
format = "left_j";
bitclock-master = <&pcm3168a_dac>;
frame-master = <&pcm3168a_dac>;
cpu {
sound-dai = <&sai1>;
dai-tdm-slot-num = <8>;
dai-tdm-slot-width = <32>;
};
pcm3168a_dac: codec {
sound-dai = <&pcm3168a 0>;
clocks = <&clk IMX8MM_CLK_SAI1_ROOT>;
};
};
simple-audio-card,dai-link@2 {
format = "left_j";
bitclock-master = <&pcm3168a_adc>;
frame-master = <&pcm3168a_adc>;
cpu {
sound-dai = <&sai1>;
dai-tdm-slot-num = <8>;
dai-tdm-slot-width = <32>;
};
pcm3168a_adc: codec {
sound-dai = <&pcm3168a 1>;
clocks = <&clk IMX8MM_CLK_SAI1_ROOT>;
};
};
};
///I2C3
pcm3168a: audio-codec@44 {
compatible = "ti,pcm3168a";
#sound-dai-cells = <1>;
reg = <0x44>;
reset-gpios = <&gpio4 17 GPIO_ACTIVE_LOW>;
clocks = <&clk IMX8MM_CLK_SAI1_ROOT>;
clock-names = "scki";
/*VDD1-supply = <&supply3v3>;
VDD2-supply = <&supply3v3>;
VCCAD1-supply = <&supply5v0>;
VCCAD2-supply = <&supply5v0>;
VCCDA1-supply = <&supply5v0>;
VCCDA2-supply = <&supply5v0>;*/
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_pcm3168a>;
};
//iomux
pinctrl_pcm3168a: pinctrl_pcm3168a{
fsl,pins = <
MX8MM_IOMUXC_SAI1_TXD5_GPIO4_IO17 0x19 /*RESET*/
MX8MM_IOMUXC_SAI1_TXD6_GPIO4_IO18 0x19 /*OVF*/
MX8MM_IOMUXC_SAI1_TXD7_GPIO4_IO19 0x19 /*ZERO*/
>;
};
pinctrl_sai1: sai1grp {
fsl,pins = <
MX8MM_IOMUXC_SAI1_MCLK_SAI1_MCLK 0xd6
MX8MM_IOMUXC_SAI1_TXFS_SAI1_TX_SYNC 0xd6
MX8MM_IOMUXC_SAI1_TXC_SAI1_TX_BCLK 0xd6
MX8MM_IOMUXC_SAI1_TXD0_SAI1_TX_DATA0 0xd6
MX8MM_IOMUXC_SAI1_TXD1_SAI1_TX_DATA1 0xd6
MX8MM_IOMUXC_SAI1_TXD2_SAI1_TX_DATA2 0xd6
MX8MM_IOMUXC_SAI1_TXD3_SAI1_TX_DATA3 0xd6
MX8MM_IOMUXC_SAI1_TXD4_SAI1_TX_DATA4 0xd6
MX8MM_IOMUXC_SAI1_RXD0_SAI1_RX_DATA0 0xd6
MX8MM_IOMUXC_SAI1_RXD1_SAI1_RX_DATA1 0xd6
MX8MM_IOMUXC_SAI1_RXD2_SAI1_RX_DATA2 0xd6
MX8MM_IOMUXC_SAI1_RXC_SAI1_RX_BCLK 0xd6
MX8MM_IOMUXC_SAI1_RXFS_SAI1_RX_SYNC 0xd6
>;
};
When loaded the device tree on EVK, I have:
[ 2.375321] debugfs: Directory '30010000.sai' with parent 'pcm3168a-audio' already present!
[ 2.383813] asoc-simple-card sound-pcm3168a: pcm3168a-dac <-> 30010000.sai mapping ok
[ 2.391733] asoc-simple-card sound-pcm3168a: pcm3168a-adc <-> 30010000.sai mapping ok
[ 2.399624] asoc-simple-card sound-pcm3168a: ASoC: no DMI vendor name!
[ 2.552554] ALSA device list:
[ 2.557548] #0: imx-spdif
[ 2.568080] #1: imx-audio-micfil
[ 2.571488] #2: pcm3168a-audio
[ 2.574717] #3: wm8524-audio
aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: imxspdif [imx-spdif], device 0: S/PDIF PCM snd-soc-dummy-dai-0 [S/PDIF PCM snd-soc-dummy-dai-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: btscoaudio [bt-sco-audio], device 0: 30020000.sai-bt-sco-pcm-wb bt-sco-pcm-wb-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 3: wm8524audio [wm8524-audio], device 0: 30030000.sai-wm8524-hifi wm8524-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 4: pcm3168aaudio [pcm3168a-audio], device 0: 30010000.sai-pcm3168a-dac pcm3168a-dac-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: imxspdif [imx-spdif], device 0: S/PDIF PCM snd-soc-dummy-dai-0 [S/PDIF PCM snd-soc-dummy-dai-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: imxaudiomicfil [imx-audio-micfil], device 0: micfil hifi snd-soc-dummy-dai-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: btscoaudio [bt-sco-audio], device 0: 30020000.sai-bt-sco-pcm-wb bt-sco-pcm-wb-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 4: pcm3168aaudio [pcm3168a-audio], device 1: 30010000.sai-pcm3168a-adc pcm3168a-adc-1 []
Subdevices: 1/1
Subdevice #0: subdevice #0
When tried to record a audio:
arecord -D hw:4,1 -r 48000 sample.wav
Recording WAVE 'sample.wav' : Unsigned 8 bit, Rate 48000 Hz, Mono
arecord: set_params:1339: Sample format U8 non available
Available formats:
- S24_LE
arecord -D hw:4,1 -f S24_LE -r 48000 sample.wav
Recording WAVE 'sample.wav' : Signed 24 bit Little Endian, Rate 48000 Hz, Mono
arecord: set_params:1345: Channels count non available
arecord -D hw:4,1 -f S24_LE -r 48000 -c 2 sample.wav
Recording WAVE 'sample.wav' : [ 1857.768567]
Signed 24 bit Little Endian, Rate[ 1857.777720] pcm3168a 2-0044: 24-bit slots not supported in master mode, or slave mode using DSP
[ 1857.789217] pcm3168a 2-0044: ASoC: can't set pcm3168a-adc hw params: -22
48000 Hz, Stereo
arecord: set_params:1403: Unable to install hw params:
ACCESS: RW_INTERLEAVED
FORMAT: S24_LE
SUBFORMAT: STD
SAMPLE_BITS: 32
FRAME_BITS: 64
CHANNELS: 2
RATE: 48000
PERIOD_TIME: (42666 42667)
PERIOD_SIZE: 2048
PERIOD_BYTES: 16384
PERIODS: 4
BUFFER_TIME: (170666 170667)
BUFFER_SIZE: 8192
BUFFER_BYTES: 65536
TICK_TIME: 0
So, my questions are:
1-Can I use the PCM3168A to have the 6 independent audios, like I need?
2-If yes, has anyone managed to configure the pcm3168 with imx8mm? Anyone can help me with the device tree configuration? How do i differentiate the different channels in linux? How I can record/play audio in a specified audio input/output of the pcm3168a?
3-If not, the solution can passed to using 6 simple codecs (like wm8960 that was on many imx evk)? There are other options (but simple to implement in this micro)?
Thanks for any help.imx8mm-evk.zip
Thanks.