sound/pci/cs5535audio/cs5535audio_pcm.c
Source file repositories/reference/linux-study-clean/sound/pci/cs5535audio/cs5535audio_pcm.c
File Facts
- System
- Linux kernel
- Corpus path
sound/pci/cs5535audio/cs5535audio_pcm.c- Extension
.c- Size
- 12377 bytes
- Lines
- 432
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/init.hlinux/pci.hsound/core.hsound/control.hsound/initval.hsound/asoundef.hsound/pcm.hsound/pcm_params.hsound/ac97_codec.hcs5535audio.h
Detected Declarations
function snd_cs5535audio_playback_openfunction snd_cs5535audio_playback_closefunction cs5535audio_build_dma_packetsfunction cs5535audio_playback_enable_dmafunction cs5535audio_playback_disable_dmafunction cs5535audio_playback_pause_dmafunction cs5535audio_playback_setup_prdfunction cs5535audio_playback_read_prdfunction cs5535audio_playback_read_dma_pntrfunction cs5535audio_capture_enable_dmafunction cs5535audio_capture_disable_dmafunction cs5535audio_capture_pause_dmafunction cs5535audio_capture_setup_prdfunction cs5535audio_capture_read_prdfunction cs5535audio_capture_read_dma_pntrfunction cs5535audio_clear_dma_packetsfunction snd_cs5535audio_hw_paramsfunction snd_cs5535audio_hw_freefunction snd_cs5535audio_playback_preparefunction snd_cs5535audio_triggerfunction snd_cs5535audio_pcm_pointerfunction snd_cs5535audio_capture_openfunction snd_cs5535audio_capture_closefunction snd_cs5535audio_capture_preparefunction snd_cs5535audio_pcm
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Driver for audio on multifunction CS5535 companion device
* Copyright (C) Jaya Kumar
*
* Based on Jaroslav Kysela and Takashi Iwai's examples.
* This work was sponsored by CIS(M) Sdn Bhd.
*
* todo: add be fmt support, spdif, pm
*/
#include <linux/init.h>
#include <linux/pci.h>
#include <sound/core.h>
#include <sound/control.h>
#include <sound/initval.h>
#include <sound/asoundef.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/ac97_codec.h>
#include "cs5535audio.h"
static const struct snd_pcm_hardware snd_cs5535audio_playback =
{
.info = (
SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_PAUSE |
SNDRV_PCM_INFO_RESUME
),
.formats = (
SNDRV_PCM_FMTBIT_S16_LE
),
.rates = (
SNDRV_PCM_RATE_CONTINUOUS |
SNDRV_PCM_RATE_8000_48000
),
.rate_min = 4000,
.rate_max = 48000,
.channels_min = 2,
.channels_max = 2,
.buffer_bytes_max = (128*1024),
.period_bytes_min = 64,
.period_bytes_max = (64*1024 - 16),
.periods_min = 1,
.periods_max = CS5535AUDIO_MAX_DESCRIPTORS,
.fifo_size = 0,
};
static const struct snd_pcm_hardware snd_cs5535audio_capture =
{
.info = (
SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_MMAP_VALID
),
.formats = (
SNDRV_PCM_FMTBIT_S16_LE
),
.rates = (
SNDRV_PCM_RATE_CONTINUOUS |
SNDRV_PCM_RATE_8000_48000
),
.rate_min = 4000,
.rate_max = 48000,
.channels_min = 2,
.channels_max = 2,
.buffer_bytes_max = (128*1024),
.period_bytes_min = 64,
.period_bytes_max = (64*1024 - 16),
.periods_min = 1,
.periods_max = CS5535AUDIO_MAX_DESCRIPTORS,
.fifo_size = 0,
};
static int snd_cs5535audio_playback_open(struct snd_pcm_substream *substream)
{
int err;
struct cs5535audio *cs5535au = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
runtime->hw = snd_cs5535audio_playback;
runtime->hw.rates = cs5535au->ac97->rates[AC97_RATES_FRONT_DAC];
snd_pcm_limit_hw_rates(runtime);
cs5535au->playback_substream = substream;
runtime->private_data = &(cs5535au->dmas[CS5535AUDIO_DMA_PLAYBACK]);
err = snd_pcm_hw_constraint_integer(runtime,
Annotation
- Immediate include surface: `linux/init.h`, `linux/pci.h`, `sound/core.h`, `sound/control.h`, `sound/initval.h`, `sound/asoundef.h`, `sound/pcm.h`, `sound/pcm_params.h`.
- Detected declarations: `function snd_cs5535audio_playback_open`, `function snd_cs5535audio_playback_close`, `function cs5535audio_build_dma_packets`, `function cs5535audio_playback_enable_dma`, `function cs5535audio_playback_disable_dma`, `function cs5535audio_playback_pause_dma`, `function cs5535audio_playback_setup_prd`, `function cs5535audio_playback_read_prd`, `function cs5535audio_playback_read_dma_pntr`, `function cs5535audio_capture_enable_dma`.
- Atlas domain: Driver Families / sound/pci.
- Implementation status: source 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.