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

From DAVE Developer's Wiki
Jump to: navigation, search
(Created page with "{{subst:Peripheral | nome-som=AXEL Lite | nome-peripheral = Audio}}")
 
Line 7: Line 7:
 
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Notes
 
!style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#73B2C7; padding:5px; color:white"|Notes
 
|-
 
|-
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|X.Y.Z
+
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|1.0.0
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|Month Year
+
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|Oct 2020
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|TBD
+
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|First DESK release
|-
 
|-
 
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|[TBD_link X.Y.Z]
 
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|Month Year
 
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|TBD
 
|-
 
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|...
 
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|...
 
|style="border-left:solid 2px #73B2C7; border-right:solid 2px #73B2C7;border-top:solid 2px #73B2C7; border-bottom:solid 2px #73B2C7; background-color:#edf8fb; padding:5px; color:#000000"|...
 
|-
 
 
|}
 
|}
 
<section end=History/>
 
<section end=History/>
Line 26: Line 16:
 
==Peripheral Audio ==
 
==Peripheral Audio ==
  
''TBD: sostituire tutti i dump con le informazioni sull'uso della periferica''
+
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 ===
 
=== Device tree configuration ===
 
Here below an example of device tree configuration used on standard DAVE's kit for the AXEL Lite SOM:
 
Here below an example of device tree configuration used on standard DAVE's kit for the AXEL Lite SOM:
  
From <code>''carrier.dts''</code>:
+
From <code>imx6qdl-sbcx-revb-common.dtsi</code> it is possible to find the codec SSI interface configuration:
  
 
<pre>
 
<pre>
&can1 {
+
    sound {
 +
        compatible = "fsl,imx-audio-tlv320aic31xx";
 +
        model = "sbcx-audio-tlv320aic3100";
 +
        ssi-controller = <&ssi1>;
 +
        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";
 +
        mux-int-port = <1>;
 +
        mux-ext-port = <3>;
 +
        status = "okay";
 +
    };
 +
...
 +
...
 +
&audmux {
 
     pinctrl-names = "default";
 
     pinctrl-names = "default";
     pinctrl-0 = <&pinctrl_flexcan1_axel>;
+
     pinctrl-0 = <&pinctrl_tlv320aic3x_1>;
 
     status = "okay";
 
     status = "okay";
 
};
 
};
</pre>
 
  
From <code>''carrier-common.dtsi''</code>:
+
&ssi1 {
 +
    status = "okay";
 +
};
 +
...
 +
...
 +
&iomuxc {
 +
    pinctrl-names = "default";
 +
    pinctrl-0 = <&pinctrl_hog_sbcx>;
 +
...
 +
...
 +
    tlv320aic3x {
 +
        pinctrl_tlv320aic3x_1: tlv320aic3x_codecgrp-1{
 +
            fsl,pins = <
 +
                MX6QDL_PAD_CSI0_DAT5__AUD3_TXD 0x130b0
 +
                MX6QDL_PAD_CSI0_DAT6__AUD3_TXFS 0x130b0
 +
                MX6QDL_PAD_CSI0_DAT7__AUD3_RXD 0x130b0
 +
                MX6QDL_PAD_CSI0_DAT4__AUD3_TXC 0x130b0
 +
                MX6QDL_PAD_GPIO_3__XTALOSC_REF_CLK_24M 0x130b0
  
<pre>
+
                 MX6QDL_PAD_GPIO_4__GPIO1_IO04 0x130b0
    can1 {
 
        pinctrl_flexcan1_axel: flexcan1axelgrp-1 {
 
            fsl,pins = <
 
                 MX6QDL_PAD_GPIO_7__FLEXCAN1_TX 0x80000000
 
                MX6QDL_PAD_GPIO_8__FLEXCAN1_RX 0x80000000
 
 
             >;
 
             >;
 
         };
 
         };
 
     };
 
     };
 +
 
</pre>
 
</pre>
  
 
===Accessing the peripheral===
 
===Accessing the peripheral===
 +
 +
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====
 
====Linux messages at boot time====
  
Line 60: Line 84:
 
...
 
...
 
...
 
...
[    1.807495] flexcan 2090000.flexcan: 2090000.flexcan supply xceiver not found, using dummy regulator
+
[    4.497470] fsl-ssi-dai 2028000.ssi: No cache defaults, reading back from HW
[    1.817366] flexcan 2090000.flexcan: device registered (reg_base=c0a30000, irq=31)
+
[    4.507593] imx-tlv320aic31xx sound: tlv320aic31xx-hifi <-> 2028000.ssi mapping ok
 
...
 
...
 
...
 
...
[    3.952659] can: controller area network core (rev 20170425 abi 9)
+
[    4.843623] ALSA device list:
[    3.963413] can: raw protocol (rev 20170425)
+
[    4.846599]   #0: sbcx-audio-tlv320aic3100
[    3.967717] can: broadcast manager protocol (rev 20170425 t)
 
[    3.973397] can: netlink gateway (rev 20170425) max_hops=1
 
 
</pre>
 
</pre>
  
====Enable the interface and check status====
+
To list the audio sound cards just use the <code>aplay</code> utility:
 +
 
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
root@imx6qxelk:~# ip link set can0 type can bitrate 500000
+
root@imx6qxelk:~# aplay -l
root@imx6qxelk:~# ifconfig can0 up
+
**** List of PLAYBACK Hardware Devices ****
root@imx6qxelk:~# ifconfig can0
+
card 0: sbcxaudiotlv320 [sbcx-audio-tlv320aic3100], device 0: HiFi
can0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
+
sgtl5000-0 []
          UP RUNNING NOARP  MTU:16  Metric:1
+
  Subdevices: 1/1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
+
  Subdevice #0: subdevice #0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
+
root@imx6qxelk:~#  
          collisions:0 txqueuelen:10
 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
 
          Interrupt:31
 
 
 
root@imx6qxelk:~#
 
 
</pre>
 
</pre>
  
==== Usage with [https://github.com/linux-can/can-utils can-utils] ====
+
====Usage [https://alsa-project.org/wiki/Documentation alsa-utils] ====
 
 
''TBD: reference verso eventuali informazioni sul web''
 
  
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
root@imx6qxelk:~# ip link set can0 type can bitrate 500000 triple-sampling on
+
root@imx6qxelk:~# aplay audio8k16S.wav
root@imx6qxelk:~# ifconfig can0 up
+
Playing WAVE 'audio8k16S.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Stereo
root@imx6qxelk:~# cansend can0 128#1122334455667788
 
root@imx6qxelk:~# candump can0
 
  can0  128  [8]  11 22 33 44 55 66 77 88
 
root@imx6qxelk:~#
 
 
</pre>
 
</pre>
  
 
=== Additional information ===
 
=== Additional information ===
Each CAN port appears like a networking interface in the form <code>canX</code> where <b><i>X</i></b> is the port number.
 
  
Information about programming the CAN socket interface is given in the kernel tree under ''Documentation/networking/can.txt''
+
Information about ''alsa-utils'' can be found on [https://alsa-project.org/wiki/Documentation ALSA project wiki pages]
 
<section end=Body/>
 
<section end=Body/>
  

Revision as of 17:57, 8 October 2020

History
Version Issue Date Notes
1.0.0 Oct 2020 First DESK 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]

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

From imx6qdl-sbcx-revb-common.dtsi it is possible to find the codec SSI interface configuration:

    sound {
        compatible = "fsl,imx-audio-tlv320aic31xx";
        model = "sbcx-audio-tlv320aic3100";
        ssi-controller = <&ssi1>;
        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";
        mux-int-port = <1>;
        mux-ext-port = <3>;
        status = "okay";
    };
...
...
&audmux {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_tlv320aic3x_1>;
    status = "okay";
};

&ssi1 {
    status = "okay";
};
...
...
&iomuxc {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_hog_sbcx>;
...
...
    tlv320aic3x {
        pinctrl_tlv320aic3x_1: tlv320aic3x_codecgrp-1{
            fsl,pins = <
                MX6QDL_PAD_CSI0_DAT5__AUD3_TXD 0x130b0
                MX6QDL_PAD_CSI0_DAT6__AUD3_TXFS 0x130b0
                MX6QDL_PAD_CSI0_DAT7__AUD3_RXD 0x130b0
                MX6QDL_PAD_CSI0_DAT4__AUD3_TXC 0x130b0
                MX6QDL_PAD_GPIO_3__XTALOSC_REF_CLK_24M 0x130b0

                MX6QDL_PAD_GPIO_4__GPIO1_IO04 0x130b0
            >;
        };
    };

Accessing the peripheral[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]

...
...
[    4.497470] fsl-ssi-dai 2028000.ssi: No cache defaults, reading back from HW
[    4.507593] imx-tlv320aic31xx sound: tlv320aic31xx-hifi <-> 2028000.ssi mapping ok
...
...
[    4.843623] ALSA device list:
[    4.846599]   #0: sbcx-audio-tlv320aic3100

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

root@imx6qxelk:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sbcxaudiotlv320 [sbcx-audio-tlv320aic3100], device 0: HiFi 
sgtl5000-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
root@imx6qxelk:~# 

Usage alsa-utils[edit | edit source]

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

Additional information[edit | edit source]

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