sound/firewire/motu/motu-protocol-v3.c
Source file repositories/reference/linux-study-clean/sound/firewire/motu/motu-protocol-v3.c
File Facts
- System
- Linux kernel
- Corpus path
sound/firewire/motu/motu-protocol-v3.c- Extension
.c- Size
- 9176 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
linux/delay.hmotu.h
Detected Declarations
function Copyrightfunction snd_motu_protocol_v3_set_clock_ratefunction snd_motu_protocol_v3_get_clock_sourcefunction snd_motu_protocol_v3_switch_fetching_modefunction detect_packet_formats_with_opt_ifacesfunction snd_motu_protocol_v3_cache_packet_formats
Annotated Snippet
if (data == V3_CLOCK_SRC_OPT_IFACE_A) {
if (options & V3_NO_ADAT_OPT_IN_IFACE_A)
*src = SND_MOTU_CLOCK_SOURCE_SPDIF_ON_OPT_A;
else
*src = SND_MOTU_CLOCK_SOURCE_ADAT_ON_OPT_A;
} else {
if (options & V3_NO_ADAT_OPT_IN_IFACE_B)
*src = SND_MOTU_CLOCK_SOURCE_SPDIF_ON_OPT_B;
else
*src = SND_MOTU_CLOCK_SOURCE_ADAT_ON_OPT_B;
}
break;
}
default:
*src = SND_MOTU_CLOCK_SOURCE_UNKNOWN;
break;
}
return 0;
}
int snd_motu_protocol_v3_switch_fetching_mode(struct snd_motu *motu,
bool enable)
{
__be32 reg;
u32 data;
int err;
err = snd_motu_transaction_read(motu, V3_CLOCK_STATUS_OFFSET, ®,
sizeof(reg));
if (err < 0)
return 0;
data = be32_to_cpu(reg);
if (enable)
data |= V3_FETCH_PCM_FRAMES;
else
data &= ~V3_FETCH_PCM_FRAMES;
reg = cpu_to_be32(data);
return snd_motu_transaction_write(motu, V3_CLOCK_STATUS_OFFSET, ®,
sizeof(reg));
}
static int detect_packet_formats_with_opt_ifaces(struct snd_motu *motu, u32 data)
{
if (data & V3_ENABLE_OPT_IN_IFACE_A) {
if (data & V3_NO_ADAT_OPT_IN_IFACE_A) {
motu->tx_packet_formats.pcm_chunks[0] += 4;
motu->tx_packet_formats.pcm_chunks[1] += 4;
} else {
motu->tx_packet_formats.pcm_chunks[0] += 8;
motu->tx_packet_formats.pcm_chunks[1] += 4;
}
}
if (data & V3_ENABLE_OPT_IN_IFACE_B) {
if (data & V3_NO_ADAT_OPT_IN_IFACE_B) {
motu->tx_packet_formats.pcm_chunks[0] += 4;
motu->tx_packet_formats.pcm_chunks[1] += 4;
} else {
motu->tx_packet_formats.pcm_chunks[0] += 8;
motu->tx_packet_formats.pcm_chunks[1] += 4;
}
}
if (data & V3_ENABLE_OPT_OUT_IFACE_A) {
if (data & V3_NO_ADAT_OPT_OUT_IFACE_A) {
motu->rx_packet_formats.pcm_chunks[0] += 4;
motu->rx_packet_formats.pcm_chunks[1] += 4;
} else {
motu->rx_packet_formats.pcm_chunks[0] += 8;
motu->rx_packet_formats.pcm_chunks[1] += 4;
}
}
if (data & V3_ENABLE_OPT_OUT_IFACE_B) {
if (data & V3_NO_ADAT_OPT_OUT_IFACE_B) {
motu->rx_packet_formats.pcm_chunks[0] += 4;
motu->rx_packet_formats.pcm_chunks[1] += 4;
} else {
motu->rx_packet_formats.pcm_chunks[0] += 8;
motu->rx_packet_formats.pcm_chunks[1] += 4;
}
}
return 0;
}
int snd_motu_protocol_v3_cache_packet_formats(struct snd_motu *motu)
Annotation
- Immediate include surface: `linux/delay.h`, `motu.h`.
- Detected declarations: `function Copyright`, `function snd_motu_protocol_v3_set_clock_rate`, `function snd_motu_protocol_v3_get_clock_source`, `function snd_motu_protocol_v3_switch_fetching_mode`, `function detect_packet_formats_with_opt_ifaces`, `function snd_motu_protocol_v3_cache_packet_formats`.
- 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.