sound/firewire/fireface/ff-stream.c
Source file repositories/reference/linux-study-clean/sound/firewire/fireface/ff-stream.c
File Facts
- System
- Linux kernel
- Corpus path
sound/firewire/fireface/ff-stream.c- Extension
.c- Size
- 6222 bytes
- Lines
- 277
- 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
ff.h
Detected Declarations
function Copyrightfunction finish_sessionfunction init_streamfunction destroy_streamfunction snd_ff_stream_init_duplexfunction snd_ff_stream_destroy_duplexfunction snd_ff_stream_reserve_duplexfunction snd_ff_stream_start_duplexfunction snd_ff_stream_stop_duplexfunction snd_ff_stream_update_duplexfunction snd_ff_stream_lock_changedfunction snd_ff_stream_lock_tryfunction snd_ff_stream_lock_release
Annotated Snippet
if (err < 0) {
fw_iso_resources_free(&ff->tx_resources);
fw_iso_resources_free(&ff->rx_resources);
return err;
}
}
return 0;
}
int snd_ff_stream_start_duplex(struct snd_ff *ff, unsigned int rate)
{
int err;
if (ff->substreams_counter == 0)
return 0;
if (amdtp_streaming_error(&ff->tx_stream) ||
amdtp_streaming_error(&ff->rx_stream)) {
amdtp_domain_stop(&ff->domain);
finish_session(ff);
}
/*
* Regardless of current source of clock signal, drivers transfer some
* packets. Then, the device transfers packets.
*/
if (!amdtp_stream_running(&ff->rx_stream)) {
int spd = fw_parent_device(ff->unit)->max_speed;
err = ff->spec->protocol->begin_session(ff, rate);
if (err < 0)
goto error;
err = amdtp_domain_add_stream(&ff->domain, &ff->rx_stream,
ff->rx_resources.channel, spd);
if (err < 0)
goto error;
err = amdtp_domain_add_stream(&ff->domain, &ff->tx_stream,
ff->tx_resources.channel, spd);
if (err < 0)
goto error;
// NOTE: The device doesn't transfer packets unless receiving any packet. The
// sequence of tx packets includes cycle skip corresponding to empty packet or
// NODATA packet in IEC 61883-1/6. The sequence of the number of data blocks per
// packet is important for media clock recovery.
err = amdtp_domain_start(&ff->domain, 0, true, true);
if (err < 0)
goto error;
if (!amdtp_domain_wait_ready(&ff->domain, READY_TIMEOUT_MS)) {
err = -ETIMEDOUT;
goto error;
}
err = ff->spec->protocol->switch_fetching_mode(ff, true);
if (err < 0)
goto error;
}
return 0;
error:
amdtp_domain_stop(&ff->domain);
finish_session(ff);
return err;
}
void snd_ff_stream_stop_duplex(struct snd_ff *ff)
{
if (ff->substreams_counter == 0) {
amdtp_domain_stop(&ff->domain);
finish_session(ff);
fw_iso_resources_free(&ff->tx_resources);
fw_iso_resources_free(&ff->rx_resources);
}
}
void snd_ff_stream_update_duplex(struct snd_ff *ff)
{
amdtp_domain_stop(&ff->domain);
// The device discontinue to transfer packets.
amdtp_stream_pcm_abort(&ff->tx_stream);
amdtp_stream_pcm_abort(&ff->rx_stream);
}
Annotation
- Immediate include surface: `ff.h`.
- Detected declarations: `function Copyright`, `function finish_session`, `function init_stream`, `function destroy_stream`, `function snd_ff_stream_init_duplex`, `function snd_ff_stream_destroy_duplex`, `function snd_ff_stream_reserve_duplex`, `function snd_ff_stream_start_duplex`, `function snd_ff_stream_stop_duplex`, `function snd_ff_stream_update_duplex`.
- 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.