Audio code structure
1.User space audio code
The following is a list of directory paths in the user space where the code related to audio is located for the debugging and customization:
<APSS_BUILD>/hardware/qcom/audio/hal/msm8974 – Contains the audio Hardware Abstraction Layer (HAL)-related code
<APSS_BUILD>/external/tinyalsa/ – Contains the code related to tinymix, tinyplay, and tinycap
<APSS_BUILD>/hardware/qcom/audio/mm-audio – Contains the implementation of QTI OMX components for the audio encoder and decoders
<APSS_BUILD>/frameworks/av/media/libstagefright/ – Contains the source code for Google’s Stagefright implementation
<APSS_BUILD>/frameworks/av/media/libmediaplayerservice/nuplayer - Contains the source code for Google’s nuplayer implementation
<APSS_BUILD>/frameworks/av/services/audioflinger/ – Contains the source code for AudioFlinger that manages audio streams from the user space
<APSS_BUILD>/vendor/qcom/proprietary/mm-audio/ – Contains the code related to the Audio Calibration Database (ACDB) driver, parsers for DTS and AC3, surround sound, SVA, etc.
<APSS_BUILD>/external/bluetooth/bluedroid/ – Contains the code related to Bluetooth® (BT) A2DP used in a QTI platform
<APSS_BUILD>/external/bluetooth/bluedroid/audio_a2dp_hw/ – Contains the A2DP audio HAL implementation
<APSS_BUILD>/hardware/libhardware/modules/usbaudio/ – Contains the USB HAL implementation for a USB dock use case
<APSS_BUILD>/hardware/qcom/audio/hal/audio_extn/:
audio_extn.c – Implements the wrapper function for audio extension features, such as FM, Dolby, Compress capture, HFP, SVA (listen), speaker protection, SSR, USB audio over headset
usb.c – Contains the HAL implementation for USB playback and record over the headset
compress_capture.c – Contains the HAL implementation for Compress capture
dolby.c – Contains the HAL implementation for the Dolby postprocessing feature
fm.c – Contains the HAL implementation for the FM playback and recording feature
hfp.c – Contains the HAL implementation for the hands-free profile feature where the MSM™ chipset can be used as as a BT headset device
listen.c – Contains the HAL implementation for the Snapdragon™ Voice Activation (SVA) feature
spkr_protection.c – Contains the HAL implementation for the speaker protection feature
ssr.c – Contains the HAL implementation for the surround sound recording feature
<APSS_BUILD>/vendor/qcom/proprietary/wfd/mm/source/framework/src/ – Contains the Wi-Fi Display (WFD) frameworks-related code; WFDMMSourceAudioSource.cpp configures the RT Proxy port via ALSA APIs and gets the PCM data from the audio layer
<APSS_BUILD>/system/core/include/system/ – Contains audio.h and audio_policy.h that contain enum definitions and inline functions used all over the code for audio in the user space
<APSS_BUILD>/frameworks/base/media/java/android/media/ – Contains .java files for audio that expose APIs that can be called by Android™ applications written in Java
2.Kernel space audio code
The following is a list of directory paths in the kernel where the code related to audio is located for debugging and customization:
<APSS_BUILD>/kernel/sound/soc/msm/ – Contains the msm8994.c machine driver
<APSS_BUILD>/kernel/sound/soc/msm/qdsp6v2 – Contains the source code for the platform drivers, Frontend (FE), and Backend (BE) DAI driver, QDSP drivers for AFE, ADM, and ASM, voice driver, etc.
<APSS_BUILD>/kernel/sound/soc/soc-*.c – All the soc-*.c files provide information on the ALSA SOC framework
<APSS_BUILD>/kernel/drivers/slimbus/ – Contains the source for the SLIMbus driver
<APSS_BUILD>/kernel/arch/arm/mach-msm/qdsp6v2/ – Contains the drivers for DSP-based encoders and decoders, code for the ADSP loader, APR driver, Ion memory driver, and other utility files
<APSS_BUILD>//LINUX/android/kernel/arch/arm/boot/dts – Contains msm8994-*.dtsi files that contain MSM8994-specific information;board-specific information on the MSM8994;GPIO management ; audio-related customization is available in files such as msm8994.dtsi, msm8994-mtp.dtsi, and msm8994-cdp.dtsi
<APSS_BUILD>/LINUX/android//kernel/sound/soc/codecs/ – Contains the source code for the codec driver for WCD9330; codec driver-related source files are wcd9330.c, wcd9xxx-mbhc.c, wcd9xxx-resmgr.c, wcd9xxx-common.c, etc.
<APSS_BUILD>//LINUX/android/kernel/drivers/mfd/ – Contains the source code for the codec driver; wcd9xxx-core.c, wcd9xxx-slimslave.c, and wcd9xxx-irq.c are the codec driver-related files