sound/firewire/motu/motu-pcm.c
Source file repositories/reference/linux-study-clean/sound/firewire/motu/motu-pcm.c
File Facts
- System
- Linux kernel
- Corpus path
sound/firewire/motu/motu-pcm.c- Extension
.c- Size
- 9494 bytes
- Lines
- 366
- 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
sound/pcm_params.hmotu.h
Detected Declarations
function Copyrightfunction motu_channels_constraintfunction limit_channels_and_ratesfunction init_hw_infofunction pcm_openfunction scoped_guardfunction pcm_closefunction pcm_hw_paramsfunction pcm_hw_freefunction capture_preparefunction scoped_guardfunction playback_preparefunction scoped_guardfunction capture_triggerfunction playback_triggerfunction capture_pointerfunction playback_pointerfunction capture_ackfunction playback_ackfunction snd_motu_create_pcm_devices
Annotated Snippet
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_motu_stream_lock_release(motu);
return err;
}
static int pcm_close(struct snd_pcm_substream *substream)
{
struct snd_motu *motu = substream->private_data;
snd_motu_stream_lock_release(motu);
return 0;
}
static int pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params)
{
struct snd_motu *motu = 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)(&motu->mutex);
err = snd_motu_stream_reserve_duplex(motu, rate,
frames_per_period, frames_per_buffer);
if (err >= 0)
++motu->substreams_counter;
}
return err;
}
static int pcm_hw_free(struct snd_pcm_substream *substream)
{
struct snd_motu *motu = substream->private_data;
guard(mutex)(&motu->mutex);
if (substream->runtime->state != SNDRV_PCM_STATE_OPEN)
--motu->substreams_counter;
snd_motu_stream_stop_duplex(motu);
return 0;
}
static int capture_prepare(struct snd_pcm_substream *substream)
{
struct snd_motu *motu = substream->private_data;
int err;
scoped_guard(mutex, &motu->mutex) {
err = snd_motu_stream_start_duplex(motu);
}
if (err >= 0)
amdtp_stream_pcm_prepare(&motu->tx_stream);
return 0;
}
static int playback_prepare(struct snd_pcm_substream *substream)
{
struct snd_motu *motu = substream->private_data;
int err;
scoped_guard(mutex, &motu->mutex) {
err = snd_motu_stream_start_duplex(motu);
}
if (err >= 0)
Annotation
- Immediate include surface: `sound/pcm_params.h`, `motu.h`.
- Detected declarations: `function Copyright`, `function motu_channels_constraint`, `function limit_channels_and_rates`, `function init_hw_info`, `function pcm_open`, `function scoped_guard`, `function pcm_close`, `function pcm_hw_params`, `function pcm_hw_free`, `function capture_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.