sound/soc/qcom/qdsp6/q6asm-dai.c
Source file repositories/reference/linux-study-clean/sound/soc/qcom/qdsp6/q6asm-dai.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/qcom/qdsp6/q6asm-dai.c- Extension
.c- Size
- 38130 bytes
- Lines
- 1346
- Domain
- Driver Families
- Bucket
- sound/soc
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
dt-bindings/sound/qcom,q6asm.hlinux/init.hlinux/err.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/slab.hsound/soc.hsound/soc-dapm.hsound/pcm.hlinux/spinlock.hsound/compress_driver.hasm/div64.hasm/dma.hlinux/dma-mapping.hsound/pcm_params.hq6asm.hq6routing.hq6dsp-errno.h
Detected Declarations
struct q6asm_dai_rtdstruct q6asm_dai_dataenum stream_statefunction event_handlerfunction q6asm_dai_preparefunction q6asm_dai_ackfunction q6asm_dai_triggerfunction q6asm_dai_openfunction q6asm_dai_closefunction q6asm_dai_pointerfunction q6asm_dai_hw_paramsfunction compress_event_handlerfunction q6asm_dai_compr_openfunction q6asm_dai_compr_freefunction __q6asm_dai_compr_set_codec_paramsfunction q6asm_dai_compr_set_paramsfunction q6asm_dai_compr_set_metadatafunction q6asm_dai_compr_triggerfunction q6asm_dai_compr_pointerfunction q6asm_compr_copyfunction q6asm_dai_compr_mmapfunction q6asm_dai_compr_get_capsfunction q6asm_dai_compr_get_codec_capsfunction q6asm_dai_pcm_newfunction of_q6asm_parse_dai_datafunction for_each_child_of_nodefunction q6asm_dai_probe
Annotated Snippet
struct q6asm_dai_rtd {
struct snd_pcm_substream *substream;
struct snd_compr_stream *cstream;
struct snd_codec codec;
struct snd_dma_buffer dma_buffer;
spinlock_t lock;
phys_addr_t phys;
unsigned int pcm_size;
unsigned int pcm_count;
unsigned int periods;
uint64_t bytes_sent;
uint64_t bytes_received;
uint64_t copied_total;
uint16_t bits_per_sample;
snd_pcm_uframes_t queue_ptr;
uint16_t source; /* Encoding source bit mask */
struct audio_client *audio_client;
uint32_t next_track_stream_id;
bool next_track;
uint32_t stream_id;
uint16_t session_id;
enum stream_state state;
uint32_t initial_samples_drop;
uint32_t trailing_samples_drop;
bool notify_on_drain;
};
struct q6asm_dai_data {
struct snd_soc_dai_driver *dais;
int num_dais;
long long int sid;
};
static const struct snd_pcm_hardware q6asm_dai_hardware_capture = {
.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_BATCH |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_NO_REWINDS | SNDRV_PCM_INFO_SYNC_APPLPTR |
SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME),
.formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE),
.rates = SNDRV_PCM_RATE_8000_48000,
.rate_min = 8000,
.rate_max = 48000,
.channels_min = 1,
.channels_max = 4,
.buffer_bytes_max = CAPTURE_MAX_NUM_PERIODS *
CAPTURE_MAX_PERIOD_SIZE,
.period_bytes_min = CAPTURE_MIN_PERIOD_SIZE,
.period_bytes_max = CAPTURE_MAX_PERIOD_SIZE,
.periods_min = CAPTURE_MIN_NUM_PERIODS,
.periods_max = CAPTURE_MAX_NUM_PERIODS,
.fifo_size = 0,
};
static const struct snd_pcm_hardware q6asm_dai_hardware_playback = {
.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_BATCH |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_NO_REWINDS | SNDRV_PCM_INFO_SYNC_APPLPTR |
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME),
.formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE),
.rates = SNDRV_PCM_RATE_8000_192000,
.rate_min = 8000,
.rate_max = 192000,
.channels_min = 1,
.channels_max = 8,
.buffer_bytes_max = (PLAYBACK_MAX_NUM_PERIODS *
PLAYBACK_MAX_PERIOD_SIZE),
.period_bytes_min = PLAYBACK_MIN_PERIOD_SIZE,
.period_bytes_max = PLAYBACK_MAX_PERIOD_SIZE,
.periods_min = PLAYBACK_MIN_NUM_PERIODS,
.periods_max = PLAYBACK_MAX_NUM_PERIODS,
.fifo_size = 0,
};
#define Q6ASM_FEDAI_DRIVER(num) { \
.playback = { \
.stream_name = "MultiMedia"#num" Playback", \
.rates = (SNDRV_PCM_RATE_8000_48000 | \
SNDRV_PCM_RATE_12000 | \
SNDRV_PCM_RATE_24000 | \
SNDRV_PCM_RATE_88200 | \
SNDRV_PCM_RATE_96000 | \
SNDRV_PCM_RATE_176400 | \
SNDRV_PCM_RATE_192000), \
.formats = (SNDRV_PCM_FMTBIT_S16_LE | \
Annotation
- Immediate include surface: `dt-bindings/sound/qcom,q6asm.h`, `linux/init.h`, `linux/err.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/slab.h`, `sound/soc.h`.
- Detected declarations: `struct q6asm_dai_rtd`, `struct q6asm_dai_data`, `enum stream_state`, `function event_handler`, `function q6asm_dai_prepare`, `function q6asm_dai_ack`, `function q6asm_dai_trigger`, `function q6asm_dai_open`, `function q6asm_dai_close`, `function q6asm_dai_pointer`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.