Linux simple-audio-card missing volume controls

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Linux simple-audio-card missing volume controls

2,233 次查看
morix
Contributor III

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

  1. At boot, Linux says that "No soundcards are detected";
  2. Consequently (at least, I think) I can't see any volume controls in alsamixer or amixer.

So, here are my question and/or request for clarification, if somebody can help me:

  1. 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?

  2. 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?

  3. 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!

 

0 项奖励
回复
7 回复数

2,199 次查看
joanxie
NXP TechSupport
NXP TechSupport

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"

0 项奖励
回复

2,178 次查看
morix
Contributor III

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".

0 项奖励
回复

2,174 次查看
joanxie
NXP TechSupport
NXP TechSupport

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

0 项奖励
回复

2,167 次查看
morix
Contributor III

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?

0 项奖励
回复

2,148 次查看
joanxie
NXP TechSupport
NXP TechSupport

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

 

0 项奖励
回复

2,144 次查看
morix
Contributor III

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?

0 项奖励
回复

2,069 次查看
joanxie
NXP TechSupport
NXP TechSupport

I think this is related to Audio Mixer enable, not I2C, for more detailed information, pls refer to the chapter 7.5 Audio Mixer (AUDMIX)

0 项奖励
回复