sound/pci/emu10k1/emupcm.c
Source file repositories/reference/linux-study-clean/sound/pci/emu10k1/emupcm.c
File Facts
- System
- Linux kernel
- Corpus path
sound/pci/emu10k1/emupcm.c- Extension
.c- Size
- 57195 bytes
- Lines
- 1837
- 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/pci.hlinux/delay.hlinux/slab.hlinux/time.hlinux/init.hsound/core.hsound/emu10k1.h
Detected Declarations
function Copyrightfunction snd_emu10k1_pcm_ac97adc_interruptfunction snd_emu10k1_pcm_ac97mic_interruptfunction snd_emu10k1_pcm_efx_interruptfunction snd_emu10k1_pcm_free_voicesfunction snd_emu10k1_pcm_channel_allocfunction snd_emu10k1_capture_rate_regfunction snd_emu10k1_audigy_capture_rate_regfunction snd_emu10k1_constrain_capture_ratesfunction snd_emu1010_constrain_efx_ratefunction emu10k1_calc_pitch_targetfunction emu10k1_select_interpromfunction emu10k1_send_target_from_amountfunction snd_emu10k1_pcm_init_voicefunction snd_emu10k1_pcm_init_voicesfunction snd_emu10k1_pcm_init_extra_voicefunction snd_emu10k1_playback_hw_paramsfunction snd_emu10k1_playback_hw_freefunction snd_emu10k1_playback_preparefunction snd_emu10k1_efx_playback_preparefunction snd_emu10k1_capture_preparefunction snd_emu10k1_playback_fill_cachefunction snd_emu10k1_playback_prepare_voicesfunction snd_emu10k1_playback_commit_volumefunction snd_emu10k1_playback_unmute_voicefunction snd_emu10k1_playback_unmute_voicesfunction snd_emu10k1_playback_mute_voicefunction snd_emu10k1_playback_mute_voicesfunction snd_emu10k1_playback_commit_pitchfunction snd_emu10k1_playback_trigger_voicefunction snd_emu10k1_playback_stop_voicefunction snd_emu10k1_playback_set_runningfunction snd_emu10k1_playback_set_stoppedfunction snd_emu10k1_playback_triggerfunction snd_emu10k1_capture_triggerfunction snd_emu10k1_playback_pointerfunction snd_emu10k1_efx_playback_voice_maskfunction snd_emu10k1_efx_playback_freeze_voicesfunction snd_emu10k1_efx_playback_unmute_voicesfunction snd_emu10k1_efx_playback_stop_voicesfunction snd_emu10k1_efx_playback_triggerfunction snd_emu10k1_capture_pointerfunction snd_emu10k1_pcm_mixer_notify1function snd_emu10k1_pcm_mixer_notifyfunction snd_emu10k1_pcm_efx_mixer_notifyfunction snd_emu10k1_pcm_free_substreamfunction snd_emu10k1_efx_playback_closefunction snd_emu10k1_playback_set_constraints
Annotated Snippet
if (epcm->voices[i]) {
snd_emu10k1_voice_free(epcm->emu, epcm->voices[i]);
epcm->voices[i] = NULL;
}
}
}
static int snd_emu10k1_pcm_channel_alloc(struct snd_emu10k1_pcm *epcm,
int type, int count, int channels)
{
int err;
snd_emu10k1_pcm_free_voices(epcm);
err = snd_emu10k1_voice_alloc(epcm->emu,
type, count, channels,
epcm, &epcm->voices[0]);
if (err < 0)
return err;
if (epcm->extra == NULL) {
// The hardware supports only (half-)loop interrupts, so to support an
// arbitrary number of periods per buffer, we use an extra voice with a
// period-sized loop as the interrupt source. Additionally, the interrupt
// timing of the hardware is "suboptimal" and needs some compensation.
err = snd_emu10k1_voice_alloc(epcm->emu,
type + 1, 1, 1,
epcm, &epcm->extra);
if (err < 0) {
/*
dev_dbg(emu->card->dev, "pcm_channel_alloc: "
"failed extra: voices=%d, frame=%d\n",
voices, frame);
*/
snd_emu10k1_pcm_free_voices(epcm);
return err;
}
epcm->extra->interrupt = snd_emu10k1_pcm_interrupt;
}
return 0;
}
// Primes 2-7 and 2^n multiples thereof, up to 16.
static const unsigned int efx_capture_channels[] = {
1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16
};
static const struct snd_pcm_hw_constraint_list hw_constraints_efx_capture_channels = {
.count = ARRAY_SIZE(efx_capture_channels),
.list = efx_capture_channels,
.mask = 0
};
static const unsigned int capture_buffer_sizes[31] = {
384, 448, 512, 640,
384*2, 448*2, 512*2, 640*2,
384*4, 448*4, 512*4, 640*4,
384*8, 448*8, 512*8, 640*8,
384*16, 448*16, 512*16, 640*16,
384*32, 448*32, 512*32, 640*32,
384*64, 448*64, 512*64, 640*64,
384*128,448*128,512*128
};
static const struct snd_pcm_hw_constraint_list hw_constraints_capture_buffer_sizes = {
.count = 31,
.list = capture_buffer_sizes,
.mask = 0
};
static unsigned int snd_emu10k1_capture_rate_reg(unsigned int rate)
{
switch (rate) {
case 8000: return ADCCR_SAMPLERATE_8;
case 11025: return ADCCR_SAMPLERATE_11;
case 16000: return ADCCR_SAMPLERATE_16;
case 22050: return ADCCR_SAMPLERATE_22;
case 24000: return ADCCR_SAMPLERATE_24;
case 32000: return ADCCR_SAMPLERATE_32;
case 44100: return ADCCR_SAMPLERATE_44;
case 48000: return ADCCR_SAMPLERATE_48;
default:
snd_BUG();
return ADCCR_SAMPLERATE_8;
}
}
static unsigned int snd_emu10k1_audigy_capture_rate_reg(unsigned int rate)
{
Annotation
- Immediate include surface: `linux/pci.h`, `linux/delay.h`, `linux/slab.h`, `linux/time.h`, `linux/init.h`, `sound/core.h`, `sound/emu10k1.h`.
- Detected declarations: `function Copyright`, `function snd_emu10k1_pcm_ac97adc_interrupt`, `function snd_emu10k1_pcm_ac97mic_interrupt`, `function snd_emu10k1_pcm_efx_interrupt`, `function snd_emu10k1_pcm_free_voices`, `function snd_emu10k1_pcm_channel_alloc`, `function snd_emu10k1_capture_rate_reg`, `function snd_emu10k1_audigy_capture_rate_reg`, `function snd_emu10k1_constrain_capture_rates`, `function snd_emu1010_constrain_efx_rate`.
- 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.