sound/isa/sb/sb16_main.c
Source file repositories/reference/linux-study-clean/sound/isa/sb/sb16_main.c
File Facts
- System
- Linux kernel
- Corpus path
sound/isa/sb/sb16_main.c- Extension
.c- Size
- 24866 bytes
- Lines
- 852
- Domain
- Driver Families
- Bucket
- sound/isa
- 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 IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/io.hasm/dma.hlinux/init.hlinux/time.hlinux/module.hsound/core.hsound/sb.hsound/sb16_csp.hsound/mpu401.hsound/control.hsound/info.h
Detected Declarations
function snd_sb16_csp_playback_preparefunction snd_sb16_csp_capture_preparefunction snd_sb16_csp_updatefunction snd_sb16_csp_playback_openfunction snd_sb16_csp_playback_closefunction snd_sb16_csp_capture_openfunction snd_sb16_csp_capture_closefunction snd_sb16_setup_ratefunction snd_sb16_playback_preparefunction snd_sb16_playback_triggerfunction snd_sb16_capture_preparefunction snd_sb16_capture_triggerfunction snd_sb16dsp_interruptfunction scoped_guardfunction scoped_guardfunction scoped_guardfunction snd_sb16_playback_pointerfunction snd_sb16_capture_pointerfunction snd_sb16_playback_openfunction snd_sb16_playback_closefunction snd_sb16_capture_openfunction snd_sb16_capture_closefunction snd_sb16_set_dma_modefunction snd_sb16_get_dma_modefunction snd_sb16_dma_control_infofunction snd_sb16_dma_control_getfunction snd_sb16_dma_control_putfunction snd_sb16dsp_configurefunction scoped_guardfunction scoped_guardfunction snd_sb16dsp_pcmexport snd_sb16dsp_pcmexport snd_sb16dsp_get_pcm_opsexport snd_sb16dsp_configureexport snd_sb16dsp_interrupt
Annotated Snippet
if (csp->running & SNDRV_SB_CSP_ST_LOADED) {
/* manually loaded codec */
if ((csp->mode & SNDRV_SB_CSP_MODE_DSP_WRITE) &&
(runtime_format_bits(runtime) == csp->acc_format)) {
/* Supported runtime PCM format for playback */
if (csp->ops.csp_use(csp) == 0) {
/* If CSP was successfully acquired */
goto __start_CSP;
}
} else if ((csp->mode & SNDRV_SB_CSP_MODE_QSOUND) && (csp->q_enabled)) {
/* QSound decoder is loaded and enabled */
if (runtime_format_bits(runtime) & (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U8 |
SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_U16_LE)) {
/* Only for simple PCM formats */
if (csp->ops.csp_use(csp) == 0) {
/* If CSP was successfully acquired */
goto __start_CSP;
}
}
}
} else if (csp->ops.csp_use(csp) == 0) {
/* Acquire CSP and try to autoload hardware codec */
if (csp->ops.csp_autoload(csp, runtime->format, SNDRV_SB_CSP_MODE_DSP_WRITE)) {
/* Unsupported format, release CSP */
csp->ops.csp_unuse(csp);
} else {
__start_CSP:
/* Try to start CSP */
if (csp->ops.csp_start(csp, (chip->mode & SB_MODE_PLAYBACK_16) ?
SNDRV_SB_CSP_SAMPLE_16BIT : SNDRV_SB_CSP_SAMPLE_8BIT,
(runtime->channels > 1) ?
SNDRV_SB_CSP_STEREO : SNDRV_SB_CSP_MONO)) {
/* Failed, release CSP */
csp->ops.csp_unuse(csp);
} else {
/* Success, CSP acquired and running */
chip->open = SNDRV_SB_CSP_MODE_DSP_WRITE;
}
}
}
}
}
static void snd_sb16_csp_capture_prepare(struct snd_sb *chip, struct snd_pcm_runtime *runtime)
{
if (chip->hardware == SB_HW_16CSP) {
struct snd_sb_csp *csp = chip->csp;
if (csp->running & SNDRV_SB_CSP_ST_LOADED) {
/* manually loaded codec */
if ((csp->mode & SNDRV_SB_CSP_MODE_DSP_READ) &&
(runtime_format_bits(runtime) == csp->acc_format)) {
/* Supported runtime PCM format for capture */
if (csp->ops.csp_use(csp) == 0) {
/* If CSP was successfully acquired */
goto __start_CSP;
}
}
} else if (csp->ops.csp_use(csp) == 0) {
/* Acquire CSP and try to autoload hardware codec */
if (csp->ops.csp_autoload(csp, runtime->format, SNDRV_SB_CSP_MODE_DSP_READ)) {
/* Unsupported format, release CSP */
csp->ops.csp_unuse(csp);
} else {
__start_CSP:
/* Try to start CSP */
if (csp->ops.csp_start(csp, (chip->mode & SB_MODE_CAPTURE_16) ?
SNDRV_SB_CSP_SAMPLE_16BIT : SNDRV_SB_CSP_SAMPLE_8BIT,
(runtime->channels > 1) ?
SNDRV_SB_CSP_STEREO : SNDRV_SB_CSP_MONO)) {
/* Failed, release CSP */
csp->ops.csp_unuse(csp);
} else {
/* Success, CSP acquired and running */
chip->open = SNDRV_SB_CSP_MODE_DSP_READ;
}
}
}
}
}
static void snd_sb16_csp_update(struct snd_sb *chip)
{
if (chip->hardware == SB_HW_16CSP) {
struct snd_sb_csp *csp = chip->csp;
if (csp->qpos_changed) {
guard(spinlock)(&chip->reg_lock);
csp->ops.csp_qsound_transfer (csp);
}
Annotation
- Immediate include surface: `linux/io.h`, `asm/dma.h`, `linux/init.h`, `linux/time.h`, `linux/module.h`, `sound/core.h`, `sound/sb.h`, `sound/sb16_csp.h`.
- Detected declarations: `function snd_sb16_csp_playback_prepare`, `function snd_sb16_csp_capture_prepare`, `function snd_sb16_csp_update`, `function snd_sb16_csp_playback_open`, `function snd_sb16_csp_playback_close`, `function snd_sb16_csp_capture_open`, `function snd_sb16_csp_capture_close`, `function snd_sb16_setup_rate`, `function snd_sb16_playback_prepare`, `function snd_sb16_playback_trigger`.
- Atlas domain: Driver Families / sound/isa.
- Implementation status: integration implementation candidate.
- 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.