Hi,
We are trying to setup an I2S slave on Apalis iMX8.
I have added this to our custom device tree:
/ {
codec_custom: codec_custom {
compatible = "linux,snd-soc-dummy";
#sound-dai-cells = <0>;
};
sound_custom {
compatible = "simple-audio-card";
simple-audio-card,name = "custom";
simple-audio-card,format = "i2s";
simple-audio-card,frame-master = <&custom_codec>;
simple-audio-card,bitclock-master = <&custom_codec>;
custom_sai: simple-audio-card,cpu {
sound-dai = <&sai2>;
};
custom_codec: simple-audio-card,codec {
sound-dai = <&codec_custom>;
};
};
};
pinctrl_sai2: sai2grp {
fsl,pins = <
IMX8QM_ESAI1_TX0_AUD_SAI2_RXD 0xc600004c
IMX8QM_ESAI1_TX1_AUD_SAI2_RXFS 0xc600004c
IMX8QM_ESAI1_SCKT_AUD_SAI2_RXC 0xc600004c
>;
};
&sai2 {
#sound-dai-cells = <0>;
assigned-clocks = <&clk IMX_SC_R_AUDIO_PLL_0 IMX_SC_PM_CLK_PLL>,
<&clk IMX_SC_R_AUDIO_PLL_0 IMX_SC_PM_CLK_SLV_BUS>,
<&clk IMX_SC_R_AUDIO_PLL_0 IMX_SC_PM_CLK_MST_BUS>,
<&sai1_lpcg 0>;
assigned-clock-rates = <786432000>, <49152000>, <12288000>, <49152000>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_sai2>;
fsl,sai-asynchronous;
status = "okay";
};
I have also added this patch to the yocto build
diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c
index c5f809d3a710c..e2d475925f50e 100644
--- a/sound/soc/soc-utils.c
+++ b/sound/soc/soc-utils.c
@@ -13,6 +13,7 @@
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
+#include <linux/module.h>
int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots)
{
@@ -152,9 +153,17 @@ static int snd_soc_dummy_probe(struct platform_device *pdev)
return ret;
}
+static const struct of_device_id soc_dummy_ids[] = {
+ { .compatible = "linux,snd-soc-dummy", },
+ {},
+};
+
+
+
static struct platform_driver soc_dummy_driver = {
.driver = {
.name = "snd-soc-dummy",
+ .of_match_table = of_match_ptr(soc_dummy_ids),
},
.probe = snd_soc_dummy_probe,
};
I get the sound cards listed:
root@881304ff64ec:/app# arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: imxspdif [imx-spdif], device 0: S/PDIF PCM snd-soc-dummy-dai-0 [S/PDIF PCM snd-soc-dummy-dai-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: apalisimx8qmsgt [apalis-imx8qm-sgtl5000], device 0: 59050000.sai-sgtl5000 sgtl5000-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: custom [custom], device 0: 59040000.sai-snd-soc-dummy-dai snd-soc-dummy-dai-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
I have a nice i2s stream with BCLK, WCLK, DATA connected toApalis iMX8 pins 198, 164, 35. I can view the logic levels and decode them with my logic analyzer software.
I am testing on an Apalis Evaluation board and have removed C115 to get a better signal on the data line.
I am running arecord -D plughw:2,0 -f S16_LE -c2 -r48000 -d 10 output.wav 1
from within a Docker with privileges. The output.wav gets recorded, but the wav-file is empty, as if there was no input signal.
What might i be missing?