sound/pci/ctxfi/ctatc.c
Source file repositories/reference/linux-study-clean/sound/pci/ctxfi/ctatc.c
File Facts
- System
- Linux kernel
- Corpus path
sound/pci/ctxfi/ctatc.c- Extension
.c- Size
- 44324 bytes
- Lines
- 1796
- 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
ctatc.hctpcm.hctmixer.hctsrc.hctamixer.hctdaio.hcttimer.hlinux/delay.hlinux/slab.hsound/pcm.hsound/control.hsound/asoundef.h
Detected Declarations
struct src_node_conf_tfunction ct_map_audio_bufferfunction ct_unmap_audio_bufferfunction atc_get_ptp_physfunction convert_formatfunction atc_get_pitchfunction select_romfunction atc_pcm_playback_preparefunction scoped_guardfunction atc_pcm_release_resourcesfunction atc_pcm_playback_startfunction atc_pcm_stopfunction atc_pcm_playback_positionfunction setup_src_node_conffunction atc_pcm_capture_get_resourcesfunction atc_pcm_capture_preparefunction atc_pcm_capture_startfunction atc_pcm_capture_positionfunction spdif_passthru_playback_get_resourcesfunction atc_pll_initfunction spdif_passthru_playback_setupfunction spdif_passthru_playback_preparefunction atc_select_line_infunction atc_select_mic_infunction atc_spdif_in_typefunction atc_capabilitiesfunction atc_dedicated_rca_selectfunction atc_output_switch_getfunction atc_output_switch_putfunction atc_mic_source_switch_getfunction atc_mic_source_switch_putfunction atc_select_digit_iofunction atc_daio_unmutefunction atc_dao_get_statusfunction atc_dao_set_statusfunction atc_line_front_unmutefunction atc_line_surround_unmutefunction atc_line_clfe_unmutefunction atc_line_rear_unmutefunction atc_line_in_unmutefunction atc_mic_unmutefunction atc_rca_unmutefunction atc_spdif_out_unmutefunction atc_spdif_in_unmutefunction atc_spdif_out_get_statusfunction atc_spdif_out_set_statusfunction atc_spdif_out_passthrufunction atc_release_resources
Annotated Snippet
struct src_node_conf_t {
unsigned int pitch;
unsigned int msr:8;
unsigned int mix_msr:8;
unsigned int imp_msr:8;
unsigned int vo:1;
};
static void setup_src_node_conf(struct ct_atc *atc, struct ct_atc_pcm *apcm,
struct src_node_conf_t *conf, int *n_srcc)
{
unsigned int pitch;
/* get pitch and convert to fixed-point 8.24 format. */
pitch = atc_get_pitch((atc->rsr * atc->msr),
apcm->substream->runtime->rate);
*n_srcc = 0;
if (1 == atc->msr) { /* FIXME: do we really need SRC here if pitch==1 */
*n_srcc = apcm->substream->runtime->channels;
conf[0].pitch = pitch;
conf[0].mix_msr = conf[0].imp_msr = conf[0].msr = 1;
conf[0].vo = 1;
} else if (2 <= atc->msr) {
if (0x8000000 < pitch) {
/* Need two-stage SRCs, SRCIMPs and
* AMIXERs for converting format */
conf[0].pitch = (atc->msr << 24);
conf[0].msr = conf[0].mix_msr = 1;
conf[0].imp_msr = atc->msr;
conf[0].vo = 0;
conf[1].pitch = atc_get_pitch(atc->rsr,
apcm->substream->runtime->rate);
conf[1].msr = conf[1].mix_msr = conf[1].imp_msr = 1;
conf[1].vo = 1;
*n_srcc = apcm->substream->runtime->channels * 2;
} else if (0x1000000 < pitch) {
/* Need one-stage SRCs, SRCIMPs and
* AMIXERs for converting format */
conf[0].pitch = pitch;
conf[0].msr = conf[0].mix_msr
= conf[0].imp_msr = atc->msr;
conf[0].vo = 1;
*n_srcc = apcm->substream->runtime->channels;
}
}
}
static int
atc_pcm_capture_get_resources(struct ct_atc *atc, struct ct_atc_pcm *apcm)
{
struct src_mgr *src_mgr = atc->rsc_mgrs[SRC];
struct srcimp_mgr *srcimp_mgr = atc->rsc_mgrs[SRCIMP];
struct amixer_mgr *amixer_mgr = atc->rsc_mgrs[AMIXER];
struct sum_mgr *sum_mgr = atc->rsc_mgrs[SUM];
struct src_desc src_dsc = {0};
struct src *src;
struct srcimp_desc srcimp_dsc = {0};
struct srcimp *srcimp;
struct amixer_desc mix_dsc = {0};
struct sum_desc sum_dsc = {0};
unsigned int pitch;
int multi, err, i;
int n_srcimp, n_amixer, n_srcc, n_sum;
struct src_node_conf_t src_node_conf[2] = {{0} };
/* first release old resources */
atc_pcm_release_resources(atc, apcm);
/* The numbers of converting SRCs and SRCIMPs should be determined
* by pitch value. */
multi = apcm->substream->runtime->channels;
/* get pitch and convert to fixed-point 8.24 format. */
pitch = atc_get_pitch((atc->rsr * atc->msr),
apcm->substream->runtime->rate);
setup_src_node_conf(atc, apcm, src_node_conf, &n_srcc);
n_sum = (1 == multi) ? 1 : 0;
n_amixer = n_sum * 2 + n_srcc;
n_srcimp = n_srcc;
if ((multi > 1) && (0x8000000 >= pitch)) {
/* Need extra AMIXERs and SRCIMPs for special treatment
* of interleaved recording of conjugate channels */
n_amixer += multi * atc->msr;
n_srcimp += multi * atc->msr;
} else {
n_srcimp += multi;
}
Annotation
- Immediate include surface: `ctatc.h`, `ctpcm.h`, `ctmixer.h`, `ctsrc.h`, `ctamixer.h`, `ctdaio.h`, `cttimer.h`, `linux/delay.h`.
- Detected declarations: `struct src_node_conf_t`, `function ct_map_audio_buffer`, `function ct_unmap_audio_buffer`, `function atc_get_ptp_phys`, `function convert_format`, `function atc_get_pitch`, `function select_rom`, `function atc_pcm_playback_prepare`, `function scoped_guard`, `function atc_pcm_release_resources`.
- 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.