Hello.
I have searched around the forums and saw many posts with my problem but not a single one of the solutions works for me.
I am trying to connect a digital microphone to the SAI5 expansion pins on my i.mx 8m mini evk . Here is the device tree I have:
codec_dummy: codec_dummy {
compatible = "asoc,snd-soc-dummy";
#sound-dai-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_gpio_wlf>;
frame-master;
bitclock-master;
status = "okay";
};
sound-sai5 {
compatible = "simple-audio-card";
simple-audio-card,name="sound | sai5";
simple-audio-card,format="i2s";
simple-audio-card,frame-master=<&sai5>;
simple-audio-card,bitclock-master=<&sai5>;
status="okay";
cpu_dai:simple-audio-card,cpu{
sound-dai=<&sai5>;
system-clock-frequency=<&clk IMX8MM_CLK_SAI5_ROOT>;
};
codec_dai: simple-audio-card,codec{
sound-dai=<&codec_dummy>;
system-clock-frequency=<&clk IMX8MM_CLK_SAI5_ROOT>;
};
};
&sai5 {
compatible="fsl,imx8mm-sai";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai5>;
assigned-clocks=<&clk IMX8MM_CLK_SAI5>;
assigned-clocks-parents=<&clk IMX8MM_AUDIO_PLL1_OUT>;
assigned-clock-rates = <4096000>;
fsl,sai-mclk-direction-output;
fsl,txmasterflag = <0>;
fsl,mode="i2s-master";
status="okay";
};
I can see the interface when I run the arecord -l command, when I run pactrl list the following error gets printed out in an infinite loop:
fsl-sai 30050000.sai: ASoC: error at snd_soc_dai_hw_params on 30050000.sai: -22
[ 1875.936608] 30050000.sai-snd-soc-dummy-dai: ASoC: soc_pcm_hw_params() failed (-22)
[ 1875.944756] fsl-sai 30050000.sai: failed to derive required Rx rate: 1411200
Any help is greatly appreciated as have been struggling with this error for the past month!
Solved! Go to Solution.
After 2 months of searching the internet, I managed to get it working using the simple audio driver. In order to get it in working condition, I made the following changes to the original device tree(build/workspace/sources/linux-imx/arch/arm64/boot/dts/freescaleimx8mm-evk.dtsi):
--- sound/soc/soc-utils.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c index 54dcece52b0c..892d02992b02 100644 --- a/sound/soc/soc-utils.c +++ b/sound/soc/soc-utils.c @@ -7,6 +7,8 @@ // Author: Mark Brown <broonie@opensource.wolfsonmicro.com> // Liam Girdwood <lrg@slimlogic.co.uk> +#include <linux/module.h> +#include <linux/of.h> #include <linux/platform_device.h> #include <linux/export.h> #include <sound/core.h> @@ -149,9 +151,18 @@ static int snd_soc_dummy_probe(struct platform_device *pdev) return ret; } +#ifdef CONFIG_OF +static const struct of_device_id soc_dummy_device_id[] = { + { .compatible = "asoc,snd-soc-dummy" }, + {} +}; +MODULE_DEVICE_TABLE(of, soc_dummy_device_id); +#endif + static struct platform_driver soc_dummy_driver = { .driver = { .name = "snd-soc-dummy", + .of_match_table = of_match_ptr(soc_dummy_device_id), }, .probe = snd_soc_dummy_probe, }; --
After 2 months of searching the internet, I managed to get it working using the simple audio driver. In order to get it in working condition, I made the following changes to the original device tree(build/workspace/sources/linux-imx/arch/arm64/boot/dts/freescaleimx8mm-evk.dtsi):
--- sound/soc/soc-utils.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c index 54dcece52b0c..892d02992b02 100644 --- a/sound/soc/soc-utils.c +++ b/sound/soc/soc-utils.c @@ -7,6 +7,8 @@ // Author: Mark Brown <broonie@opensource.wolfsonmicro.com> // Liam Girdwood <lrg@slimlogic.co.uk> +#include <linux/module.h> +#include <linux/of.h> #include <linux/platform_device.h> #include <linux/export.h> #include <sound/core.h> @@ -149,9 +151,18 @@ static int snd_soc_dummy_probe(struct platform_device *pdev) return ret; } +#ifdef CONFIG_OF +static const struct of_device_id soc_dummy_device_id[] = { + { .compatible = "asoc,snd-soc-dummy" }, + {} +}; +MODULE_DEVICE_TABLE(of, soc_dummy_device_id); +#endif + static struct platform_driver soc_dummy_driver = { .driver = { .name = "snd-soc-dummy", + .of_match_table = of_match_ptr(soc_dummy_device_id), }, .probe = snd_soc_dummy_probe, }; --
Hello,
Got it, thank you for the information!
Here is a community post were show the device tree and configuration to reach a successful microphone record with the same microphone and MPU (i.MX8MM).
I hope this information helps you.
Best regards.
Hello Jorge,
after implementing the solution form the community post you linked it does not work. The driver does not work properly as it is based on the wmxxxx drivers(wm8524) which is outdated. Currently I am trying to debug it.
Error: Failed to register card: -517
Sincerely, Ivan
Hello!
The errors:
fsl-sai 30050000.sai: ASoC: error at snd_soc_dai_hw_params on 30050000.sai: -22
[ 1875.936608] 30050000.sai-snd-soc-dummy-dai: ASoC: soc_pcm_hw_params() failed (-22)
[ 1875.944756] fsl-sai 30050000.sai: failed to derive required Rx rate: 1411200
Are related to PLL, because cannot reach that specific frequency. Our BSP works with 12288000 and 24576000.
So, I suggest try with these clock rates and verify it on Linux's clk summary:
cat /sys/kernel/debug/clk/clk_summary
And check if your clock summary is configured to desired clock rate for your configurations.
Best regards.
Hello,
Could you please provide me which digital microphone are you trying to use?
I suggest you use the reference device tree for i.MX8MM or use BSP option to handle digital microphones with PDM, for example 8MIC-RPI-MX8 with precompiled device tree.
Best regards.
Hi Jorge,
I am using the SPH0645 I2S digital microphone. And I have used that device tree for reference but to no avail!
Best regards.