ALSA, ASoC and SOF
ALSA (Advanced Linux Sound Architecture) is a general-purpose audio framework that provides a unified interface for accessing audio hardware. It is used by a wide range of applications, including media players, games, and recording software.
ALSA provides audio and MIDI functionality to the Linux operating system. ASoC (ALSA System-on-Chip) is a subsystem of ALSA. ASoC provides a modular architecture to share audio codec drivers across different SoC implementations, unify the controls provided to applications, and provide a common infrastructure to manage SoC audio component power and clocks.
Fig.1:Audio Driver Architecture
SOF (Sound Open Firmware) is an open source audio Digital Signal Processing (DSP) firmware infrastructure and SDK. SOF provides infrastructure, real-time control pieces, and audio drivers. A generic SOF subsystem is implemented in Linux as a subsystem of ALSA ASoC.
Fig.2:Native Audio SOF Driver
- ASoC machine driver: a glue driver to integrate codec, platform and DAIs.
- ASoC PCM Driver: an abstract layer for PCM data processing and PCM stream control.
- Generic IPC Driver: the communication channel with DSP.
- DSP Platform Driver : platform specific handing. Something like quirk.
Audio Virtualization
Monolithic Hypervisors, such as KVM, are typically built on top of general-purpose monolithic operating systems, such as Linux. They provide hardware access to the host and CPU virtualization in the kernel, and they rely on user-space software, such as QEMU, to emulate guest I/O in the host OS.
Fig.3:Monolithic Hypervisor Based Audio Virtualization Architecture
Micro-kernelized Hypervisors, such as Xen and ACRN, are typically lightweight microkernels that provide basic hardware access to the host and CPU virtualization in the kernel. They rely on a management guest, such as Xen’s Dom0 and ACRN’s Service OS, to provide the rest of the functionality, such as complete hardware access, a management interface, and guest I/O emulation.
Following is a reference micro-kernelized hypervisor based audio virtualization solution for automotive cases.
Fig.4:Micro-kernelized Hypervisor Based Audio Virtualization Architecture
- Coordinated stream management among audio application in different Guests.
- Audio application in Service OS has the highest privilege level (e.g. Phone calls over audio playback).
- Virtio based platform-agnostic audio drivers.
- Put the backend in Service OS kernel side for better performance. Zero-copy is required.
- Physical audio device is assigned to Service OS by using pass-through techology.