I have added the following sections to the device tree:
wm8524: wm8524 {
#sound-dai-cells = <0>;
compatible = "wlf,wm8524";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_gpio_wlf>;
wlf,mute-gpios = <&gpio4 28 GPIO_ACTIVE_HIGH>;
clocks = <&clk IMX8MP_CLK_SAI3_ROOT>;
clock-names = "mclk";
status = "okay";
};
sound-wm8524 {
compatible = "fsl,imx-audio-wm8524";
model = "wm8524-audio";
audio-cpu = <&sai3>;
audio-codec = <&wm8524>;
audio-asrc=<&easrc>;
audio-routing =
"Line Out Jack", "LINEVOUTL",
"Line Out Jack", "LINEVOUTR";
};
and I have edited node sai3 and easrc as follows
&easrc {
#sound-dai-cells = <0>;
fsl,asrc-rate = <48000>;
status = "okay";
};
&sai3 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai3>;
assigned-clocks = <&clk IMX8MP_CLK_SAI3>;
assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL1_OUT>;
assigned-clock-rates = <24576000>;
fsl,sai-mclk-direction-output;
status = "okay";
};
The results I get when I run command $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: wm8524audio [wm8524-audio], device 0: HiFi wm8524-hifi-0 [HiFi wm8524-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: wm8524audio [wm8524-audio], device 1: HiFi-ASRC-FE (*) []
Subdevices: 1/1
Subdevice #0: subdevice #0
I think the system has recognized the audio card and can play the audio file. I tested it with command speaker test.
$ speaker-test -c 2 -t sine
The speaker does not emit clear sound, it is very noisy, I cannot even hear the 440Hz frequency that the above command creates. there was only squeaking sound.
I used an osciloscope to check the signal at the MCLK and BCLK pins, and I saw that the measured frequency at the MCLK pin was equal to the frequency I set in the device tree (24676khz), and the frequency at the BLCK pin = sample rate * 64, in this case 3072000 Hz (sample rate = 48 khz). I also checked the LRCLK pin frequency, the measured result was 48 khz.
I don't know if the above results are correct? Can you explain me how to calculate MCLK, BCLK, LRCLK for WM8524?
已解决! 转到解答。
Hi @trongthinh,
Hi @trongthinh,