But there are errors during boot (see attached dmesg.log, timestamp 5.075526)
It seems I have a problem with the MCLK of the codec. In the kernel source tlv320aic31xx.c, only 12 and 12,5 MHz are supported (see struct aic31xx_divs). But with the default device tree for the Verdin iMX8MM these values are not achievable. I only got 12684288 Hz or 11915637 Hz.
See the attached dmesg.log. The solution was, to assign a clock-parent to &sai2 with 24 MHz.
Now when I try to test the codec I get the error -19, that there is no device:
Playback device is default
Stream parameters are 48000Hz, S16_LE, 1 channels
Using 16 octaves of pink noise
ALSA lib ../../../alsa-lib-126.96.36.199/src/pcm/pcm_direct.c:1824:(_snd_pcm_direct_get_slave_ipc_offset) Invalid value for card
Playback open error: -19,No such device
There is no data transfer on the I2C or I2S lines.
Could you please check alsamixer to see which sound card is being used by default? Also, using the alsamixer are you able to enable the speaker? Please share the dmesg log after performing configuration using alsamixer.
Please, also check the commands from this Audio (Linux) | Toradex Developer Center article. You can see that there is an example for speaker-test as well: please try to point to your specific sound card as well.
I understand that you are trying to use IMX8MM_AUDIO_PLL1_REF_SEL instead of the default IMX8MM_AUDIO_PLL1_OUT for &sai2. But could you please test with the default clock (IMX8MM_AUDIO_PLL1_OUT) again?
Also could you please share how are you connecting your codec to the module?
When I try this then I get the errors during boot, that the MCLK has an unsupported frequency (12684288 Hz) and I have no soundcard at all. Please see the dmesg.log in my first post.
When I call alsamixer, I got the error cannot open mixer: No such device.
Alsamixer only opens, when I use alsamixer -Dsysdefault. There I can unmute the speaker and set the volume. The dmesg log is attached.
Pressing F6 to select the sound card, I see two entries: - (default) and 0 tlv320aic3100. When I try to select the default one I get the error Cannot open mixer device 'default'. No such device.
With speaker-test -Dsysdefault the test starts and I see traffic on all I2S-lines (BCLK, SYNC, DOUT, MCLK). But still no sound. We connected the module as follows:
I finally got it to output a sound.
All this time I didn’t realize that I had to unmute not only the speaker, but also the output of the DAC.
Additionally there was a bug in my wire setup.
Another source of error was the /etc/asound.conf. I use the reference multimedia image with the built in asound.conf. In this the default sound card is set to the NAU8822. So I made the following entries:
The sound quality is not necessarily good and also quite quiet. But that should be fixable.