Open main menu

DAVE Developer's Wiki β

DESK-MX6UL-L/Peripherals/Audio

< DESK-MX6UL-L
Revision as of 09:18, 21 April 2021 by U0007 (talk | contribs)

History
Version Issue Date Notes
1.0.0 Apr 2021 First DESK release


Contents

Peripheral AudioEdit

Device tree configurationEdit

Here below an example of device tree configuration used on standard DAVE's kit for the AXEL ULite SOM:

From imx6ul-axelulite-cb006c.dts:

        sound {
                compatible = "fsl,imx-audio-tlv320aic31xx";
                model = "axelulite-audio-tlv320aic3100";
                cpu-dai = <&sai2>;
                audio-codec = <&codec>;
                audio-routing =
                        "Speaker", "SPK",
                        "Headphone Jack", "HPL",
                        "Headphone Jack", "HPR",
                        "MIC1LP", "Line In",
                        "MIC1LM", "Line In",
                        "MIC1RP", "Mic Jack",
                        "Mic Jack", "MICBIAS";
                status = "okay";
        };

&i2c4 {
        clock-frequency = <100000>;
        pinctrl-names = "default", "recovery";
        pinctrl-0 = <&pinctrl_i2c4>;
        pinctrl-1 = <&pinctrl_i2c4_recovery>;
        recovery-gpios = <&gpio1 20 0>, <&gpio1 21 0>;
        status = "okay";

        codec: tlv320aic31xx@18 {
                compatible = "ti,tlv320aic3100";
                reg = <0x18>;
                clocks = <&clks IMX6UL_CLK_SAI2>,
                       <&clks IMX6UL_CLK_DUMMY>;
                clock-names = "mclk1", "mclk2";

                gpio-reset = <&gpio1 27 1>;
                HPVDD-supply = <&reg_3p3v>;
                SPRVDD-supply = <&reg_3p3v>;
                SPLVDD-supply = <&reg_3p3v>;
                AVDD-supply = <&reg_3p3v>;
                IOVDD-supply = <&reg_3p3v>;
                DVDD-supply = <&reg_1p8v>;
        };
...
...
&iomuxc {
        pinctrl-0 = <&pinctrl_hog_gpios>;
        imx6ul-axelulite {

        tlv320aic3x {
                pinctrl_tlv320aic3x_1: tlv320aic3x_codecgrp-1{
                        fsl,pins = <
                                MX6UL_PAD_JTAG_TDI__SAI2_TX_BCLK        0x17088
                                MX6UL_PAD_JTAG_TDO__SAI2_TX_SYNC        0x17088
                                MX6UL_PAD_JTAG_TRST_B__SAI2_TX_DATA     0x11088
                                MX6UL_PAD_JTAG_TCK__SAI2_RX_DATA        0x11088
                                MX6UL_PAD_JTAG_TMS__SAI2_MCLK           0x17088
                                MX6UL_PAD_UART3_RTS_B__GPIO1_IO27       0x130b0 /* codec reset */
                        >;
                };
        };

};


Accessing the peripheralEdit

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 timeEdit

...
...
[    3.314515] imx-tlv320aic31xx sound: tlv320aic31xx-hifi <-> 202c000.sai mapping ok
...
...
[    3.545396] ALSA device list:
[    3.548401]   #0: axelulite-audio-tlv320aic3100

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

root@desk-mx6ul-axelulite:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: axeluliteaudiot [axelulite-audio-tlv320aic3100], device 0: HiFi tlv320aic31xx-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
root@desk-mx6ul-axelulite:~#

Usage alsa-utilsEdit

root@desk-mx6ul-axelulite:~# aplay audio8k16S.wav 
Playing WAVE 'audio8k16S.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Stereo