sound/firewire/digi00x/digi00x-pcm.c
Source file repositories/reference/linux-study-clean/sound/firewire/digi00x/digi00x-pcm.c
File Facts
- System
- Linux kernel
- Corpus path
sound/firewire/digi00x/digi00x-pcm.c- Extension
.c- Size
- 8775 bytes
- Lines
- 347
- Domain
- Driver Families
- Bucket
- sound/firewire
- 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
digi00x.h
Detected Declarations
function Copyrightfunction hw_rule_channelsfunction pcm_init_hw_paramsfunction pcm_openfunction scoped_guardfunction pcm_closefunction pcm_hw_paramsfunction pcm_hw_freefunction pcm_capture_preparefunction pcm_playback_preparefunction pcm_capture_triggerfunction pcm_playback_triggerfunction pcm_capture_pointerfunction pcm_playback_pointerfunction pcm_capture_ackfunction pcm_playback_ackfunction snd_dg00x_create_pcm_devices
Annotated Snippet
if (!detect) {
err = -EBUSY;
goto err_locked;
}
}
scoped_guard(mutex, &dg00x->mutex) {
// When source of clock is not internal or any stream is reserved for
// transmission of PCM frames, the available sampling rate is limited
// at current one.
if ((clock != SND_DG00X_CLOCK_INTERNAL) ||
(dg00x->substreams_counter > 0 && d->events_per_period > 0)) {
unsigned int frames_per_period = d->events_per_period;
unsigned int frames_per_buffer = d->events_per_buffer;
unsigned int rate;
err = snd_dg00x_stream_get_external_rate(dg00x, &rate);
if (err < 0)
goto err_locked;
substream->runtime->hw.rate_min = rate;
substream->runtime->hw.rate_max = rate;
if (frames_per_period > 0) {
err = snd_pcm_hw_constraint_minmax(substream->runtime,
SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
frames_per_period, frames_per_period);
if (err < 0)
goto err_locked;
err = snd_pcm_hw_constraint_minmax(substream->runtime,
SNDRV_PCM_HW_PARAM_BUFFER_SIZE,
frames_per_buffer, frames_per_buffer);
if (err < 0)
goto err_locked;
}
}
}
snd_pcm_set_sync(substream);
return 0;
err_locked:
snd_dg00x_stream_lock_release(dg00x);
return err;
}
static int pcm_close(struct snd_pcm_substream *substream)
{
struct snd_dg00x *dg00x = substream->private_data;
snd_dg00x_stream_lock_release(dg00x);
return 0;
}
static int pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params)
{
struct snd_dg00x *dg00x = substream->private_data;
int err = 0;
if (substream->runtime->state == SNDRV_PCM_STATE_OPEN) {
unsigned int rate = params_rate(hw_params);
unsigned int frames_per_period = params_period_size(hw_params);
unsigned int frames_per_buffer = params_buffer_size(hw_params);
guard(mutex)(&dg00x->mutex);
err = snd_dg00x_stream_reserve_duplex(dg00x, rate,
frames_per_period, frames_per_buffer);
if (err >= 0)
++dg00x->substreams_counter;
}
return err;
}
static int pcm_hw_free(struct snd_pcm_substream *substream)
{
struct snd_dg00x *dg00x = substream->private_data;
guard(mutex)(&dg00x->mutex);
if (substream->runtime->state != SNDRV_PCM_STATE_OPEN)
--dg00x->substreams_counter;
snd_dg00x_stream_stop_duplex(dg00x);
return 0;
}
Annotation
- Immediate include surface: `digi00x.h`.
- Detected declarations: `function Copyright`, `function hw_rule_channels`, `function pcm_init_hw_params`, `function pcm_open`, `function scoped_guard`, `function pcm_close`, `function pcm_hw_params`, `function pcm_hw_free`, `function pcm_capture_prepare`, `function pcm_playback_prepare`.
- Atlas domain: Driver Families / sound/firewire.
- 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.