sound/pci/mixart/mixart_hwdep.c
Source file repositories/reference/linux-study-clean/sound/pci/mixart/mixart_hwdep.c
File Facts
- System
- Linux kernel
- Corpus path
sound/pci/mixart/mixart_hwdep.c- Extension
.c- Size
- 17145 bytes
- Lines
- 587
- Domain
- Driver Families
- Bucket
- sound/pci
- 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/interrupt.hlinux/pci.hlinux/firmware.hlinux/vmalloc.hlinux/slab.hlinux/module.hlinux/io.hsound/core.hmixart.hmixart_mixer.hmixart_core.hmixart_hwdep.h
Detected Declarations
struct snd_mixart_elf32_ehdrstruct snd_mixart_elf32_phdrfunction Copyrightfunction mixart_load_elffunction mixart_enum_connectorsfunction mixart_enum_physiofunction mixart_first_initfunction mixart_dsp_loadfunction snd_mixart_setup_firmware
Annotated Snippet
struct snd_mixart_elf32_ehdr {
u8 e_ident[16];
__be16 e_type;
__be16 e_machine;
__be32 e_version;
__be32 e_entry;
__be32 e_phoff;
__be32 e_shoff;
__be32 e_flags;
__be16 e_ehsize;
__be16 e_phentsize;
__be16 e_phnum;
__be16 e_shentsize;
__be16 e_shnum;
__be16 e_shstrndx;
};
struct snd_mixart_elf32_phdr {
__be32 p_type;
__be32 p_offset;
__be32 p_vaddr;
__be32 p_paddr;
__be32 p_filesz;
__be32 p_memsz;
__be32 p_flags;
__be32 p_align;
};
static int mixart_load_elf(struct mixart_mgr *mgr, const struct firmware *dsp )
{
char elf32_magic_number[4] = {0x7f,'E','L','F'};
struct snd_mixart_elf32_ehdr *elf_header;
int i;
elf_header = (struct snd_mixart_elf32_ehdr *)dsp->data;
for( i=0; i<4; i++ )
if ( elf32_magic_number[i] != elf_header->e_ident[i] )
return -EINVAL;
if( elf_header->e_phoff != 0 ) {
struct snd_mixart_elf32_phdr elf_programheader;
for( i=0; i < be16_to_cpu(elf_header->e_phnum); i++ ) {
u32 pos = be32_to_cpu(elf_header->e_phoff) + (u32)(i * be16_to_cpu(elf_header->e_phentsize));
memcpy( &elf_programheader, dsp->data + pos, sizeof(elf_programheader) );
if(elf_programheader.p_type != 0) {
if( elf_programheader.p_filesz != 0 ) {
memcpy_toio( MIXART_MEM( mgr, be32_to_cpu(elf_programheader.p_vaddr)),
dsp->data + be32_to_cpu( elf_programheader.p_offset ),
be32_to_cpu( elf_programheader.p_filesz ));
}
}
}
}
return 0;
}
/*
* get basic information and init miXart
*/
/* audio IDs for request to the board */
#define MIXART_FIRST_ANA_AUDIO_ID 0
#define MIXART_FIRST_DIG_AUDIO_ID 8
static int mixart_enum_connectors(struct mixart_mgr *mgr)
{
u32 k;
int err;
struct mixart_msg request;
struct mixart_enum_connector_resp *connector;
struct mixart_audio_info_req *audio_info_req;
struct mixart_audio_info_resp *audio_info;
connector = kmalloc_obj(*connector);
audio_info_req = kmalloc_obj(*audio_info_req);
audio_info = kmalloc_obj(*audio_info);
if (! connector || ! audio_info_req || ! audio_info) {
err = -ENOMEM;
goto __error;
}
audio_info_req->line_max_level = MIXART_FLOAT_P_22_0_TO_HEX;
audio_info_req->micro_max_level = MIXART_FLOAT_M_20_0_TO_HEX;
audio_info_req->cd_max_level = MIXART_FLOAT____0_0_TO_HEX;
request.message_id = MSG_SYSTEM_ENUM_PLAY_CONNECTOR;
request.uid = (struct mixart_uid){0,0}; /* board num = 0 */
Annotation
- Immediate include surface: `linux/interrupt.h`, `linux/pci.h`, `linux/firmware.h`, `linux/vmalloc.h`, `linux/slab.h`, `linux/module.h`, `linux/io.h`, `sound/core.h`.
- Detected declarations: `struct snd_mixart_elf32_ehdr`, `struct snd_mixart_elf32_phdr`, `function Copyright`, `function mixart_load_elf`, `function mixart_enum_connectors`, `function mixart_enum_physio`, `function mixart_first_init`, `function mixart_dsp_load`, `function snd_mixart_setup_firmware`.
- Atlas domain: Driver Families / sound/pci.
- 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.