sound/pci/ctxfi/ctsrc.c
Source file repositories/reference/linux-study-clean/sound/pci/ctxfi/ctsrc.c
File Facts
- System
- Linux kernel
- Corpus path
sound/pci/ctxfi/ctsrc.c- Extension
.c- Size
- 18753 bytes
- Lines
- 852
- 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.
- 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
ctsrc.hcthardware.hlinux/slab.h
Detected Declarations
function src_set_statefunction src_set_bmfunction src_set_sffunction src_set_pmfunction src_set_romfunction src_set_vofunction src_set_stfunction src_set_bpfunction src_set_ciszfunction src_set_cafunction src_set_safunction src_set_lafunction src_set_pitchfunction src_set_clear_zbufsfunction src_commit_writefunction src_get_cafunction src_initfunction src_default_config_memrdfunction src_default_config_memwrfunction src_default_config_arcrwfunction src_rsc_initfunction src_rsc_uninitfunction get_src_rscfunction put_src_rscfunction src_enable_sfunction src_enablefunction src_disablefunction src_mgr_commit_writefunction src_mgr_createfunction src_mgr_destroyfunction srcimp_masterfunction srcimp_next_conjfunction srcimp_indexfunction srcimp_mapfunction srcimp_unmapfunction srcimp_rsc_initfunction srcimp_rsc_uninitfunction get_srcimp_rscfunction put_srcimp_rscfunction scoped_guardfunction srcimp_map_opfunction srcimp_imap_addfunction srcimp_imap_deletefunction srcimp_mgr_createfunction srcimp_mgr_destroy
Annotated Snippet
if (srcimp->mapped & (0x1 << i)) {
srcimp->mgr->imap_delete(srcimp->mgr,
&srcimp->imappers[i]);
srcimp->mapped &= ~(0x1 << i);
}
}
return 0;
}
static const struct srcimp_rsc_ops srcimp_ops = {
.map = srcimp_map,
.unmap = srcimp_unmap
};
static int srcimp_rsc_init(struct srcimp *srcimp,
const struct srcimp_desc *desc,
struct srcimp_mgr *mgr)
{
int err;
err = rsc_init(&srcimp->rsc, srcimp->idx[0],
SRCIMP, desc->msr, mgr->mgr.hw);
if (err)
return err;
/* Set srcimp specific operations */
srcimp->rsc.ops = &srcimp_basic_rsc_ops;
srcimp->ops = &srcimp_ops;
srcimp->mgr = mgr;
srcimp->rsc.ops->master(&srcimp->rsc);
return 0;
}
static int srcimp_rsc_uninit(struct srcimp *srcimp)
{
srcimp->ops = NULL;
srcimp->mgr = NULL;
rsc_uninit(&srcimp->rsc);
return 0;
}
static int get_srcimp_rsc(struct srcimp_mgr *mgr,
const struct srcimp_desc *desc,
struct srcimp **rsrcimp)
{
int err, i;
unsigned int idx;
struct srcimp *srcimp;
*rsrcimp = NULL;
/* Allocate mem for SRCIMP resource */
srcimp = kzalloc_flex(*srcimp, imappers, desc->msr);
if (!srcimp)
return -ENOMEM;
/* Check whether there are sufficient SRCIMP resources. */
err = 0;
scoped_guard(spinlock_irqsave, &mgr->mgr_lock) {
for (i = 0; i < desc->msr; i++) {
err = mgr_get_resource(&mgr->mgr, 1, &idx);
if (err)
break;
srcimp->idx[i] = idx;
}
}
if (err) {
dev_err(mgr->card->dev,
"Can't meet SRCIMP resource request!\n");
goto error1;
}
err = srcimp_rsc_init(srcimp, desc, mgr);
if (err)
goto error1;
*rsrcimp = srcimp;
return 0;
error1:
scoped_guard(spinlock_irqsave, &mgr->mgr_lock) {
for (i--; i >= 0; i--)
mgr_put_resource(&mgr->mgr, 1, srcimp->idx[i]);
}
Annotation
- Immediate include surface: `ctsrc.h`, `cthardware.h`, `linux/slab.h`.
- Detected declarations: `function src_set_state`, `function src_set_bm`, `function src_set_sf`, `function src_set_pm`, `function src_set_rom`, `function src_set_vo`, `function src_set_st`, `function src_set_bp`, `function src_set_cisz`, `function src_set_ca`.
- 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.
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.