diff options
| author | Mark Brown <broonie@kernel.org> | 2026-10-15 16:44:21 +0100 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-10-15 16:44:21 +0100 |
| commit | 18123081c09623e884a108ff23d22a98505626e9 (patch) | |
| tree | d3a8dcd30e0b7a6ad63c4f288c89aef22a756ba8 /scripts/basic/split-include.c | |
| parent | 5195b34346115843961b20fbf39297a0ae4f5a48 (diff) | |
| parent | 9a810aa9f105114b0f0760e292a11e5a28b2e488 (diff) | |
| download | linux-18123081c09623e884a108ff23d22a98505626e9.tar.gz linux-18123081c09623e884a108ff23d22a98505626e9.zip | |
ASoC: qcom: Add QAIF driver for Shikra audio platform
Harendra Gautam <harendra.gautam@oss.qualcomm.com> says:
This series introduces the Qualcomm Audio Interface (QAIF) driver for
the Shikra audio platform.
Hardware IP Overview
====================
QAIF (Qualcomm Audio Interface) is a fully configurable DMA-based audio
subsystem used to transmit and receive audio data over serial audio
interfaces (PCM, TDM, MI2S) and to provide a DMA interface for internal
codec connections. It manages two independent data paths:
AIF (Audio Interface): multiple multi-lane Unified Audio Interfaces,
each supporting up to 8 independent data lanes. Each lane is individually
configurable as TX (output/speaker) or RX (input/mic). All lanes of an
interface share a single bit clock and frame sync. Supported modes are
PCM (short/long sync), TDM, and MI2S (stereo/mono). Per-interface
configuration includes sync source (master/slave), sync mode, sync delay,
sync inversion, slot width (8/16/24/32-bit), sample width, active slot
masks (up to 32 slots), bits-per-lane frame size, lane enable/direction
masks, loopback, output-enable control, and full-cycle path support for
long chip-to-chip connections.
CIF (Codec Interface): multiple RDDMA (playback) and WRDMA (capture)
channels connecting to an internal codec over a parallel bus. Each channel
supports active-channel enable mask (up to 16 channels), frame-sync
selection, frame-sync delay, frame-sync output gating, dynamic clock
gating, and 16-bit packing/unpacking.
Note on RX/TX naming convention: in QAIF, TX refers to the output
(speaker/playback) direction and RX refers to the input (mic/capture)
direction. This applies to both AIF lane directions and CIF slot/mask
properties.
DMA Engine: RDDMA fetches audio from DDR/TCM/LPM into a shared SRAM
latency buffer (SHRAM) and drains it to the interface. WRDMA collects
data from the interface into SHRAM and writes it to memory. Each DMA
owns a private SHRAM region defined by start address and length registers.
Burst sizes of 1/2/4/8/16 beats (64-bit) are supported with up to 4
outstanding transactions per DMA. Two QSB master ports (QXM0 for TCM,
QXM1 for DDR/LPM) provide the memory interface.
Execution Environments (EE): Resources (DMAs, audio interfaces,
interface groups) are partitioned among up to 5 EEs via map registers.
Each EE owns a set of DMAs, audio interfaces, and interface groups, and
receives its own independent interrupt output. The interrupt hierarchy
has a two-level structure: a summary register identifies the event class
(DMA period, underflow/overflow, error response, audio interface
underflow/overflow, group done, rate detector, VFR), and per-resource
status registers identify the specific channel.
Interface Grouping (Bonding): Multiple AIF and CIF interfaces can be
bonded into a group to start synchronously and align their DMA period
interrupts within half a frame duration using the RDDMA padding feature.
Up to 6 groups are supported.
Rate Detector: Two rate detector blocks measure the frequency of
incoming frame sync or word select signals and generate interrupts on
rate change, undetected rate, or sync timeout.
Block Diagram
=============
System Memory (DDR / LPM / TCM)
+---------------------------------+
| Circular Buffers (ping-pong) |
+----------+----------+-----------+
| ^
64-bit AXI 64-bit AXI
| |
+----------v----------+-----------+
| QSB Master Ports |
| +----------+ +----------+ |
| | QXM0 | | QXM1 | |
| +----+-----+ +-----+----+ |
+-------|--------------|----------+
| |
+-------v--------------v----------+
| Shared RAM (SHRAM) |
| +------------+ +------------+ |
| | QXM0 Read | | QXM0 Write | |
| | SHRAM | | SHRAM | |
| +------------+ +------------+ |
| +------------+ +------------+ |
| | QXM1 Read | | QXM1 Write | |
| | SHRAM | | SHRAM | |
| +------------+ +------------+ |
+---+--------+--------+-------+---+
| | | |
+---v--+ +--v---+ +--v---+ +-v----+
|RDDMA | |RDDMA | |WRDMA | |WRDMA |
| AIF | | CIF | | AIF | | CIF |
|[0..n]| |[0..n]| |[0..n]| |[0..n]|
+--+---+ +--+---+ +--+---+ +-+----+
| | ^ ^
| TX | TX | RX | RX
v v | |
+--+--------------------+ +----+----------+
| Unified Audio Intf | | Codec DMA |
| (AIF 0..12) | | Interface |
| | | (CIF) |
| AUD_INTFa block: | | |
| - Serializer (TX) | | RDDMA: DDR -> |
| - De-serializer (RX) | | internal |
| - Sync gen/detect | | codec |
| - Up to 8 data lanes | | WRDMA: codec |
| - PCM / TDM / MI2S | | -> DDR |
| - Near Pad Logic | | Up to 16 ch |
+--+--------------------+ +----+----------+
| Lane 0..7 (TX/RX) | Parallel bus
| Bit clk + Frame sync | + Frame sync
v v
+--+--------+ +------+------+
| External | | Internal |
| Serial | | Digital |
| Peripherals| | Codec |
| (PCM/TDM/ | | (Bolero/ |
| MI2S) | | WCD) |
+-----------+ +-------------+
Software Design
===============
The driver follows the standard ALSA SoC split:
qaif-cpu.c: CPU DAI component. Manages clocks, implements DAI ops
(startup/shutdown/hw_params/trigger) for both AIF and CIF
paths using direct regmap_update_bits() calls with address macros from
qaif-reg.h, registers an of_xlate_dai_name callback so that sound-dai
references using non-sequential DAI IDs resolve correctly, parses
per-interface AIF configuration from DT child nodes, and provides
runtime PM suspend/resume via pm_runtime_force_suspend/resume for
power collapse. AIF child nodes use standard properties (dai-format,
dai-tdm-slot-*, qcom,qaif-aif-lane-map) without a compatible string;
the protocol is identified by dai-format and set_fmt() is called by
the machine driver.
qaif-platform.c: PCM platform component. Handles DMA buffer allocation
(dma_alloc_pages()), PCM ops (open/close/hw_params/hw_free/prepare/trigger/
pointer/mmap/copy), and table-driven two-level IRQ dispatch with
period-elapsed notification.
qaif-shikra.c: Shikra SoC-specific variant descriptor. Provides
register base addresses, DMA channel counts, SHRAM geometry, clock
names and the DAI driver array. This abstraction keeps the core driver
portable across future QAIF integrations.
qaif.h / qaif-reg.h: Shared data structures, constants and the complete
MMIO register address map consumed by both the CPU and platform drivers.
soc-core.c: This series adds snd_soc_of_xlate_dai_name() as a generic
ASoC helper that resolves a sound-dai phandle argument to a DAI name by
searching the component DAI list by ID. Both lpass-cpu.c and qaif-cpu.c
assign it directly as .of_xlate_dai_name, removing their private
implementations.
The series is split by functionality to aid review -- register map and
data structures first, then CPU DAI ops with regmap and DT parsing, the
of_xlate helper, PCM ops, IRQ handling and finally the Shikra variant
glue.
Link: https://patch.msgid.link/20261013-b4-qaif-shikra-audio-v9-0-f3022e28f2fd@oss.qualcomm.com
Diffstat (limited to 'scripts/basic/split-include.c')
0 files changed, 0 insertions, 0 deletions
