sound/firewire/digi00x/digi00x-stream.c
Source file repositories/reference/linux-study-clean/sound/firewire/digi00x/digi00x-stream.c
File Facts
- System
- Linux kernel
- Corpus path
sound/firewire/digi00x/digi00x-stream.c- Extension
.c- Size
- 10638 bytes
- Lines
- 451
- 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 snd_dg00x_stream_get_local_ratefunction snd_dg00x_stream_set_local_ratefunction snd_dg00x_stream_get_clockfunction snd_dg00x_stream_check_external_clockfunction snd_dg00x_stream_get_external_ratefunction finish_sessionfunction begin_sessionfunction keep_resourcesfunction init_streamfunction destroy_streamfunction snd_dg00x_stream_init_duplexfunction snd_dg00x_stream_destroy_duplexfunction snd_dg00x_stream_reserve_duplexfunction snd_dg00x_stream_start_duplexfunction snd_dg00x_stream_stop_duplexfunction snd_dg00x_stream_update_duplexfunction snd_dg00x_stream_lock_changedfunction snd_dg00x_stream_lock_tryfunction snd_dg00x_stream_lock_release
Annotated Snippet
if (err < 0) {
fw_iso_resources_free(&dg00x->rx_resources);
return err;
}
err = amdtp_domain_set_events_per_period(&dg00x->domain,
frames_per_period, frames_per_buffer);
if (err < 0) {
fw_iso_resources_free(&dg00x->rx_resources);
fw_iso_resources_free(&dg00x->tx_resources);
return err;
}
}
return 0;
}
int snd_dg00x_stream_start_duplex(struct snd_dg00x *dg00x)
{
unsigned int generation = dg00x->rx_resources.generation;
int err = 0;
if (dg00x->substreams_counter == 0)
return 0;
if (amdtp_streaming_error(&dg00x->tx_stream) ||
amdtp_streaming_error(&dg00x->rx_stream)) {
amdtp_domain_stop(&dg00x->domain);
finish_session(dg00x);
}
if (generation != fw_parent_device(dg00x->unit)->card->generation) {
err = fw_iso_resources_update(&dg00x->tx_resources);
if (err < 0)
goto error;
err = fw_iso_resources_update(&dg00x->rx_resources);
if (err < 0)
goto error;
}
/*
* No packets are transmitted without receiving packets, reagardless of
* which source of clock is used.
*/
if (!amdtp_stream_running(&dg00x->rx_stream)) {
int spd = fw_parent_device(dg00x->unit)->max_speed;
err = begin_session(dg00x);
if (err < 0)
goto error;
err = amdtp_domain_add_stream(&dg00x->domain, &dg00x->rx_stream,
dg00x->rx_resources.channel, spd);
if (err < 0)
goto error;
err = amdtp_domain_add_stream(&dg00x->domain, &dg00x->tx_stream,
dg00x->tx_resources.channel, spd);
if (err < 0)
goto error;
// NOTE: The device doesn't start packet transmission till receiving any packet.
// It ignores presentation time expressed by the value of syt field of CIP header
// in received packets. The sequence of the number of data blocks per packet is
// important for media clock recovery.
err = amdtp_domain_start(&dg00x->domain, 0, true, true);
if (err < 0)
goto error;
if (!amdtp_domain_wait_ready(&dg00x->domain, READY_TIMEOUT_MS)) {
err = -ETIMEDOUT;
goto error;
}
}
return 0;
error:
amdtp_domain_stop(&dg00x->domain);
finish_session(dg00x);
return err;
}
void snd_dg00x_stream_stop_duplex(struct snd_dg00x *dg00x)
{
if (dg00x->substreams_counter == 0) {
amdtp_domain_stop(&dg00x->domain);
finish_session(dg00x);
Annotation
- Immediate include surface: `digi00x.h`.
- Detected declarations: `function snd_dg00x_stream_get_local_rate`, `function snd_dg00x_stream_set_local_rate`, `function snd_dg00x_stream_get_clock`, `function snd_dg00x_stream_check_external_clock`, `function snd_dg00x_stream_get_external_rate`, `function finish_session`, `function begin_session`, `function keep_resources`, `function init_stream`, `function destroy_stream`.
- 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.