Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
The purpose of this page is to describe the Linux ALSA SoC driver for SDI Embed/Extract SoftIP.

Table of contents

Table of Contents
maxLevel2

Introduction

The Xilinx® LogiCORE™ IP UHD SDI Audio Core is a soft Xilinx IP core for use with the Xilinx Vivado® Design Suite. This IP can be configured in Embed/Extract mode to provide embed PCM audio with SDI Video or extract PCM audio from SDI AV stream

.

HW IP Features

Multiple audio sample rates (32 KHz, 44.1 KHz and 48 KHz)

.

  • Audio sample length of 20/24-bit.
  • AXI4-Stream interface to carry audio samples in AES3 format.
  • Programmable maximum audio channels.

  • Typical system using SDI Rx and SDI Tx:

    Following design depicts the typical SDI embed/extract IP interfaces for audio recording and playback.

    In Embed mode, audio from a source like file storage is fed to SDI Embed via audio Formatter. SDI audio Embed core then embeds audio and video and sends to SDI Video Transmitter to transmit AV stream. Audio Formatter IP GUI should be configured in PCM_TO_AES format for this operation.

    Similarly, in Extract mode, audio Extract core extracts audio from an input SDI AV stream and gives it to Audio Formatter which converts to PCM data and writes in to memory. From memory, audio can be stored to a file. Audio Formatter IP GUI should be configured in AES_TO_PCM format for this operation.

    Image Removed

    Image Removed

    SW Driver Overview

    Image Added


    Audio Formatter is set in AES_TO_PCM for SDI Audio in extract mode and PCM_TO_AES in embed mode.

    The SDI audio Rx/Tx driver

    (sound/soc/xilinx/xlnx_sdi_audio.c)

    is based on the ALSA framework(refer ASoC sound card). This driver registers one of the 'component' expected by the ALSA framework.  This SDI audio driver along with

    audio formatter and sound card

    Audio Formatter and Sound Card drivers will create a SDI audio pipeline. Driver cannot be used as standalone.

    Kernel Configurations

    Code Block
    themeMidnight
    CONFIG_SND_SOC=y
    CONFIG_SND_SOC_XILINX_SDI=y should be enabled.

    Device Tree Bindings

    A sample binding is shown below and the description of DT property is documented at

    Documentationdevicetreebindings/sound/xlnx%2Cv-uhdsdi-txt
    Code Block
    themeMidnight
    audio_ss_0_v_uhdsdi_audio_extract_0: v_uhdsdi_audio@80080000 {
                       compatible = "xlnx,v-uhdsdi-audio-2.0";
                       interrupt-names = "interrupt";
                       interrupt-parent = <&gic>;
                       interrupts = <0 106 4>;
                       reg = <0x0 0x80080000 0x0 0x10000>;
                       xlnx,snd-pcm = <&audio_ss_0_audio_formatter_0>;
    };
    
    audio_ss_0_v_uhdsdi_audio_embed_0: v_uhdsdi_audio@80090000 {
                        compatible = "xlnx,v-uhdsdi-audio-2.0";
                        interrupt-names = "interrupt";
                        interrupt-parent = <&gic>;
                        interrupts = <0 107 4>;
                        reg = <0x0 0x80090000 0x0 0x10000>;
                        xlnx,snd-pcm = <&audio_ss_0_audio_formatter_0>;
                        sdi_av_port: port@0 {
                                reg = <0>;
                                sditx_audio_embed_src: endpoint {
                                        remote-endpoint = <&sdi_audio_sink_port>;
                                };
                      };
    };

    Guide lines

  • The SDI audio embed/extract IP requires audio embed_clk/extract_clk  as input.
  • And the configurations of these clocks is done through the Common Clock Framework(CCF) API, from the SDI audio driver.
  • The Common clock framework gets the clock source from its device tree node. example is given below.
  • As the drivers are compatible with CCF, the clock source(for audio mclk) should be compatible with CCF

    c

    IP/Driver Features

    IP Features2019.1

    Supports up to 32 channels of audio.

    Supports only 2 channels

    20/24-bit audio at multiple sample rates (32 KHz, 44.1 KHz and 48 KHz)

    Yes
    Synchronous and asynchronous audio supportYes
    Supports 192-bit AES3 channel status extractionYes
    Reports the presence and status of audio groups on the incoming SDI streamYes
    AXI4-Stream interface to carry audio samples in AES3 formatYes
    AXI4-Lite and port based interface for configuration of the coreYes


    Known Issues & Limitations

    • Only 2 channels supported.
    • Not tested for 20 bit depth.
    • AES3 data is given as debug information.


    Kernel Configurations

    Below kernel config options should be enabled.

    Code Block
    themeMidnight
    audio
    CONFIG_
    ss_0_v_uhdsdi_audio_embed_0: v_uhdsdi_audio@80090000 { clock-names = "s_axi_aclk", "s_axis_clk", "sdi_embed_clk"; clocks = <&misc_clk_0>, <&misc_clk_0>, <&misc_clk_1>; . . }; audio_ss_0_v_uhdsdi_audio_extract_0: v_uhdsdi_audio@80080000 { clock-names = "s_axi_aclk", "sdi_extract_clk", "m_axis_clk"; clocks = <&misc_clk_0>, <&misc_clk_1>, <&misc_clk_0>; . . };

    Here <&misc_clk_1> is the clock source for embed_clk and extract_clk.

    SND_SOC=y
    CONFIG_SND_SOC_XILINX_SDI=y


    Device Tree Bindings

    The dts node should be defined with correct hardware configuration. How to define the node is documented in, xlnx,v-uhdsdi-audio.txt

    Test Procedure

    The driver has been tested using following tools.

    1. ALSA Utilities.
    2. Gstreamer Utilities.
    Note: Below examples assume sound card registered is #0, playback device is #0, record device is #1.

    Procedure to test SDI audio with ALSA Utilities

    Recording a file: arecord tool is used to record the audio file.
    Following is the recording audio file with 24bit bit depth, 48khz sampling frequency and 2 channel audio properties.

    Code Block
    themeMidnight
    arecord -Dhw:0,1  -fS24_LE -r 48000 -c 2  -d 30 -t raw file.raw


    Playing a file:
     aplay tool is used to play the audio file. 

    Following is the playing audio file with 24bit bit depth, 48khz sampling frequency and 2 channel audio properties.


    Code Block
    themeMidnight
    aplay -D hw:0,0 -fS24_LE -r 48000 -c 2  -d 30 -t raw file.raw

    Procedure to test SDI audio with Gstreamer Utilities

    Recording a file: gst-launch is used to record the audio file.

    Following is the recording audio file with 24bit bit depth, 48khz sampling frequency and 2 channel audio properties. gst-launch is using alsa src plugin to enable recording with SPDIF driver.

    Code Block
    themeMidnight
    gst-launch-1.0 alsasrc device=hw:1,1 ! queue ! audio/x-raw,format=S24_32LE,rate=48000,
    channnels
    channels=2 ! filesink location=48000.raw


    Playing a file: gst-launch is used to play the audio file.

    Following is the playing audio file with 24bit bit depth, 48khz sampling frequency and 2 channel audio properties. gst-launch is using alsa sink plugin to enable playback with SPDIF driver.

    Code Block
    themeMidnight
    gst-launch-1.0 filesrc location=48000.raw ! audio/x-raw,format=S24_32LE,rate=48000,

    ...

    channels=

    ...

    2  ! alsasink device=hw:0,0

    Debug Capability

    This page provides different tools and techniques useful for debugging audio issues encountered in Linux-based systems. The document is mostly focused on the Linux operating system and also describes the build-in ALSA driver tool to debug PCM ring buffer positions.
    /proc/asound/card#/pcm0p/xrun_debug

    Replace '#' with your card number (usually 0). This proc file can enable various debugging tools. The CONFIG_SND_PCM_XRUN_DEBUG, CONFIG_SND_VERBOSE_PROCFS, CONFIG_SND_DEBUG options must be enabled in your kernel (if xrun_debug proc file is present - this feature is enabled).



    Code Block
    themeMidnight
     1   Basic debugging - show xruns in ksyslog interface
     2   Dump stack - dump stack for basic debugging
     4   Jiffies check - compare the position with kernel jiffies (a sort of in-kernel monotonic clock),
         show what's changed when basic debugging is enabled
     8   Dump positions on each period update call
     16  Dump positions on each hardware pointer update call
     32  Enable logging of last 10 ring buffer positions
     64  Show the last 10 ring buffer position only once (when first error situation occurred)
    To enable more features just do sum values of above (for example 1+2=3).
    Some good value combinations:
    Code Block
    themeMidnight
     # Enable basic debugging and dump stack
     # Usefull to just see, if PCM stream is stopped for a reason (usually wrong audio process timing from scheduler)
     echo 3 > /proc/asound/card0/pcm0p/xrun_debug

    Boards Supported

    Driver has been tested on the following boards

    1. ZCU106 Rev D
    Change log
    1. Corrected format of this page to make it uniform with the other documents.

    Related Links

  • Linux Drivers

  • Create ASoC sound Card

  • https://github.com/Xilinx/linux-xlnx/blob/master/sound/soc/xilinx/xlnx_sdi_audio.c

    Boards Supported

    Driver has been tested on the following boards

    1. ZCU106 Rev 1.0

    Change log

    2019.1

    • Summary:
      • Used Common Clock Framework(CCF) API to configure clocks.
      • Added support for audio enablement in 4K video mode.
    • Commits:
      • 424948a - ASoC: xlnx: use clock framework for clocks to SDI audio.
      • 987fdfe4 - ASoC: xlnx: add audio support in 4k mode.

    2018.3:

    • Summary
      • Initial version released

    Related Links