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.

Dependency Surface

Detected Declarations

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

Implementation Notes