sound/pci/emu10k1/emu10k1_main.c
Source file repositories/reference/linux-study-clean/sound/pci/emu10k1/emu10k1_main.c
File Facts
- System
- Linux kernel
- Corpus path
sound/pci/emu10k1/emu10k1_main.c- Extension
.c- Size
- 54841 bytes
- Lines
- 1793
- 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.
- 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
linux/sched.hlinux/delay.hlinux/init.hlinux/module.hlinux/interrupt.hlinux/iommu.hlinux/pci.hlinux/slab.hlinux/vmalloc.hlinux/mutex.hsound/core.hsound/emu10k1.hlinux/firmware.hp16v.htina2.hp17v.h
Detected Declarations
function snd_emu10k1_voice_initfunction snd_emu10k1_initfunction snd_emu10k1_audio_enablefunction snd_emu10k1_donefunction snd_emu10k1_ecard_writefunction snd_emu10k1_ecard_setadcgainfunction snd_emu10k1_ecard_initfunction snd_emu10k1_cardbus_initfunction snd_emu1010_load_firmwarefunction snd_emu1010_load_dock_firmwarefunction emu1010_dock_eventfunction emu1010_clock_eventfunction scoped_guardfunction emu1010_workfunction emu1010_interruptfunction snd_emu10k1_emu1010_initfunction snd_emu10k1_freefunction chipfunction snd_emu10k1_createfunction alloc_pm_bufferfunction free_pm_bufferfunction snd_emu10k1_suspend_regsfunction snd_emu10k1_resume_initfunction snd_emu10k1_resume_regs
Annotated Snippet
if (emu->card_capabilities->emu_model) {
; /* Disable all access to A_IOCFG for the emu1010 */
} else if (emu->card_capabilities->i2c_adc) {
; /* Disable A_IOCFG for Audigy 2 ZS Notebook */
} else if (emu->audigy) {
u16 reg = inw(emu->port + A_IOCFG);
outw(reg | A_IOCFG_GPOUT2, emu->port + A_IOCFG);
udelay(500);
outw(reg | A_IOCFG_GPOUT1 | A_IOCFG_GPOUT2, emu->port + A_IOCFG);
udelay(100);
outw(reg, emu->port + A_IOCFG);
} else {
unsigned int reg = inl(emu->port + HCFG);
outl(reg | HCFG_GPOUT2, emu->port + HCFG);
udelay(500);
outl(reg | HCFG_GPOUT1 | HCFG_GPOUT2, emu->port + HCFG);
udelay(100);
outl(reg, emu->port + HCFG);
}
}
if (emu->card_capabilities->emu_model) {
; /* Disable all access to A_IOCFG for the emu1010 */
} else if (emu->card_capabilities->i2c_adc) {
; /* Disable A_IOCFG for Audigy 2 ZS Notebook */
} else if (emu->audigy) { /* enable analog output */
u16 reg = inw(emu->port + A_IOCFG);
outw(reg | A_IOCFG_GPOUT0, emu->port + A_IOCFG);
}
if (emu->address_mode == 0) {
/* use 16M in 4G */
outl(inl(emu->port + HCFG) | HCFG_EXPANDED_MEM, emu->port + HCFG);
}
return 0;
}
static void snd_emu10k1_audio_enable(struct snd_emu10k1 *emu)
{
/*
* Enable the audio bit
*/
outl(inl(emu->port + HCFG) | HCFG_AUDIOENABLE, emu->port + HCFG);
/* Enable analog/digital outs on audigy */
if (emu->card_capabilities->emu_model) {
; /* Disable all access to A_IOCFG for the emu1010 */
} else if (emu->card_capabilities->i2c_adc) {
; /* Disable A_IOCFG for Audigy 2 ZS Notebook */
} else if (emu->audigy) {
outw(inw(emu->port + A_IOCFG) & ~0x44, emu->port + A_IOCFG);
if (emu->card_capabilities->ca0151_chip) { /* audigy2 */
/* Unmute Analog now. Set GPO6 to 1 for Apollo.
* This has to be done after init ALice3 I2SOut beyond 48KHz.
* So, sequence is important. */
outw(inw(emu->port + A_IOCFG) | 0x0040, emu->port + A_IOCFG);
} else if (emu->card_capabilities->ca0108_chip) { /* audigy2 value */
/* Unmute Analog now. */
outw(inw(emu->port + A_IOCFG) | 0x0060, emu->port + A_IOCFG);
} else {
/* Disable routing from AC97 line out to Front speakers */
outw(inw(emu->port + A_IOCFG) | 0x0080, emu->port + A_IOCFG);
}
}
#if 0
{
unsigned int tmp;
/* FIXME: the following routine disables LiveDrive-II !! */
/* TOSLink detection */
emu->tos_link = 0;
tmp = inl(emu->port + HCFG);
if (tmp & (HCFG_GPINPUT0 | HCFG_GPINPUT1)) {
outl(tmp|0x800, emu->port + HCFG);
udelay(50);
if (tmp != (inl(emu->port + HCFG) & ~0x800)) {
emu->tos_link = 1;
outl(tmp, emu->port + HCFG);
}
}
}
#endif
if (emu->card_capabilities->emu_model)
snd_emu10k1_intr_enable(emu, INTE_PCIERRORENABLE | INTE_A_GPIOENABLE);
else
snd_emu10k1_intr_enable(emu, INTE_PCIERRORENABLE);
}
Annotation
- Immediate include surface: `linux/sched.h`, `linux/delay.h`, `linux/init.h`, `linux/module.h`, `linux/interrupt.h`, `linux/iommu.h`, `linux/pci.h`, `linux/slab.h`.
- Detected declarations: `function snd_emu10k1_voice_init`, `function snd_emu10k1_init`, `function snd_emu10k1_audio_enable`, `function snd_emu10k1_done`, `function snd_emu10k1_ecard_write`, `function snd_emu10k1_ecard_setadcgain`, `function snd_emu10k1_ecard_init`, `function snd_emu10k1_cardbus_init`, `function snd_emu1010_load_firmware`, `function snd_emu1010_load_dock_firmware`.
- Atlas domain: Driver Families / sound/pci.
- Implementation status: source implementation candidate.
- 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.