From: Harendra Gautam <harendra.gautam@oss.qualcomm.com>
To: Srinivas Kandagatla <srini@kernel.org>
Cc: Mark Brown <broonie@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 00/11] ASoC: qcom: Add QAIF driver for Shikra audio platform
Date: Wed, 1 Jul 2026 16:27:46 +0530 [thread overview]
Message-ID: <20260701105757.2779738-1-harendra.gautam@oss.qualcomm.com> (raw)
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:
Unified Audio Interface (AIF): Serialises and deserialises PCM audio
between system memory and external serial audio peripherals. Each
interface supports up to 8 independent data lanes, each configurable
as TX (speaker) or RX (mic). All lanes of an interface share a single
bit clock and frame sync. The AUD_INTFa hardware block controls the
serial protocol -- sync source (master/slave), sync mode (short/long
PCM, TDM, MI2S), sync delay and inversion, slot and sample widths,
active slot masks, lane enable/direction, mono/stereo mode and
full-cycle path support for long chip-to-chip connections.
Codec DMA Interface (CIF): Provides a parallel DMA interface to the
internal Bolero digital codec. The RDDMA path carries playback data
to Bolero and the WRDMA path carries capture data from Bolero. Each
channel has an INTF_CFG register controlling the active channel enable
mask, frame-sync selection, frame-sync delay, frame-sync output gating,
dynamic clock gating and 16-bit packing/unpacking.
DMA Engine: Read DMAs (RDDMA) fetch audio from DDR/TCM/LPM into a
shared on-chip SRAM latency buffer (SHRAM) and drain it to the
interface. Write DMAs (WRDMA) collect data from the interface into
SHRAM and write it to memory. Each DMA channel owns a private SHRAM
region. Two QSB master ports (QXM0 and QXM1) provide the memory
fabric. Burst sizes of 1/2/4/8/16 beats and up to 4 outstanding
transactions per DMA are supported.
Execution Environments (EE): Resources (DMAs, audio interfaces,
interface groups) are partitioned among up to 5 EEs via map registers.
Each EE receives an independent interrupt output. The interrupt
hierarchy has two levels: a summary register identifies the event class
(DMA period, underflow/overflow, error response, AUD_INTF
underflow/overflow, group done, rate detector, VFR), and per-resource
status registers identify the specific channel and event type.
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.
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, initialises regmap
bitfield handles for all DMA and interface control registers, implements
DAI ops (startup/shutdown/hw_free/hw_params/trigger) for both AIF and
CIF paths, registers an of_xlate_dai_name callback so that sound-dai
references using non-sequential DAI IDs resolve correctly, and parses
per-interface TDM/MI2S configuration from DT child nodes.
qaif-platform.c: PCM platform component. Handles DMA buffer allocation
(dma_alloc_pages()), PCM ops (open/close/hw_params/prepare/trigger/
pointer/mmap/copy), two-level IRQ dispatch with period-elapsed
notification, and component suspend/resume across power collapse.
qaif-shikra.c: Shikra SoC-specific variant descriptor. Provides all
register field definitions, DMA-to-DAI index maps, 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.
common.c/h: This series also adds asoc_qcom_of_xlate_dai_name(), a shared
helper that resolves a sound-dai phandle argument to a DAI name by
searching the component DAI driver array by ID. Both lpass-cpu.c and
qaif-cpu.c use thin wrappers around this helper, replacing duplicate
private implementations.
The series is split by functionality to aid review -- register map and
data structures first, then CIF ops, AIF ops, probe infrastructure, PCM
ops, IRQ handling and finally the Shikra variant glue.
Tested on Shikra with 48 kHz stereo MI2S playback and capture over the
Audio Interface Zero (AIF0) and Bolero CDC DMA RX/TX paths.
Link to v1:
https://lore.kernel.org/lkml/20260605103739.3557573-1-harendra.gautam@oss.qualcomm.com/
Changes in v2:
- Rename YAML file to qcom,qaif-cpu.yaml, add qcom,qaif-cpu compatible
- Merge DAI ID header into binding patch, drop _clk suffix from
clock-names, add enum constraints, remove status: true (Krzysztof)
- Fix dt_binding_check failure in binding example (Rob)
- Fix IRQ storm: client status register bitmask missing BIT(16)
- Fix race: use test_and_set_bit for DMA bitmap allocation
- Fix regmap_config: use non-const with dynamic max_register
- Use dev_err_probe() in probe path, sizeof(*var) in kzalloc (Krzysztof)
- Add kerneldoc for all EXPORT_SYMBOL_GPL functions (Krzysztof)
- Use goto-based error cleanup in pcmops_open()
- Move MAINTAINERS entry to last patch (Krzysztof)
- Add shared asoc_qcom_of_xlate_dai_name() helper used by lpass-cpu
and qaif-cpu
- Fix checkpatch --strict warnings and alignment issues
Depends-on: [PATCH 0/4] clk: qcom: Add Audio Core clock controller
support on Qualcomm Shikra SoC
https://lore.kernel.org/linux-clk/20260605-shikra-audiocorecc-v1-0-7ee6b5f2d928@oss.qualcomm.com/
Harendra Gautam (11):
dt-bindings: sound: Add Qualcomm QAIF binding
ASoC: qcom: Add QAIF hardware register map
ASoC: qcom: Add QAIF shared data structures and variant interface
ASoC: qcom: Add QAIF CIF (CDC DMA) DAI ops
ASoC: qcom: Add QAIF AIF DAI ops
ASoC: qcom: Add generic of_xlate_dai_name helper and use it in
lpass-cpu and qaif-cpu
ASoC: qcom: Add QAIF regmap, DT parsing and platform init
ASoC: qcom: Add QAIF PCM operations
ASoC: qcom: Add QAIF IRQ handling, suspend/resume and platform
register
ASoC: qcom: Add Shikra QAIF support
MAINTAINERS: Add Qualcomm QAIF driver entry
.../devicetree/bindings/sound/qcom,qaif-cpu.yaml | 358 +++++
MAINTAINERS | 10 +
include/dt-bindings/sound/qcom,qaif.h | 89 ++
sound/soc/qcom/Kconfig | 11 +
sound/soc/qcom/Makefile | 2 +
sound/soc/qcom/common.c | 34 +
sound/soc/qcom/common.h | 5 +
sound/soc/qcom/lpass-cpu.c | 23 +-
sound/soc/qcom/qaif-cpu.c | 1610 ++++++++++++++++++++
sound/soc/qcom/qaif-platform.c | 1250 +++++++++++++++
sound/soc/qcom/qaif-reg.h | 453 ++++++
sound/soc/qcom/qaif-shikra.c | 556 +++++++
sound/soc/qcom/qaif.h | 506 ++++++
13 files changed, 4891 insertions(+), 16 deletions(-)
create mode 100644 .../devicetree/bindings/sound/qcom,qaif-cpu.yaml
create mode 100644 include/dt-bindings/sound/qcom,qaif.h
create mode 100644 sound/soc/qcom/qaif-cpu.c
create mode 100644 sound/soc/qcom/qaif-platform.c
create mode 100644 sound/soc/qcom/qaif-reg.h
create mode 100644 sound/soc/qcom/qaif-shikra.c
create mode 100644 sound/soc/qcom/qaif.h
base-commit: bebb6ea69b2a793e8c840d7c9c4f18cb1747570f
prerequisite-change-id: 20260605-shikra-audiocorecc-85efef073474
prerequisite-patch-id: 591dd358a559fa83d46149f74f80ff0f2a98da7f
prerequisite-patch-id: 4d40e704139dc4b0ec2529c49f096d86a4e4dc5f
prerequisite-patch-id: c02813140f0c1c3d783f5643e34ef8e175cb20ea
prerequisite-patch-id: b9dbd75b7919d7d2dd621194609507ede839b9bf
--
2.34.1
next reply other threads:[~2026-07-01 10:58 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 10:57 Harendra Gautam [this message]
2026-07-01 10:57 ` [PATCH v2 01/11] dt-bindings: sound: qcom,qaif-cpu: Add binding Harendra Gautam
2026-07-01 11:04 ` Konrad Dybcio
2026-07-02 6:52 ` Krzysztof Kozlowski
2026-07-01 11:09 ` sashiko-bot
2026-07-01 11:19 ` Mark Brown
2026-07-01 12:26 ` Mark Brown
2026-07-02 6:50 ` Krzysztof Kozlowski
2026-07-01 10:57 ` [PATCH v2 02/11] ASoC: qcom: Add QAIF hardware register map Harendra Gautam
2026-07-01 10:57 ` [PATCH v2 03/11] ASoC: qcom: Add QAIF shared data structures and variant interface Harendra Gautam
2026-07-01 11:26 ` sashiko-bot
2026-07-01 10:57 ` [PATCH v2 04/11] ASoC: qcom: Add QAIF CIF (CDC DMA) DAI ops Harendra Gautam
2026-07-01 11:09 ` sashiko-bot
2026-07-01 10:57 ` [PATCH v2 05/11] ASoC: qcom: Add QAIF AIF " Harendra Gautam
2026-07-01 11:14 ` sashiko-bot
2026-07-01 10:57 ` [PATCH v2 06/11] ASoC: qcom: Add generic of_xlate_dai_name helper and use it in lpass-cpu and qaif-cpu Harendra Gautam
2026-07-01 11:11 ` sashiko-bot
2026-07-02 7:12 ` Krzysztof Kozlowski
2026-07-01 10:57 ` [PATCH v2 07/11] ASoC: qcom: Add QAIF regmap, DT parsing and platform init Harendra Gautam
2026-07-01 11:11 ` sashiko-bot
2026-07-02 7:07 ` Krzysztof Kozlowski
2026-07-01 10:57 ` [PATCH v2 08/11] ASoC: qcom: Add QAIF PCM operations Harendra Gautam
2026-07-01 11:12 ` sashiko-bot
2026-07-01 10:57 ` [PATCH v2 09/11] ASoC: qcom: Add QAIF IRQ handling, suspend/resume and platform register Harendra Gautam
2026-07-01 11:27 ` sashiko-bot
2026-07-01 10:57 ` [PATCH v2 10/11] ASoC: qcom: Add Shikra QAIF support Harendra Gautam
2026-07-01 11:22 ` sashiko-bot
2026-07-02 7:01 ` Krzysztof Kozlowski
2026-07-01 10:57 ` [PATCH v2 11/11] MAINTAINERS: Add Qualcomm QAIF driver entry Harendra Gautam
2026-07-02 6:58 ` [PATCH v2 00/11] ASoC: qcom: Add QAIF driver for Shikra audio platform Krzysztof Kozlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260701105757.2779738-1-harendra.gautam@oss.qualcomm.com \
--to=harendra.gautam@oss.qualcomm.com \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=robh@kernel.org \
--cc=srini@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox