sound/firewire/oxfw/oxfw-stream.c
Source file repositories/reference/linux-study-clean/sound/firewire/oxfw/oxfw-stream.c
File Facts
- System
- Linux kernel
- Corpus path
sound/firewire/oxfw/oxfw-stream.c- Extension
.c- Size
- 21117 bytes
- Lines
- 890
- 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.
- 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
oxfw.hlinux/delay.h
Detected Declarations
function set_ratefunction set_stream_formatfunction start_streamfunction check_connection_used_by_othersfunction init_streamfunction keep_resourcesfunction snd_oxfw_stream_reserve_duplexfunction snd_oxfw_stream_start_duplexfunction snd_oxfw_stream_stop_duplexfunction destroy_streamfunction snd_oxfw_stream_init_duplexfunction snd_oxfw_stream_destroy_duplexfunction snd_oxfw_stream_update_duplexfunction snd_oxfw_stream_get_current_formationfunction snd_oxfw_stream_parse_formatfunction assume_stream_formatsfunction fill_stream_formatsfunction snd_oxfw_stream_discoverfunction snd_oxfw_stream_lock_changedfunction snd_oxfw_stream_lock_tryfunction snd_oxfw_stream_lock_release
Annotated Snippet
if (oxfw->has_output) {
cmp_connection_break(&oxfw->out_conn);
cmp_connection_release(&oxfw->out_conn);
}
}
if (oxfw->substreams_count == 0 ||
formation.rate != rate || formation.pcm != pcm_channels) {
err = set_stream_format(oxfw, stream, rate, pcm_channels);
if (err < 0) {
dev_err(&oxfw->unit->device,
"fail to set stream format: %d\n", err);
return err;
}
err = keep_resources(oxfw, &oxfw->rx_stream);
if (err < 0)
return err;
if (oxfw->has_output) {
err = keep_resources(oxfw, &oxfw->tx_stream);
if (err < 0) {
cmp_connection_release(&oxfw->in_conn);
return err;
}
}
err = amdtp_domain_set_events_per_period(&oxfw->domain,
frames_per_period, frames_per_buffer);
if (err < 0) {
cmp_connection_release(&oxfw->in_conn);
if (oxfw->has_output)
cmp_connection_release(&oxfw->out_conn);
return err;
}
}
return 0;
}
int snd_oxfw_stream_start_duplex(struct snd_oxfw *oxfw)
{
int err;
if (oxfw->substreams_count == 0)
return -EIO;
if (amdtp_streaming_error(&oxfw->rx_stream) ||
amdtp_streaming_error(&oxfw->tx_stream)) {
amdtp_domain_stop(&oxfw->domain);
cmp_connection_break(&oxfw->in_conn);
if (oxfw->has_output)
cmp_connection_break(&oxfw->out_conn);
}
if (!amdtp_stream_running(&oxfw->rx_stream)) {
unsigned int tx_init_skip_cycles = 0;
bool replay_seq = false;
err = start_stream(oxfw, &oxfw->rx_stream);
if (err < 0) {
dev_err(&oxfw->unit->device,
"fail to prepare rx stream: %d\n", err);
goto error;
}
if (oxfw->has_output &&
!amdtp_stream_running(&oxfw->tx_stream)) {
err = start_stream(oxfw, &oxfw->tx_stream);
if (err < 0) {
dev_err(&oxfw->unit->device,
"fail to prepare tx stream: %d\n", err);
goto error;
}
if (oxfw->quirks & SND_OXFW_QUIRK_JUMBO_PAYLOAD) {
// Just after changing sampling transfer frequency, many cycles are
// skipped for packet transmission.
tx_init_skip_cycles = 400;
} else if (oxfw->quirks & SND_OXFW_QUIRK_VOLUNTARY_RECOVERY) {
// It takes a bit time for target device to adjust event frequency
// according to nominal event frequency in isochronous packets from
// ALSA oxfw driver.
tx_init_skip_cycles = 4000;
} else {
replay_seq = true;
}
}
Annotation
- Immediate include surface: `oxfw.h`, `linux/delay.h`.
- Detected declarations: `function set_rate`, `function set_stream_format`, `function start_stream`, `function check_connection_used_by_others`, `function init_stream`, `function keep_resources`, `function snd_oxfw_stream_reserve_duplex`, `function snd_oxfw_stream_start_duplex`, `function snd_oxfw_stream_stop_duplex`, `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.