include/sound/compress_driver.h
Source file repositories/reference/linux-study-clean/include/sound/compress_driver.h
File Facts
- System
- Linux kernel
- Corpus path
include/sound/compress_driver.h- Extension
.h- Size
- 9727 bytes
- Lines
- 296
- Domain
- Driver Families
- Bucket
- include/sound
- 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.
- 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
linux/types.hlinux/sched.hsound/core.hsound/compress_offload.hsound/asound.hsound/pcm.h
Detected Declarations
struct snd_compr_opsstruct snd_compr_task_runtimestruct snd_compr_runtimestruct snd_compr_streamstruct snd_compr_opsstruct snd_comprfunction snd_compr_use_pause_in_drainingfunction snd_compress_frame_elapsedfunction snd_compr_drain_notifyfunction snd_compr_set_runtime_buffer
Annotated Snippet
struct snd_compr_task_runtime {
struct list_head list;
struct dma_buf *input;
struct dma_buf *output;
u64 seqno;
u64 input_size;
u64 output_size;
u32 flags;
u8 state;
void *private_value;
};
/**
* struct snd_compr_runtime: runtime stream description
* @state: stream state
* @ops: pointer to DSP callbacks
* @buffer: pointer to kernel buffer, valid only when not in mmap mode or
* DSP doesn't implement copy
* @buffer_size: size of the above buffer
* @fragment_size: size of buffer fragment in bytes
* @fragments: number of such fragments
* @total_bytes_available: cumulative number of bytes made available in
* the ring buffer
* @total_bytes_transferred: cumulative bytes transferred by offload DSP
* @sleep: poll sleep
* @private_data: driver private data pointer
* @dma_area: virtual buffer address
* @dma_addr: physical buffer address (not accessible from main CPU)
* @dma_bytes: size of DMA area
* @dma_buffer_p: runtime dma buffer pointer
* @active_tasks: count of active tasks
* @total_tasks: count of all tasks
* @task_seqno: last task sequence number (!= 0)
* @tasks: list of all tasks
*/
struct snd_compr_runtime {
snd_pcm_state_t state;
struct snd_compr_ops *ops;
void *buffer;
u64 buffer_size;
u32 fragment_size;
u32 fragments;
u64 total_bytes_available;
u64 total_bytes_transferred;
wait_queue_head_t sleep;
void *private_data;
unsigned char *dma_area;
dma_addr_t dma_addr;
size_t dma_bytes;
struct snd_dma_buffer *dma_buffer_p;
#if IS_ENABLED(CONFIG_SND_COMPRESS_ACCEL)
u32 active_tasks;
u32 total_tasks;
u64 task_seqno;
struct list_head tasks;
#endif
};
/**
* struct snd_compr_stream: compressed stream
* @name: device name
* @ops: pointer to DSP callbacks
* @runtime: pointer to runtime structure
* @device: device pointer
* @error_work: delayed work used when closing the stream due to an error
* @direction: stream direction, playback/recording
* @metadata_set: metadata set flag, true when set
* @next_track: has userspace signal next track transition, true when set
* @partial_drain: undergoing partial_drain for stream, true when set
* @pause_in_draining: paused during draining state, true when set
* @private_data: pointer to DSP private data
* @dma_buffer: allocated buffer if any
*/
struct snd_compr_stream {
const char *name;
struct snd_compr_ops *ops;
struct snd_compr_runtime *runtime;
struct snd_compr *device;
struct delayed_work error_work;
enum snd_compr_direction direction;
bool metadata_set;
bool next_track;
bool partial_drain;
bool pause_in_draining;
void *private_data;
struct snd_dma_buffer dma_buffer;
};
Annotation
- Immediate include surface: `linux/types.h`, `linux/sched.h`, `sound/core.h`, `sound/compress_offload.h`, `sound/asound.h`, `sound/pcm.h`.
- Detected declarations: `struct snd_compr_ops`, `struct snd_compr_task_runtime`, `struct snd_compr_runtime`, `struct snd_compr_stream`, `struct snd_compr_ops`, `struct snd_compr`, `function snd_compr_use_pause_in_draining`, `function snd_compress_frame_elapsed`, `function snd_compr_drain_notify`, `function snd_compr_set_runtime_buffer`.
- Atlas domain: Driver Families / include/sound.
- Implementation status: source implementation candidate.
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.