Difference between revisions of "DESK-MX8M-L/Peripherals/Audio"

From DAVE Developer's Wiki
Jump to: navigation, search
(Created page with "<section begin="History" /> {| style="border-collapse:collapse; " !colspan="4" style="width:100%; text-align:left"; border-bottom:solid 2px #ededed"|History |- !style="border...")
 
Line 20: Line 20:
  
 
=== Device tree configuration ===
 
=== Device tree configuration ===
Here below an example of device tree configuration used on standard DAVE's kit for the AXEL Lite SOM:
 
  
From <code>imx6qdl-sbcx-revb-common.dtsi</code> it is possible to find the codec SSI interface configuration:
+
==== MITO 8M Mini ====
 +
Here below an example of device tree configuration used on standard DAVE's kit for MITO 8M Mini:
 +
 
 +
From <code>imx8mm-mito8mmini.dts</code> it is possible to find the codec SSI interface configuration:
  
 
<pre>
 
<pre>
 +
...
 +
...
 
     sound {
 
     sound {
        compatible = "fsl,imx-audio-tlv320aic31xx";
+
compatible = "simple-audio-card";
        model = "sbcx-audio-tlv320aic3100";
+
simple-audio-card,format = "i2s";
        ssi-controller = <&ssi1>;
+
simple-audio-card,name = "SBCX_TLV320";
        audio-codec = <&codec>;
+
simple-audio-card,bitclock-master = <&codec_dai>;
        audio-routing =
+
simple-audio-card,frame-master = <&codec_dai>;
            "Speaker", "SPK",
+
simple-audio-card,widgets =
            "Headphone Jack", "HPL",
+
"Headphone", "Headphone Jack",
            "Headphone Jack", "HPR",
+
"Line", "Line In",
            "MIC1LP", "Line In",
+
"Microphone", "Mic Jack";
            "MIC1LM", "Line In",
+
simple-audio-card,routing =
            "MIC1RP", "Mic Jack",
+
"Speaker", "SPK",
            "Mic Jack", "MICBIAS";
+
"Headphone Jack", "HPL",
        mux-int-port = <1>;
+
"Headphone Jack", "HPR",
        mux-ext-port = <3>;
+
"MIC1LP", "Line In",
        status = "okay";
+
"MIC1LM", "Line In",
    };
+
"MIC1RP", "Mic Jack",
 +
"Mic Jack", "MICBIAS";
 +
 
 +
simple-audio-card,cpu {
 +
sound-dai = <&sai2>;
 +
};
 +
 
 +
codec_dai: simple-audio-card,codec {
 +
sound-dai = <&codec>;
 +
system-clock-frequency = <24000000>;
 +
};
 +
};
 +
 
 
...
 
...
 
...
 
...
&audmux {
+
&sai2 {
    pinctrl-names = "default";
+
#sound-dai-cells = <0>;
    pinctrl-0 = <&pinctrl_tlv320aic3x_1>;
+
pinctrl-names = "default";
    status = "okay";
+
pinctrl-0 = <&pinctrl_sai2>;
};
+
pinctrl-1 = <&pinctrl_codec_en>;
 
+
clocks = <&clk IMX8MM_CLK_SAI2_ROOT>;
&ssi1 {
+
assigned-clocks = <&clk IMX8MM_CLK_SAI2>;
    status = "okay";
+
assigned-clock-parents = <&clk IMX8MM_AUDIO_PLL1_OUT>;
 +
assigned-clock-rates = <24576000>;
 +
status = "okay";
 
};
 
};
 
...
 
...
 
...
 
...
 
&iomuxc {
 
&iomuxc {
    pinctrl-names = "default";
 
    pinctrl-0 = <&pinctrl_hog_sbcx &pinctrl_hog_sbcx_one_piece>;
 
 
...
 
...
 
...
 
...
    tlv320aic3x {
+
  pinctrl_sai2: sai2grp {
        pinctrl_tlv320aic3x_1: tlv320aic3x_codecgrp-1{
+
fsl,pins = <
            fsl,pins = <
+
MX8MM_IOMUXC_SAI2_MCLK_SAI2_MCLK 0xd6
                MX6QDL_PAD_CSI0_DAT5__AUD3_TXD 0x130b0
+
MX8MM_IOMUXC_SAI2_TXFS_SAI2_TX_SYNC 0xd6
                MX6QDL_PAD_CSI0_DAT6__AUD3_TXFS 0x130b0
+
MX8MM_IOMUXC_SAI2_TXC_SAI2_TX_BCLK 0xd6
                MX6QDL_PAD_CSI0_DAT7__AUD3_RXD 0x130b0
+
MX8MM_IOMUXC_SAI2_TXD0_SAI2_TX_DATA0 0xd6
                MX6QDL_PAD_CSI0_DAT4__AUD3_TXC 0x130b0
+
MX8MM_IOMUXC_SAI2_RXFS_SAI2_RX_SYNC 0xd6
                MX6QDL_PAD_GPIO_3__XTALOSC_REF_CLK_24M 0x130b0
+
MX8MM_IOMUXC_SAI2_RXC_SAI2_RX_BCLK 0xd6
 
+
MX8MM_IOMUXC_SAI2_RXD0_SAI2_RX_DATA0 0xd6
                MX6QDL_PAD_GPIO_4__GPIO1_IO04 0x130b0
+
>;
            >;
+
};
        };
+
...
    };
+
pinctrl_codec_en: codecen {
 
+
fsl,pins = <
 +
MX8MM_IOMUXC_SAI3_RXFS_GPIO4_IO28 0x19
 +
>;
 +
};
 +
...
 +
...
 
</pre>
 
</pre>
  
===Accessing the peripheral===
+
===Accessing the peripheral in MITO 8M Mini===
  
 
Access to the audio interface is provided by ALSA (Advanced Linux Sound Architecture), which consists in a kernel driver and a users space library for application developers. A set of standard tools ''alsa-utils'' can be used for simple management of the audio codec.
 
Access to the audio interface is provided by ALSA (Advanced Linux Sound Architecture), which consists in a kernel driver and a users space library for application developers. A set of standard tools ''alsa-utils'' can be used for simple management of the audio codec.
Line 85: Line 106:
 
...
 
...
 
...
 
...
[    5.071782] fsl-ssi-dai 2028000.ssi: No cache defaults, reading back from HW
+
[    5.259739] debugfs: Directory '30020000.sai' with parent 'SBCX_TLV320' already present!
 +
[    5.267980] asoc-simple-card sound: tlv320aic31xx-hifi <-> 30020000.sai mapping ok
 
...
 
...
 
...
 
...
[    5.624473] ALSA device list:
+
[    5.454902] ALSA device list:
[    5.635031]  #0: sbcx-audio-tlv320aic3100
+
[    5.454906]  #0: SBCX_TLV320
 
</pre>
 
</pre>
  
Line 95: Line 117:
  
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
root@desk-mx6:~# aplay -l
+
root@desk-mx8mm:~# aplay -l
 
**** List of PLAYBACK Hardware Devices ****
 
**** List of PLAYBACK Hardware Devices ****
card 0: sbcxaudiotlv320 [sbcx-audio-tlv320aic3100], device 0: HiFi tlv320aic31xx-hifi-0 [HiFi tlv320aic31xx-hifi-0]
+
card 0: SBCXTLV320 [SBCX_TLV320], device 0: 30020000.sai-tlv320aic31xx-hifi tlv320aic31xx-hifi-0 []
 
   Subdevices: 1/1
 
   Subdevices: 1/1
 
   Subdevice #0: subdevice #0
 
   Subdevice #0: subdevice #0
 +
root@desk-mx8mm:~#
 
</pre>
 
</pre>
  
Line 105: Line 128:
  
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
root@desk-mx6:~# aplay /home/root/rootfs/unit_tests/ASRC/audio8k16S.wav
+
root@desk-mx8mm:~# aplay M1F1-int16-AFsp.wav
Playing WAVE '/home/root/rootfs/unit_tests/ASRC/audio8k16S.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Stereo
+
Playing WAVE 'M1F1-int16-AFsp.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Stereo
 
</pre>In order to unmute the speaker the <code>alsamixer</code> utility can be used.
 
</pre>In order to unmute the speaker the <code>alsamixer</code> utility can be used.
  

Revision as of 11:55, 16 February 2023

History
ID# Issue Date Notes

xxxx

16/02/2023 DESK-MX8M-L 2.0.0 release


Peripheral Audio[edit | edit source]

Access to the audio interface is provided by ALSA (Advanced Linux Sound Architecture), which consists in a kernel driver and a users space library for application developers. A set of standard tools (alsa-utils) can be used for simple management of the audio codec.

Device tree configuration[edit | edit source]

MITO 8M Mini[edit | edit source]

Here below an example of device tree configuration used on standard DAVE's kit for MITO 8M Mini:

From imx8mm-mito8mmini.dts it is possible to find the codec SSI interface configuration:

...
...
    sound {
		compatible = "simple-audio-card";
		simple-audio-card,format = "i2s";
		simple-audio-card,name = "SBCX_TLV320";
		simple-audio-card,bitclock-master = <&codec_dai>;
		simple-audio-card,frame-master = <&codec_dai>;
		simple-audio-card,widgets =
			"Headphone", "Headphone Jack",
			"Line", "Line In",
			"Microphone", "Mic Jack";
		simple-audio-card,routing =
						"Speaker", "SPK",
						"Headphone Jack", "HPL",
						"Headphone Jack", "HPR",
						"MIC1LP", "Line In",
						"MIC1LM", "Line In",
						"MIC1RP", "Mic Jack",
						"Mic Jack", "MICBIAS";

		simple-audio-card,cpu {
			sound-dai = <&sai2>;
		};

		codec_dai: simple-audio-card,codec {
			sound-dai = <&codec>;
			system-clock-frequency = <24000000>;
		};
	};

...
...
&sai2 {
	#sound-dai-cells = <0>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_sai2>;
	pinctrl-1 = <&pinctrl_codec_en>;
	clocks = <&clk IMX8MM_CLK_SAI2_ROOT>;
	assigned-clocks = <&clk IMX8MM_CLK_SAI2>;
	assigned-clock-parents = <&clk IMX8MM_AUDIO_PLL1_OUT>;
	assigned-clock-rates = <24576000>;
	status = "okay";
};
...
...
&iomuxc {
...
...
   	pinctrl_sai2: sai2grp {
		fsl,pins = <
			MX8MM_IOMUXC_SAI2_MCLK_SAI2_MCLK		0xd6
			MX8MM_IOMUXC_SAI2_TXFS_SAI2_TX_SYNC		0xd6
			MX8MM_IOMUXC_SAI2_TXC_SAI2_TX_BCLK		0xd6
			MX8MM_IOMUXC_SAI2_TXD0_SAI2_TX_DATA0	0xd6
			MX8MM_IOMUXC_SAI2_RXFS_SAI2_RX_SYNC		0xd6
			MX8MM_IOMUXC_SAI2_RXC_SAI2_RX_BCLK		0xd6
			MX8MM_IOMUXC_SAI2_RXD0_SAI2_RX_DATA0	0xd6
		>;
	};
...
	pinctrl_codec_en: codecen {
		fsl,pins = <
			MX8MM_IOMUXC_SAI3_RXFS_GPIO4_IO28			 0x19
		>;
	};
...
...

Accessing the peripheral in MITO 8M Mini[edit | edit source]

Access to the audio interface is provided by ALSA (Advanced Linux Sound Architecture), which consists in a kernel driver and a users space library for application developers. A set of standard tools alsa-utils can be used for simple management of the audio codec.

Linux messages at boot time[edit | edit source]

...
...
[    5.259739] debugfs: Directory '30020000.sai' with parent 'SBCX_TLV320' already present!
[    5.267980] asoc-simple-card sound: tlv320aic31xx-hifi <-> 30020000.sai mapping ok
...
...
[    5.454902] ALSA device list:
[    5.454906]   #0: SBCX_TLV320

To list the audio sound cards just use the aplay utility:

root@desk-mx8mm:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: SBCXTLV320 [SBCX_TLV320], device 0: 30020000.sai-tlv320aic31xx-hifi tlv320aic31xx-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
root@desk-mx8mm:~#

Usage alsa-utils[edit | edit source]

root@desk-mx8mm:~# aplay M1F1-int16-AFsp.wav
Playing WAVE 'M1F1-int16-AFsp.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Stereo

In order to unmute the speaker the alsamixer utility can be used.

Additional information[edit | edit source]

Information about alsa-utils can be found on ALSA project wiki pages