Xilinx ALSA SPDIF driver

The purpose of this page is to describe the Linux ALSA SoC driver for SPDIF transmitter/receiver SoftIP.

Table of contents

Introduction

The LogiCORE IP SPDIF/AES3 core is a digital audio interface controller that implements the PCM IEC 60958-3 interface features for transmitting and receiving audio data. The core can be configured as an SPDIF/AES3 audio data transmitter or an SPDIF/AES3 audio data receiver.

Typical System Using SPDIF Rx and Tx:

Following design depicts the typical SPDIF transmitter/receiver IP interfaces for audio playback and recording. In transmitter mode, audio from a source like file storage is fed to SPDIF IP block configured in transmitter mode via Audio Formatter. Similarly, in receiver mode, incoming SPDIF audio is fed to SPDIF IP configured as receiver then given to Audio Formatter IP and sent to DDR from which it can be saved to a file as PCM audio.

The SPDIF audio Rx/Tx driver is based on the ALSA framework(refer ASoC sound card). This driver registers one of the 'component' expected by the ALSA framework.This SPDIF audio driver along with Audio Formatter and sound card drivers will create a SPDIF audio pipeline. Driver cannot be used as standalone. The driver is present at https://github.com/Xilinx/linux-xlnx/blob/master/sound/soc/xilinx/xlnx_spdif.c

HW IP Features

IP Features2019.1

Variable sampling rates (32/44.1/48/88.2/96/176.4/192 kHz)

Yes
Audio sample length of 16/20/24-bitYes
AXI4-Stream interface to carry audio samples in AES3 formatYes
2 audio channelsYes


Known Issues & Limitations

  • None

Kernel Configurations

Below driver configurations should be enabled.

CONFIG_SND_SOC=y
SND_SOC_XILINX_SPDIF=y

Device Tree Binding

The dts node should be defined with correct hardware configuration. How to define the node is documented inxlnx,spdif.txt.

Test Procedure

The driver has been tested using following tools.

  1. ALSA Utilities.
  2. Gstreamer Utilities.

Note:

  1. Below examples assume sound card registered is #0, playback device is #0, record device is #1.
  2. Following is the recording audio file with 24bit bit depth, 48khz sampling frequency and 2 channel audio properties.

Procedure to test SPDIF audio with ALSA Utilities

Recording a file: arecord tool is used to record the audio file.

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.

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

Device Enumeration:

For record device:

arecord --device="hw:0,1" --dump-hw-params

For playback device:

aplay --device="hw:0,0" --dump-hw-params

Procedure to test SPDIF audio with Gstreamer Utilities

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

gst-launch is using alsa src plugin to enable recording with SPDIF driver.

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

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

gst-launch is using alsa sink plugin to enable playback with SPDIF driver.

gst-launch-1.0 filesrc location=48000.raw ! audio/x-raw,format=S24_32LE,rate=48000,channnels=2  ! alsasink device=hw:0,0

Boards Supported

Driver has been tested on the following boards

  1. ZCU106 Rev 1.0

Mainline Status

This driver is upstreamed and present at, https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/sound/soc/xilinx/xlnx_spdif.c.

Change Log

2024.1

  • Summary
    • No changes

2020.1 

  • Summary
    • No changes

2019.2

  • Summary
    • No changes

2019.1

  • Summary:
    • Initial release
  • Commits:
    • f8def0f    - ASoC: xlnx: use clock framework for clocks to SPDIF.
    • 24ebbbc - ASoC: xlnx: add SPDIF audio driver.

Related Links

© Copyright 2019 - 2022 Xilinx Inc. Privacy Policy