The Linux HDMI audio driver uses ALSA SoC (ASoC) subsystem to provide HDMI audio functionality(record and playback)

Typical system using HDMIRx and HDMITx

HDMI audio driver logic is split among HDMI video driver and ALSA SoC driver. The part present in video driver provides functionality like enable/disable audio stream, info frame packing/unpacking etc. ALSA driver is responsible for audio data transfer(CDMA) and exposing audio device to the user for record/playback uses cases.

The following block diagram shows the data flow between HDMIRx and HDMI Tx. To record the audio, HDMIRx receives the data from HDMI source(ex:AppleTV/Nvidia shield) and split the audio from video content and store it into FIFOS2MM. Later Driver take the data from RxFIFO and copy audio into memory using CDMA. To play the audio, Sound card Driver copy the audio data from FIFOMM2S and send it to HDMITx with the help of CDMA.

Note: ensure you have created sound card. refer Creating Sound card for HDMI

sound card Driver internally uses CDMA and FIFOMM2s IPs to send data from HDMI to Memory and vice-versa (Refer: /sound/soc/xilinx/xlnx_audioss.c, Link)


Linux Kernel Defconfig



Connect a source of HDMI source such as Apple Tv to ZCU106 Rx and a monitor to HDMI Tx of ZCU106 and start a mulitmedia stream.

Record(HDMI Rx):

#./arecord -Dhw:0,1  -fS32_LE -r 48000 -c 2  -d 30 <output filename.wav>
Above command will record HDMI audio to a file which contains PCM + AES data.

Playback(HDMI Tx):

# /media/aplay -D hw:0,0 -fS32_LE -r 48000 -c 2 <filename.wav >
Above command will play HDMI audio from input file which contains PCM + AES data.
Note :
The recorded file can be played on HDMI Tx side , as HDMI monitor removes AES header during playback.
If the same file needs to be played on any other device, AES header needs to be removed during record or after recording.

Pass through HDMI Audio Testing:

G-streamer and alsa-utils tools enables pass through design for the HDMI Linux driver i.e HDMI receiver is connecting to HDMI transmitter.

arecord -D hw:0,1 -f S32_LE -r 48000 -c 2 | aplay -D hw:0,0 -c 2 -f S32_LE -r 48000
gst-launch-1.0 alsasrc device=hw:0,1 ! 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.


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).
 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:
 # 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

Related Links