sound/pci/trident/trident_main.c
Source file repositories/reference/linux-study-clean/sound/pci/trident/trident_main.c
File Facts
- System
- Linux kernel
- Corpus path
sound/pci/trident/trident_main.c- Extension
.c- Size
- 119439 bytes
- Lines
- 3842
- Domain
- Driver Families
- Bucket
- sound/pci
- 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.
- 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/delay.hlinux/init.hlinux/interrupt.hlinux/pci.hlinux/slab.hlinux/vmalloc.hlinux/gameport.hlinux/dma-mapping.hlinux/export.hlinux/io.hsound/core.hsound/info.hsound/control.hsound/tlv.htrident.hsound/asoundef.h
Detected Declarations
function snd_trident_print_voice_regsfunction snd_trident_codec_readfunction snd_trident_codec_writefunction snd_trident_enable_esofunction snd_trident_disable_esofunction snd_trident_start_voicefunction snd_trident_stop_voicefunction snd_trident_allocate_pcm_channelfunction snd_trident_free_pcm_channelfunction snd_trident_allocate_synth_channelfunction snd_trident_free_synth_channelfunction snd_trident_write_voice_regsfunction snd_trident_write_cso_regfunction snd_trident_write_eso_regfunction snd_trident_write_vol_regfunction snd_trident_write_pan_regfunction snd_trident_write_rvol_regfunction snd_trident_write_cvol_regfunction snd_trident_convert_ratefunction snd_trident_convert_adc_ratefunction snd_trident_spurious_thresholdfunction snd_trident_control_modefunction snd_trident_allocate_pcm_memfunction snd_trident_allocate_evoicefunction snd_trident_hw_paramsfunction snd_trident_hw_freefunction snd_trident_playback_preparefunction snd_trident_capture_hw_paramsfunction snd_trident_capture_preparefunction snd_trident_si7018_capture_hw_paramsfunction snd_trident_si7018_capture_hw_freefunction snd_trident_si7018_capture_preparefunction snd_trident_foldback_preparefunction snd_trident_spdif_hw_paramsfunction snd_trident_spdif_preparefunction snd_trident_triggerfunction snd_trident_playback_pointerfunction snd_trident_capture_pointerfunction snd_trident_spdif_pointerfunction snd_trident_pcm_free_substreamfunction snd_trident_playback_openfunction snd_trident_playback_closefunction snd_trident_spdif_openfunction snd_trident_spdif_closefunction scoped_guardfunction snd_trident_capture_openfunction snd_trident_capture_closefunction snd_trident_foldback_open
Annotated Snippet
if (!(trident->ChanMap[T4D_BANK_B] & (1 << idx))) {
trident->ChanMap[T4D_BANK_B] |= 1 << idx;
trident->ChanPCMcnt++;
return idx + 32;
}
}
return -1;
}
/*---------------------------------------------------------------------------
void snd_trident_free_pcm_channel(int channel)
Description: Free hardware channel in Bank B (32-63)
Parameters : trident - pointer to target device class for 4DWave.
channel - hardware channel number 0-63
Return Value: none
---------------------------------------------------------------------------*/
static void snd_trident_free_pcm_channel(struct snd_trident *trident, int channel)
{
if (channel < 32 || channel > 63)
return;
channel &= 0x1f;
if (trident->ChanMap[T4D_BANK_B] & (1 << channel)) {
trident->ChanMap[T4D_BANK_B] &= ~(1 << channel);
trident->ChanPCMcnt--;
}
}
/*---------------------------------------------------------------------------
unsigned int snd_trident_allocate_synth_channel(void)
Description: Allocate hardware channel in Bank A (0-31).
Parameters : trident - pointer to target device class for 4DWave.
Return Value: hardware channel - 0-31 or -1 when no channel is available
---------------------------------------------------------------------------*/
static int snd_trident_allocate_synth_channel(struct snd_trident * trident)
{
int idx;
for (idx = 31; idx >= 0; idx--) {
if (!(trident->ChanMap[T4D_BANK_A] & (1 << idx))) {
trident->ChanMap[T4D_BANK_A] |= 1 << idx;
trident->synth.ChanSynthCount++;
return idx;
}
}
return -1;
}
/*---------------------------------------------------------------------------
void snd_trident_free_synth_channel( int channel )
Description: Free hardware channel in Bank B (0-31).
Parameters : trident - pointer to target device class for 4DWave.
channel - hardware channel number 0-63
Return Value: none
---------------------------------------------------------------------------*/
static void snd_trident_free_synth_channel(struct snd_trident *trident, int channel)
{
if (channel < 0 || channel > 31)
return;
channel &= 0x1f;
if (trident->ChanMap[T4D_BANK_A] & (1 << channel)) {
trident->ChanMap[T4D_BANK_A] &= ~(1 << channel);
trident->synth.ChanSynthCount--;
}
}
/*---------------------------------------------------------------------------
snd_trident_write_voice_regs
Description: This routine will complete and write the 5 hardware channel
registers to hardware.
Parameters: trident - pointer to target device class for 4DWave.
voice - synthesizer voice structure
Each register field.
Annotation
- Immediate include surface: `linux/delay.h`, `linux/init.h`, `linux/interrupt.h`, `linux/pci.h`, `linux/slab.h`, `linux/vmalloc.h`, `linux/gameport.h`, `linux/dma-mapping.h`.
- Detected declarations: `function snd_trident_print_voice_regs`, `function snd_trident_codec_read`, `function snd_trident_codec_write`, `function snd_trident_enable_eso`, `function snd_trident_disable_eso`, `function snd_trident_start_voice`, `function snd_trident_stop_voice`, `function snd_trident_allocate_pcm_channel`, `function snd_trident_free_pcm_channel`, `function snd_trident_allocate_synth_channel`.
- Atlas domain: Driver Families / sound/pci.
- Implementation status: integration 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.