sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
Source file repositories/reference/linux-study-clean/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
File Facts
- System
- Linux kernel
- Corpus path
sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c- Extension
.c- Size
- 6581 bytes
- Lines
- 274
- Domain
- Driver Families
- Bucket
- sound/pcmcia
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hsound/core.hsound/asoundef.hpdaudiocf.h
Detected Declarations
function Copyrightfunction pdacf_pcm_triggerfunction pdacf_pcm_preparefunction pdacf_pcm_capture_openfunction pdacf_pcm_capture_closefunction pdacf_pcm_capture_pointerfunction snd_pdacf_pcm_new
Annotated Snippet
if (chip->pcm_running) {
if ((chip->ak4117->rcs0 & AK4117_UNLCK) || runtime->rate != rate) {
chip->pcm_running -= inc;
ret = -EIO;
break;
}
}
tmp &= ~mask;
tmp |= val;
pdacf_reg_write(chip, PDAUDIOCF_REG_SCR, tmp);
}
snd_ak4117_check_rate_and_errors(chip->ak4117, AK4117_CHECK_NO_RATE);
return ret;
}
/*
* pdacf_pcm_prepare - prepare callback for playback and capture
*/
static int pdacf_pcm_prepare(struct snd_pcm_substream *subs)
{
struct snd_pdacf *chip = snd_pcm_substream_chip(subs);
struct snd_pcm_runtime *runtime = subs->runtime;
u16 val, nval, aval;
if (chip->chip_status & PDAUDIOCF_STAT_IS_STALE)
return -EBUSY;
chip->pcm_channels = runtime->channels;
chip->pcm_little = snd_pcm_format_little_endian(runtime->format) > 0;
#ifdef SNDRV_LITTLE_ENDIAN
chip->pcm_swab = snd_pcm_format_big_endian(runtime->format) > 0;
#else
chip->pcm_swab = chip->pcm_little;
#endif
if (snd_pcm_format_unsigned(runtime->format))
chip->pcm_xor = 0x80008000;
if (pdacf_pcm_clear_sram(chip) < 0)
return -EIO;
val = nval = pdacf_reg_read(chip, PDAUDIOCF_REG_SCR);
nval &= ~(PDAUDIOCF_DATAFMT0|PDAUDIOCF_DATAFMT1);
switch (runtime->format) {
case SNDRV_PCM_FORMAT_S16_LE:
case SNDRV_PCM_FORMAT_S16_BE:
break;
default: /* 24-bit */
nval |= PDAUDIOCF_DATAFMT0 | PDAUDIOCF_DATAFMT1;
break;
}
aval = 0;
chip->pcm_sample = 4;
switch (runtime->format) {
case SNDRV_PCM_FORMAT_S16_LE:
case SNDRV_PCM_FORMAT_S16_BE:
aval = AK4117_DIF_16R;
chip->pcm_frame = 2;
chip->pcm_sample = 2;
break;
case SNDRV_PCM_FORMAT_S24_3LE:
case SNDRV_PCM_FORMAT_S24_3BE:
chip->pcm_sample = 3;
fallthrough;
default: /* 24-bit */
aval = AK4117_DIF_24R;
chip->pcm_frame = 3;
chip->pcm_xor &= 0xffff0000;
break;
}
if (val != nval) {
snd_ak4117_reg_write(chip->ak4117, AK4117_REG_IO, AK4117_DIF2|AK4117_DIF1|AK4117_DIF0, aval);
pdacf_reg_write(chip, PDAUDIOCF_REG_SCR, nval);
}
val = pdacf_reg_read(chip, PDAUDIOCF_REG_IER);
val &= ~(PDAUDIOCF_IRQLVLEN1);
val |= PDAUDIOCF_IRQLVLEN0;
pdacf_reg_write(chip, PDAUDIOCF_REG_IER, val);
chip->pcm_size = runtime->buffer_size;
chip->pcm_period = runtime->period_size;
chip->pcm_area = runtime->dma_area;
return 0;
}
Annotation
- Immediate include surface: `linux/delay.h`, `sound/core.h`, `sound/asoundef.h`, `pdaudiocf.h`.
- Detected declarations: `function Copyright`, `function pdacf_pcm_trigger`, `function pdacf_pcm_prepare`, `function pdacf_pcm_capture_open`, `function pdacf_pcm_capture_close`, `function pdacf_pcm_capture_pointer`, `function snd_pdacf_pcm_new`.
- Atlas domain: Driver Families / sound/pcmcia.
- 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.