Xilinx ALSA ASoC driver

Introduction

The purpose of this page is to describe the Xilinx ALSA sound card driver based on ASoC framework.

Xilinx ASoC audio driver architecture has the characteristics of high code re-usability and modularity. This solution is tested using ALSA applications (arecord/aplay) and GStreamer.  Xilinx ASoC architecture extends ALSA framework to support in embedded audio system.

An Audio Sound card has following components in software:


 A sound card, encapsulating playback and capture devices will be visible as single entity to the end user. There can be many playback and capture devices within a sound card and there can be multiple sound cards in a system.

The role of machine driver is to create a pipeline out of the mentioned drivers above. This glue or DAI(Digital Audio Interface) link is made using registered device names or device nodes (using OF kernel framework). Each proper DAI link will result as a device in a sound card. A sound card is thus a logical grouping of several such devices.

Audio Formatter driver is responsible for creating the 'platform device' for the sound card. While creating the device, it passes the device tree node of either I2S/HDMI/SDI/SPDIF depending on the kind of sound card being created. The node of I2S/HDMI/SDI/SDPDIF also carries a reference to phandle of audio formatter node depicting the pipeline used in the system solution. Once, sound card driver detects the kind of audio node (I2S/HDMI/SDI/SPDIF), proper DAI link is selected from the available links.

The driver is available at, https://github.com/Xilinx/linux-xlnx/blob/master/sound/soc/xilinx/xlnx_pl_snd_card.c.

DAI link describes the components which creates an audio pipeline. Following are the DAI links used in the driver: 

Note: One of the link component 'platform_of_node' pointing to Audio Formatter node  is common in all the links.

static struct snd_soc_dai_link xlnx_snd_dai[][XLNX_MAX_PATHS] = {
[I2S_AUDIO] = {
                {
                        .name = "xilinx-i2s_playback",
                        .codec_dai_name = "snd-soc-dummy-dai",
                        .codec_name = "snd-soc-dummy",
                        .ops = &xlnx_i2s_card_ops,
                },
                {
                        .name = "xilinx-i2s_capture",
                        .codec_dai_name = "snd-soc-dummy-dai",
                        .codec_name = "snd-soc-dummy",
                        .ops = &xlnx_i2s_card_ops,
                },
        },
[HDMI_AUDIO] = {
                {
                        .name = "xilinx-hdmi-playback",
                        .codec_dai_name = "i2s-hifi",
                        .codec_name = "hdmi-audio-codec.0",
                        .cpu_dai_name = "snd-soc-dummy-dai",
                },
                {
                        .name = "xilinx-hdmi-capture",
                        .codec_dai_name = "xlnx_hdmi_rx",
                        .cpu_dai_name = "snd-soc-dummy-dai",
                },
        },

[SDI_AUDIO] = {
                {
                        .name = "xlnx-sdi-playback",
                        .codec_dai_name = "xlnx_sdi_tx",
                        .cpu_dai_name = "snd-soc-dummy-dai",
                },
                {
                        .name = "xlnx-sdi-capture",
                        .codec_dai_name = "xlnx_sdi_rx",
                        .cpu_dai_name = "snd-soc-dummy-dai",
                },

        },
[SPDIF_AUDIO] = {
                {
                        .name = "xilinx-spdif_playback",
                        .codec_dai_name = "snd-soc-dummy-dai",
                        .codec_name = "snd-soc-dummy",
                },
                {
                        .name = "xilinx-spdif_capture",
                        .codec_dai_name = "snd-soc-dummy-dai",
                        .codec_name = "snd-soc-dummy",
                },
}, 


HW IP Features

This is a logical driver hence not applicable.

Driver Features

Features2019.1
Multiple sample rate supportYes

Known Issues & Limitations

  1. The driver is tested only with the following Xilinx audio drivers.
    1. I2S
    2. HDMI
    3. SDI
    4. SPDIF

Kernel Configurations

Below driver configuration should be enabled.

CONFIG_SND_SOC_XILINX_PL_SND_CARD=y

Device tree binding

This is a logical driver hence not applicable.

Test Procedure

The registered sound cards(along with its playback and capture devices) can be found at /proc/asound/cardX.


#ls /proc/asound/card0/
id    pcm0p pcm1c

Refer to the links provided in the Related Links section to use the soundcard.

Change Log

2020.1

2019.2

  • Summary
    • No changes

2019.1

  • Summary:
    • Enabled multi sample rate support for SDI, HDMI, SPDIF and I2S.
    • Added support for multiple instances of sound cards.
    • Added SPDIF Sound card.
  • Commits:
    • d38322a - ASoC: xlnx: revert HDMI audio mclk mutliplier.
    • 0ec0420 - ASoC: xlnx: change HDMI audio mclk .
    • 19c7d88 - ASoC: xlnx: add multi sample rate support for SDI audio.
    • 8377cdb - ASoC: xlnx: enable multi sample rate support for SPDIF sound card.
    • 6d04559 - ASoC: xlnx: enable multi sample rate support for HDMI sound card.
    • 81edb2b - ASoC: xlnx: enable multi sample rate support for I2S sound card.
    • 621e5f3  - ASoC: xlnx: support multiple instances of sound card.
    • 4e4eec6 - ASoC: xlnx: add SPDIF sound card support.
    • 4f2a3d9  - ASoC: xlnx: Disable clock wizard usage in audio driver.
    • 75984ce - ASoC: xlnx: support multiple sampling rates for SDI.
    • 0600da4 - ASoC: xlnx: support multiple sampling rates for HDMI.
    • d69a510 - ASoC: xlnx: support multiple sampling rates for I2S.

2018.3:

  • Summary
    • Initial release

Related Links

© Copyright 2019 - 2022 Xilinx Inc. Privacy Policy