imx8mm mute/unmute audio output with wm8524

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

imx8mm mute/unmute audio output with wm8524

ソリューションへジャンプ
3,590件の閲覧回数
cedric_starke
Contributor III

Hello together,

I have a problem or misunderstanding how to use the mute pin for the wm8524 that I configured in the dts file as in the example:

wm8524: wm8524 {
	compatible = "wlf,wm8524";
	clocks = <&clk IMX8MM_CLK_SAI3_ROOT>;
	clock-names = "mclk";
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_gpio_wlf>;
	wlf,mute-gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>;
};

sound-wm8524 {
	compatible = "fsl,imx-audio-wm8524";
	model = "wm8524-audio";
	audio-cpu = <&sai3>;
	audio-codec = <&wm8524>;
	audio-routing =
		"Line Out Jack", "LINEVOUTL",
		"Line Out Jack", "LINEVOUTR";
};

.
.
.

pinctrl_gpio_wlf: gpiowlfgrp {
	fsl,pins = <
		MX8MM_IOMUXC_GPIO1_IO05_GPIO1_IO5	0x19
	>;
};

 

When I switch between "GPIO_ACTIVE_HIGH" and "GPIO_ACTIVE_LOW" in the DTS, I see GND or VCC on the GPIO pin after the boot sequence. But I didn't find any way to change the GPIO state during runtime.

 

I tried the "m" command during audio output with gplay-1.0, but nothing happens.

There are no controls for alsamixer and there is nothing useful in /sys/class/sound/ or /proc/asound/.


So can someone tell me how to use the mute function of the wm8524?

 

Thanks in advance,

Cedric

0 件の賞賛
返信
1 解決策
3,450件の閲覧回数
cedric_starke
Contributor III

Just as short feedback.

I have tested the driver in combination with gplay-1.0. As a result I would say the driver is buggy or maybe another layer in the imx world. I focused my investigation on the /sound/soc/codecs/wm8524.c file.

There are three positions that change the level of the mute pin.

  • wm8524_startup
  • wm8524_shutdown
  • wm8524_mute_stream

Startup and shutdown are called when starting/stopping the audio. When I trigger a "stop"/"[s]" with gplay-1.0, the mute_stream function gets a call. With the "mute"/"[m]" of gplay-1.0 nothing happens in the driver, for whatever reason.

Also, the configuration of the GPIO is inverted from startup/shutdown to mute_stream.

To solve my problem, I changed the dts configuration from:

wlf,mute-gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;

to:

wlf,mute-gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>;

 

And changed the function wm8524_mute_stream from:

gpiod_set_value_cansleep(wm8524->mute, mute);

to:

gpiod_set_value_cansleep(wm8524->mute, !mute);

 

Of course, the variable mute is an integer and can be something other than 0 or 1, but during my debugging I only got these values.

If you have the same problem, feel free to use a more complex check

 

As a result, my mute gpio becomes low -> mute active during boot.

While playing audio the gpio becomes high -> Mute inactive

 

 

 

 

元の投稿で解決策を見る

0 件の賞賛
返信
8 返答(返信)
3,577件の閲覧回数
jimmychan
NXP TechSupport
NXP TechSupport

According to the wm8524.c driver, there is "wlf,mute" parameter. You can pass the gpio pin from the device tree to the driver by this parameter.

https://source.codeaurora.org/external/imx/linux-imx/tree/sound/soc/codecs/wm8524.c?h=rel_imx_5.4.47...

0 件の賞賛
返信
3,572件の閲覧回数
cedric_starke
Contributor III

Hi @jimmychan,

thank you for your answer.

I think I didn't understand what you mean by parameter.

In my dts example above, I changed the GPIO pin to GPIO1 _5 and when I use active low or high, the GPIO also changes the output while loading the driver in Linux boot process (as module also possible).

But I didn't find any way to change the mute level during runtime with any tool available in NXP BSP.

In the driver the function "mute_steam" is visible, but how can I address this function?

0 件の賞賛
返信
3,559件の閲覧回数
jimmychan
NXP TechSupport
NXP TechSupport

Which version of BSP are you using?

0 件の賞賛
返信
3,554件の閲覧回数
cedric_starke
Contributor III

Our base is the imx-5.4.47-2.2.0.xml and the resulting image from bitbake fsl-image-machine-test.

0 件の賞賛
返信
3,547件の閲覧回数
jimmychan
NXP TechSupport
NXP TechSupport

There is wm8524 in i.MX8mm-evk dts file.

https://source.codeaurora.org/external/imx/linux-imx/tree/arch/arm64/boot/dts/freescale/imx8mm-evk.d...

 

	wm8524: audio-codec {
		#sound-dai-cells = <0>;
		compatible = "wlf,wm8524";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_gpio_wlf>;
		wlf,mute-gpios = <&gpio5 21 GPIO_ACTIVE_LOW>;
	};

	pinctrl_gpio_wlf: gpiowlfgrp {
		fsl,pins = <
			MX8MM_IOMUXC_I2C4_SDA_GPIO5_IO21	0xd6
		>;
	};

You can take this for reference.

 

 

 

0 件の賞賛
返信
3,541件の閲覧回数
cedric_starke
Contributor III

In fact, I used this and this for the nano as an example and the dts part I wrote above was the working result.

https://source.codeaurora.org/external/imx/linux-imx/tree/arch/arm64/boot/dts/freescale/imx8mn-evk.d...

My problem is not the dts part as the audio output is working correctly. But I am asking about the possibility to change the mute level during runtime? By default the mute level is inactive. So when I write ACTIVE_LOW into the dts, the pin is high and vice versa.

But that's about it. So why can I set a GPIO as a mute pin if I can't use it to mute audio at runtime?

 

0 件の賞賛
返信
3,532件の閲覧回数
jimmychan
NXP TechSupport
NXP TechSupport

According to the document of driver, it just simply to add "wlf,mute-gpios" in device tree for the MUTE pin control. Suppose the mute should work when the GPIO pin setting properly in the device tree. If the mute function is not working at runtime, it is the wm8524 driver issue. You may need to debug it by adding the "printf" in the driver to check the gpio pin is set correct or not. Or maybe better to consult the Cirrus Logic for the wm8524 driver issue.

0 件の賞賛
返信
3,451件の閲覧回数
cedric_starke
Contributor III

Just as short feedback.

I have tested the driver in combination with gplay-1.0. As a result I would say the driver is buggy or maybe another layer in the imx world. I focused my investigation on the /sound/soc/codecs/wm8524.c file.

There are three positions that change the level of the mute pin.

  • wm8524_startup
  • wm8524_shutdown
  • wm8524_mute_stream

Startup and shutdown are called when starting/stopping the audio. When I trigger a "stop"/"[s]" with gplay-1.0, the mute_stream function gets a call. With the "mute"/"[m]" of gplay-1.0 nothing happens in the driver, for whatever reason.

Also, the configuration of the GPIO is inverted from startup/shutdown to mute_stream.

To solve my problem, I changed the dts configuration from:

wlf,mute-gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;

to:

wlf,mute-gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>;

 

And changed the function wm8524_mute_stream from:

gpiod_set_value_cansleep(wm8524->mute, mute);

to:

gpiod_set_value_cansleep(wm8524->mute, !mute);

 

Of course, the variable mute is an integer and can be something other than 0 or 1, but during my debugging I only got these values.

If you have the same problem, feel free to use a more complex check

 

As a result, my mute gpio becomes low -> mute active during boot.

While playing audio the gpio becomes high -> Mute inactive

 

 

 

 

0 件の賞賛
返信