sound/usb/mixer_scarlett.c
Source file repositories/reference/linux-study-clean/sound/usb/mixer_scarlett.c
File Facts
- System
- Linux kernel
- Corpus path
sound/usb/mixer_scarlett.c- Extension
.c- Size
- 41155 bytes
- Lines
- 1457
- Domain
- Driver Families
- Bucket
- sound/usb
- 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
linux/slab.hlinux/usb.hlinux/usb/audio-v2.hsound/core.hsound/control.hsound/tlv.husbaudio.hmixer.hhelper.hpower.hmixer_scarlett.h
Detected Declarations
struct scarlett_mixer_elem_enum_infostruct scarlett_mixer_controlstruct scarlett_device_infofunction forte_set_ctl_valuefunction forte_get_ctl_valuefunction centidBfunction forte_input_gain_getfunction forte_input_gain_putfunction forte_input_gain_resumefunction forte_ctl_enum_getfunction forte_ctl_enum_putfunction forte_ctl_enum_resumefunction forte_ctl_switch_getfunction forte_ctl_switch_putfunction forte_ctl_switch_resumefunction scarlett_ctl_switch_infofunction scarlett_ctl_switch_getfunction scarlett_ctl_switch_putfunction scarlett_ctl_resumefunction scarlett_ctl_infofunction scarlett_ctl_getfunction scarlett_ctl_putfunction scarlett_generate_namefunction scarlett_ctl_enum_dynamic_infofunction scarlett_ctl_enum_infofunction scarlett_ctl_enum_getfunction scarlett_ctl_enum_putfunction scarlett_ctl_enum_resumefunction scarlett_ctl_meter_getfunction add_new_ctlfunction add_output_ctlsfunction scarlett_controls_create_genericfunction Focusritefunction Focusrite
Annotated Snippet
struct scarlett_mixer_elem_enum_info {
int start;
int len;
int offsets[SND_SCARLETT_OFFSETS_MAX];
char const * const *names;
};
struct scarlett_mixer_control {
unsigned char num;
unsigned char type;
const char *name;
};
struct scarlett_device_info {
int matrix_in;
int matrix_out;
int input_len;
int output_len;
bool has_output_source_routing;
struct scarlett_mixer_elem_enum_info opt_master;
struct scarlett_mixer_elem_enum_info opt_matrix;
/* initial values for matrix mux */
int matrix_mux_init[SND_SCARLETT_MATRIX_IN_MAX];
int num_controls; /* number of items in controls */
const struct scarlett_mixer_control controls[SND_SCARLETT_CONTROLS_MAX];
};
/********************** Enum Strings *************************/
static const struct scarlett_mixer_elem_enum_info opt_pad = {
.start = 0,
.len = 2,
.offsets = {},
.names = (char const * const []){
"0dB", "-10dB"
}
};
static const struct scarlett_mixer_elem_enum_info opt_gain = {
.start = 0,
.len = 2,
.offsets = {},
.names = (char const * const []){
"Lo", "Hi"
}
};
static const struct scarlett_mixer_elem_enum_info opt_impedance = {
.start = 0,
.len = 2,
.offsets = {},
.names = (char const * const []){
"Line", "Hi-Z"
}
};
static const struct scarlett_mixer_elem_enum_info opt_clock = {
.start = 1,
.len = 3,
.offsets = {},
.names = (char const * const []){
"Internal", "SPDIF", "ADAT"
}
};
static const struct scarlett_mixer_elem_enum_info opt_sync = {
.start = 0,
.len = 2,
.offsets = {},
.names = (char const * const []){
"No Lock", "Locked"
}
};
/* Forte-specific input control options */
static const struct scarlett_mixer_elem_enum_info opt_forte_source = {
.start = 0,
.len = 3,
.offsets = {},
.names = (char const * const []){
"Mic", "Line", "Inst"
}
};
/*
* Forte-specific USB control functions
Annotation
- Immediate include surface: `linux/slab.h`, `linux/usb.h`, `linux/usb/audio-v2.h`, `sound/core.h`, `sound/control.h`, `sound/tlv.h`, `usbaudio.h`, `mixer.h`.
- Detected declarations: `struct scarlett_mixer_elem_enum_info`, `struct scarlett_mixer_control`, `struct scarlett_device_info`, `function forte_set_ctl_value`, `function forte_get_ctl_value`, `function centidB`, `function forte_input_gain_get`, `function forte_input_gain_put`, `function forte_input_gain_resume`, `function forte_ctl_enum_get`.
- Atlas domain: Driver Families / sound/usb.
- 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.