sound/soc/codecs/wm_adsp.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/wm_adsp.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/wm_adsp.c- Extension
.c- Size
- 52998 bytes
- Lines
- 2139
- Domain
- Driver Families
- Bucket
- sound/soc
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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
kunit/static_stub.hkunit/visibility.hlinux/array_size.hlinux/cleanup.hlinux/ctype.hlinux/module.hlinux/moduleparam.hlinux/init.hlinux/delay.hlinux/firmware.hlinux/list.hlinux/pm.hlinux/regmap.hlinux/regulator/consumer.hlinux/slab.hlinux/string.hlinux/workqueue.hlinux/debugfs.hsound/core.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/jack.hsound/initval.hsound/tlv.hwm_adsp.h
Detected Declarations
struct wm_adsp_system_config_xm_hdrstruct wm_halo_system_config_xm_hdrstruct wm_adsp_alg_xm_structstruct wm_adsp_host_buf_coeff_v1struct wm_adsp_bufferstruct wm_adsp_comprstruct wm_adsp_compr_bufstruct wm_adsp_comprstruct wm_adsp_buffer_regionstruct wm_adsp_buffer_region_defstruct wm_adsp_fw_capsstruct wm_coeff_ctlfunction wm_adsp_fw_getfunction wm_adsp_fw_putfunction wm_coeff_infofunction wm_coeff_putfunction wm_coeff_tlv_putfunction wm_coeff_put_ackedfunction wm_coeff_getfunction wm_coeff_tlv_getfunction wm_coeff_get_ackedfunction wmfw_convert_flagsfunction wm_adsp_ctl_workfunction wm_adsp_control_addfunction wm_adsp_control_add_cbfunction wm_adsp_control_removefunction wm_adsp_write_ctlfunction wm_adsp_read_ctlfunction wm_adsp_release_firmware_filesfunction wm_adsp_firmware_requestfunction wm_adsp_request_firmware_filefunction wm_adsp_request_firmware_filesfunction wm_adsp_common_initfunction wm_adsp1_initfunction wm_adsp1_eventfunction wm_adsp2_set_dspclkfunction wm_adsp2_preloader_getfunction wm_adsp2_preloader_putfunction wm_adsp_power_upfunction wm_adsp_power_downfunction wm_adsp_boot_workfunction wm_adsp_early_eventfunction wm_adsp_pre_runfunction wm_adsp_event_post_runfunction wm_adsp_event_post_stopfunction wm_adsp_runfunction wm_adsp_stopfunction wm_adsp_hibernate
Annotated Snippet
struct wm_adsp_system_config_xm_hdr {
__be32 sys_enable;
__be32 fw_id;
__be32 fw_rev;
__be32 boot_status;
__be32 watchdog;
__be32 dma_buffer_size;
__be32 rdma[6];
__be32 wdma[8];
__be32 build_job_name[3];
__be32 build_job_number;
} __packed;
struct wm_halo_system_config_xm_hdr {
__be32 halo_heartbeat;
__be32 build_job_name[3];
__be32 build_job_number;
} __packed;
struct wm_adsp_alg_xm_struct {
__be32 magic;
__be32 smoothing;
__be32 threshold;
__be32 host_buf_ptr;
__be32 start_seq;
__be32 high_water_mark;
__be32 low_water_mark;
__be64 smoothed_power;
} __packed;
struct wm_adsp_host_buf_coeff_v1 {
__be32 host_buf_ptr; /* Host buffer pointer */
__be32 versions; /* Version numbers */
__be32 name[4]; /* The buffer name */
} __packed;
struct wm_adsp_buffer {
__be32 buf1_base; /* Base addr of first buffer area */
__be32 buf1_size; /* Size of buf1 area in DSP words */
__be32 buf2_base; /* Base addr of 2nd buffer area */
__be32 buf1_buf2_size; /* Size of buf1+buf2 in DSP words */
__be32 buf3_base; /* Base addr of buf3 area */
__be32 buf_total_size; /* Size of buf1+buf2+buf3 in DSP words */
__be32 high_water_mark; /* Point at which IRQ is asserted */
__be32 irq_count; /* bits 1-31 count IRQ assertions */
__be32 irq_ack; /* acked IRQ count, bit 0 enables IRQ */
__be32 next_write_index; /* word index of next write */
__be32 next_read_index; /* word index of next read */
__be32 error; /* error if any */
__be32 oldest_block_index; /* word index of oldest surviving */
__be32 requested_rewind; /* how many blocks rewind was done */
__be32 reserved_space; /* internal */
__be32 min_free; /* min free space since stream start */
__be32 blocks_written[2]; /* total blocks written (64 bit) */
__be32 words_written[2]; /* total words written (64 bit) */
} __packed;
struct wm_adsp_compr;
struct wm_adsp_compr_buf {
struct list_head list;
struct wm_adsp *dsp;
struct wm_adsp_compr *compr;
struct wm_adsp_buffer_region *regions;
u32 host_buf_ptr;
u32 error;
u32 irq_count;
int read_index;
int avail;
int host_buf_mem_type;
char *name;
};
struct wm_adsp_compr {
struct list_head list;
struct wm_adsp *dsp;
struct wm_adsp_compr_buf *buf;
struct snd_compr_stream *stream;
struct snd_compressed_buffer size;
u32 *raw_buf;
u64 copied_total;
unsigned int sample_rate;
const char *name;
Annotation
- Immediate include surface: `kunit/static_stub.h`, `kunit/visibility.h`, `linux/array_size.h`, `linux/cleanup.h`, `linux/ctype.h`, `linux/module.h`, `linux/moduleparam.h`, `linux/init.h`.
- Detected declarations: `struct wm_adsp_system_config_xm_hdr`, `struct wm_halo_system_config_xm_hdr`, `struct wm_adsp_alg_xm_struct`, `struct wm_adsp_host_buf_coeff_v1`, `struct wm_adsp_buffer`, `struct wm_adsp_compr`, `struct wm_adsp_compr_buf`, `struct wm_adsp_compr`, `struct wm_adsp_buffer_region`, `struct wm_adsp_buffer_region_def`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: integration 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.