I am working on an embedded device built around a NXP i.MX8MP, building the system image via Yocto.
About the sound subsystem, the board I am working on is equipped with a Cirrus Logic WM8524 DAC, connected on SAI1; the configuration in the Linux device tree is as following:
wm8524: audio-codec { #sound-dai-cells = <0>; compatible = "wlf,wm8524"; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_sound_wm8524>; wlf,mute-gpios = <&gpio4 0 GPIO_ACTIVE_LOW>; }; sound-wm8524 { compatible = "simple-audio-card"; simple-audio-card,name = "wm8524-audio"; simple-audio-card,format = "i2s"; simple-audio-card,frame-master = <&cpudai>; simple-audio-card,bitclock-master = <&cpudai>; simple-audio-card,widgets = "Line", "Left Line Out Jack", "Line", "Right Line Out Jack"; simple-audio-card,routing = "Left Line Out Jack", "LINEVOUTL", "Right Line Out Jack", "LINEVOUTR"; cpudai: simple-audio-card,cpu { sound-dai = <&sai1>; }; simple-audio-card,codec { sound-dai = <&wm8524>; clocks = <&audio_blk_ctrl IMX8MP_CLK_AUDIOMIX_SAI1_MCLK1>; }; };
With this configuration I am perfectly able to play music with gstplay-1.0, for example, and connecting a couple of speakers to the board I can actually hear the music being nicely played.
BUT
So, here are my question and/or request for clarification, if somebody can help me:
WM8524 has no I2C/SPI/serial connection... but only I2S... so the possibility to let it manage the volume on its own is that there is the possibility to send some "control command" over I2S... but as far as I can understand surfing the web, that is not possible... or at least, in several places I read something like Regarding I2S, the volume is set by scaling the values in the digital data... is that correct?
if point 1) is correct, my last chance is that Linux is able to "pre-process" digital data before sending them to the codec... and I think that this should be done at "simple-audio-card" level... is that correct? is that possible?
Finally, if my assumptions at both 1) are 2) are correct, why am I not seeing any volume controls in alsamixer/amixer for my sound card? And why the sound card is not detected at all during Linux boot? Any ideas?
Thanks for the support!
I tested this on imx8mp evk board successfully, what do you mean you couldn't see the volume controls? did you use the correct command? and pls give me the result when you use "aplay -l"
Hello joanxie.
Do you mean that you tested exactly WM8524 with the devicetree I provided in my post, and you are able to control volume in alsamixer/amixer?
Anyway, you asked me about the about of aplay -l and here it is:
**** List of PLAYBACK Hardware Devices ****
card 0: wm8524audio [wm8524-audio], device 0: 30c10000.sai-wm8524-hifi wm8524-hifi-0 [30c10000.sai-wm8524-hifi wm8524-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
I also attach the an image called alsamixer.png to show you exactly what I get in alsamixer.
Finally I attach the dump of dmesg, where you can read "No soundcards found".
no, I didn't have board with this codec, I tested exist codec wm8960, what result when you use command "amixer -c0 controls" ? I have the same "No soundcards found". in the boot logfile too
The output is nothing (empty):
root@2414a:~# amixer -c0 controls
root@2414a:~#
With WM8960 are you able to see standard volume/balance controls in alsamixer/amixer?
You too with WM8960 make use of a simple-audio-card node in your devicetree? Can you share with me your own devicetree (at least the relevant part) so that maybe I will be able to spot some differences with respect to mine?
With WM8960 are you able to see standard volume/balance controls in alsamixer/amixer?
>yes
You too with WM8960 make use of a simple-audio-card node in your devicetree?
>you can refer to the dts file, wm8960 doesn't use simple-audio-card
https://github.com/nxp-imx/linux-imx/blob/lf-6.6.y/arch/arm64/boot/dts/freescale/imx8mp-evk.dts#L150
Ok, I see... WM8960 is connected via I2C and so it is completely another thing... it can receive control commands (via I2C) and maybe it can control the output volume and/or balance that way...
Do you know if perhaps what I am experiencing is a "limitation" of the "simple-audio-card" approach?
In other words: with "simple-card-audio" approach (the only one possible for WM8524, since it do not have any control interfaces, but only digital audio) is it possible to let Linux control the sound card volume/balance?
The only way it could do that will be by manipulating digital audio values before sending them on the I2S bus... is something like that implemented? maybe is something to be enabled some way?