sound/drivers/vx/vx_pcm.c
Source file repositories/reference/linux-study-clean/sound/drivers/vx/vx_pcm.c
File Facts
- System
- Linux kernel
- Corpus path
sound/drivers/vx/vx_pcm.c- Extension
.c- Size
- 32276 bytes
- Lines
- 1234
- Domain
- Driver Families
- Bucket
- sound/drivers
- 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/slab.hlinux/delay.hsound/core.hsound/asoundef.hsound/pcm.hsound/vx_core.hvx_cmd.h
Detected Declarations
function Copyrightfunction vx_set_pcx_timefunction vx_set_differed_timefunction vx_set_stream_formatfunction vx_set_formatfunction vx_set_iblfunction vx_get_pipe_statefunction vx_query_hbuffer_sizefunction vx_pipe_can_startfunction vx_conf_pipefunction vx_send_irqafunction vx_toggle_pipefunction acknowledgefunction vx_stop_pipefunction vx_alloc_pipefunction vx_free_pipefunction vx_start_streamfunction vx_stop_streamfunction vx_pcm_playback_openfunction vx_pcm_playback_closefunction vx_notify_end_of_bufferfunction vx_pcm_playback_transfer_chunkfunction vx_update_pipe_positionfunction vx_pcm_playback_transferfunction snd_pcm_period_elapsedfunction vx_pcm_triggerfunction vx_pcm_playback_pointerfunction vx_pcm_preparefunction vx_pcm_capture_openfunction vx_pcm_capture_closefunction vx_pcm_capture_updatefunction vx_pcm_capture_pointerfunction vx_pcm_update_intrfunction vx_init_audio_iofunction snd_vx_pcm_freefunction snd_vx_pcm_new
Annotated Snippet
if (pipe->transferred >= (int)runtime->period_size) {
pipe->transferred %= runtime->period_size;
snd_pcm_period_elapsed(subs);
}
}
}
/*
* vx_pcm_playback_trigger - trigger callback for playback
*/
static int vx_pcm_trigger(struct snd_pcm_substream *subs, int cmd)
{
struct vx_core *chip = snd_pcm_substream_chip(subs);
struct vx_pipe *pipe = subs->runtime->private_data;
int err;
if (chip->chip_status & VX_STAT_IS_STALE)
return -EBUSY;
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
if (! pipe->is_capture)
vx_pcm_playback_transfer(chip, subs, pipe, 2);
err = vx_start_stream(chip, pipe);
if (err < 0) {
pr_debug("vx: cannot start stream\n");
return err;
}
err = vx_toggle_pipe(chip, pipe, 1);
if (err < 0) {
pr_debug("vx: cannot start pipe\n");
vx_stop_stream(chip, pipe);
return err;
}
chip->pcm_running++;
pipe->running = 1;
break;
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND:
vx_toggle_pipe(chip, pipe, 0);
vx_stop_pipe(chip, pipe);
vx_stop_stream(chip, pipe);
chip->pcm_running--;
pipe->running = 0;
break;
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
err = vx_toggle_pipe(chip, pipe, 0);
if (err < 0)
return err;
break;
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
err = vx_toggle_pipe(chip, pipe, 1);
if (err < 0)
return err;
break;
default:
return -EINVAL;
}
return 0;
}
/*
* vx_pcm_playback_pointer - pointer callback for playback
*/
static snd_pcm_uframes_t vx_pcm_playback_pointer(struct snd_pcm_substream *subs)
{
struct snd_pcm_runtime *runtime = subs->runtime;
struct vx_pipe *pipe = runtime->private_data;
return pipe->position;
}
/*
* vx_pcm_prepare - prepare callback for playback and capture
*/
static int vx_pcm_prepare(struct snd_pcm_substream *subs)
{
struct vx_core *chip = snd_pcm_substream_chip(subs);
struct snd_pcm_runtime *runtime = subs->runtime;
struct vx_pipe *pipe = runtime->private_data;
int err, data_mode;
// int max_size, nchunks;
if (chip->chip_status & VX_STAT_IS_STALE)
return -EBUSY;
data_mode = (chip->uer_bits & IEC958_AES0_NONAUDIO) != 0;
if (data_mode != pipe->data_mode && ! pipe->is_capture) {
/* IEC958 status (raw-mode) was changed */
/* we reopen the pipe */
Annotation
- Immediate include surface: `linux/slab.h`, `linux/delay.h`, `sound/core.h`, `sound/asoundef.h`, `sound/pcm.h`, `sound/vx_core.h`, `vx_cmd.h`.
- Detected declarations: `function Copyright`, `function vx_set_pcx_time`, `function vx_set_differed_time`, `function vx_set_stream_format`, `function vx_set_format`, `function vx_set_ibl`, `function vx_get_pipe_state`, `function vx_query_hbuffer_size`, `function vx_pipe_can_start`, `function vx_conf_pipe`.
- Atlas domain: Driver Families / sound/drivers.
- 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.