iMX93 - Using SAI in PCM mode (no external codec)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iMX93 - Using SAI in PCM mode (no external codec)

Jump to solution
790 Views
Stefano_Radaelli
Contributor I

Hi everyone,
I'm working on an i.MX93-based board and I'm trying to use one of the SAI interfaces (specifically SAI3) in PCM mode to connect directly to a Quectel GSM module.

The module exposes PCM lines (DIN, DOUT, CLK, SYNC) and also an I2C interface to communicate with an external codec. According to Quectel's documentation, audio can be transmitted directly over PCM without the need for an external audio codec, the module already should have an internal codec.

My goal is to route call audio to/from the module directly via PCM.

I’d like to ask:

  1. Is it possible to use the i.MX93 SAI interface in PCM mode without a codec?

  2. Has anyone already done this kind of setup on i.MX93 (or similar NXP SoCs)?

  3. What is the recommended Device Tree configuration for this kind of direct PCM connection (SAI <-> MODULE)?

  4. Is an audio-card node still needed in the device tree even if there's no codec?

Any advice or pointers to examples would be greatly appreciated!

Thanks in advance,

Stefano

0 Kudos
Reply
1 Solution
754 Views
dbaluta
NXP Employee
NXP Employee

Hello,

You can have a look at this thread from ALSA mailing list: https://www.spinics.net/linux/fedora/linux-sound/msg22016.html

Besides the discussion above you can try to use the dummy codec (not recommended, not accepted by the community, but you can have it a try for testing purposes).

Something like this:

DTS file:

+ codec_test: codec_test {
+ #sound-dai-cells = <0>;
+ compatible = "linux,snd-soc-dummy";
+ };
+
+ sound-test {
+ compatible = "simple-audio-card";
+ simple-audio-card,name = "sai-audio-card";
+ simple-audio-card,format = "left_j";
+ simple-audio-card,bitclock-master = <&sai_cpu>;
+ simple-audio-card,frame-master = <&sai_cpu>;
+ status = "disabled";
+ sai_cpu: simple-audio-card,cpu {
+ sound-dai = <&sai1>;
+ dai-tdm-slot-num = <2>;
+ dai-tdm-slot-width = <32>;
+ };
+ simple-audio-card,codec {
+ sound-dai = <&codec_test>;
+ };
+ };
+

 

--- a/sound/soc/soc-utils.c
+++ b/sound/soc/soc-utils.c

+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,
};

 

View solution in original post

0 Kudos
Reply
2 Replies
755 Views
dbaluta
NXP Employee
NXP Employee

Hello,

You can have a look at this thread from ALSA mailing list: https://www.spinics.net/linux/fedora/linux-sound/msg22016.html

Besides the discussion above you can try to use the dummy codec (not recommended, not accepted by the community, but you can have it a try for testing purposes).

Something like this:

DTS file:

+ codec_test: codec_test {
+ #sound-dai-cells = <0>;
+ compatible = "linux,snd-soc-dummy";
+ };
+
+ sound-test {
+ compatible = "simple-audio-card";
+ simple-audio-card,name = "sai-audio-card";
+ simple-audio-card,format = "left_j";
+ simple-audio-card,bitclock-master = <&sai_cpu>;
+ simple-audio-card,frame-master = <&sai_cpu>;
+ status = "disabled";
+ sai_cpu: simple-audio-card,cpu {
+ sound-dai = <&sai1>;
+ dai-tdm-slot-num = <2>;
+ dai-tdm-slot-width = <32>;
+ };
+ simple-audio-card,codec {
+ sound-dai = <&codec_test>;
+ };
+ };
+

 

--- a/sound/soc/soc-utils.c
+++ b/sound/soc/soc-utils.c

+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,
};

 

0 Kudos
Reply
677 Views
Stefano_Radaelli
Contributor I
Thank you so much!

After using a dummy codec and after changing some configuration in Quectel module, I finally made it working (also using i2s instead of pcm)
0 Kudos
Reply