sound/pci/lola/lola_pcm.c
Source file repositories/reference/linux-study-clean/sound/pci/lola/lola_pcm.c
File Facts
- System
- Linux kernel
- Corpus path
sound/pci/lola/lola_pcm.c- Extension
.c- Size
- 17844 bytes
- Lines
- 682
- 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
linux/kernel.hlinux/init.hlinux/dma-mapping.hlinux/pci.hlinux/delay.hsound/core.hsound/pcm.hlola.h
Detected Declarations
function Copyrightfunction lola_get_lrcfunction lola_get_tstampfunction lola_stream_clear_pending_irqfunction lola_stream_startfunction lola_stream_stopfunction wait_for_srst_clearfunction lola_stream_wait_for_fifofunction lola_sync_wait_for_fifofunction snd_pcm_group_for_each_entryfunction lola_sync_pausefunction lola_stream_resetfunction lola_pcm_openfunction lola_cleanup_slave_streamsfunction lola_pcm_closefunction lola_pcm_hw_paramsfunction lola_pcm_hw_freefunction setup_bdlefunction lola_setup_periodsfunction lola_get_format_verbfunction lola_set_stream_configfunction lola_setup_controllerfunction lola_pcm_preparefunction scoped_guardfunction lola_pcm_triggerfunction lola_pcm_pointerfunction lola_pcm_updatefunction lola_create_pcmfunction lola_init_streamfunction lola_init_pcm
Annotated Snippet
snd_pcm_group_for_each_entry(s, substream) {
struct lola_stream *str;
if (s->pcm->card != substream->pcm->card)
continue;
str = lola_get_stream(s);
if (str->prepared && str->paused) {
unsigned int reg;
reg = lola_dsd_read(chip, str->dsd, STS);
if ((reg & LOLA_DSD_STS_FIFORDY) != val) {
pending = str->dsd + 1;
break;
}
if (ready)
str->paused = 0;
}
}
if (!pending)
return 0;
msleep(1);
}
dev_warn(chip->card->dev, "FIFO not ready (pending %d)\n", pending - 1);
return -EIO;
}
/* finish pause - prepare for a new resume */
static void lola_sync_pause(struct lola *chip,
struct snd_pcm_substream *substream)
{
struct snd_pcm_substream *s;
lola_sync_wait_for_fifo(chip, substream, false);
snd_pcm_group_for_each_entry(s, substream) {
struct lola_stream *str;
if (s->pcm->card != substream->pcm->card)
continue;
str = lola_get_stream(s);
if (str->paused && str->prepared)
lola_dsd_write(chip, str->dsd, CTL, LOLA_DSD_CTL_SRUN |
LOLA_DSD_CTL_IOCE | LOLA_DSD_CTL_DEIE);
}
lola_sync_wait_for_fifo(chip, substream, true);
}
static void lola_stream_reset(struct lola *chip, struct lola_stream *str)
{
if (str->prepared) {
if (str->paused)
lola_sync_pause(chip, str->substream);
str->prepared = 0;
lola_dsd_write(chip, str->dsd, CTL,
LOLA_DSD_CTL_IOCE | LOLA_DSD_CTL_DEIE);
lola_stream_wait_for_fifo(chip, str, false);
lola_stream_clear_pending_irq(chip, str);
lola_dsd_write(chip, str->dsd, CTL, LOLA_DSD_CTL_SRST);
lola_dsd_write(chip, str->dsd, LVI, 0);
lola_dsd_write(chip, str->dsd, BDPU, 0);
lola_dsd_write(chip, str->dsd, BDPL, 0);
wait_for_srst_clear(chip, str);
}
}
static const struct snd_pcm_hardware lola_pcm_hw = {
.info = (SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_PAUSE),
.formats = (SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S32_LE |
SNDRV_PCM_FMTBIT_FLOAT_LE),
.rates = SNDRV_PCM_RATE_8000_192000,
.rate_min = 8000,
.rate_max = 192000,
.channels_min = 1,
.channels_max = 2,
.buffer_bytes_max = LOLA_MAX_BUF_SIZE,
.period_bytes_min = 128,
.period_bytes_max = LOLA_MAX_BUF_SIZE / 2,
.periods_min = 2,
.periods_max = LOLA_MAX_BDL_ENTRIES,
.fifo_size = 0,
};
static int lola_pcm_open(struct snd_pcm_substream *substream)
{
struct lola *chip = snd_pcm_substream_chip(substream);
struct lola_pcm *pcm = lola_get_pcm(substream);
struct lola_stream *str = lola_get_stream(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/init.h`, `linux/dma-mapping.h`, `linux/pci.h`, `linux/delay.h`, `sound/core.h`, `sound/pcm.h`, `lola.h`.
- Detected declarations: `function Copyright`, `function lola_get_lrc`, `function lola_get_tstamp`, `function lola_stream_clear_pending_irq`, `function lola_stream_start`, `function lola_stream_stop`, `function wait_for_srst_clear`, `function lola_stream_wait_for_fifo`, `function lola_sync_wait_for_fifo`, `function snd_pcm_group_for_each_entry`.
- 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.