sound/usb/usx2y/us144mkii_controls.c
Source file repositories/reference/linux-study-clean/sound/usb/usx2y/us144mkii_controls.c
File Facts
- System
- Linux kernel
- Corpus path
sound/usb/usx2y/us144mkii_controls.c- Extension
.c- Size
- 14461 bytes
- Lines
- 445
- 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
us144mkii.h
Detected Declarations
function tascam_playback_source_infofunction tascam_line_out_getfunction scoped_guardfunction tascam_line_out_putfunction scoped_guardfunction tascam_digital_out_getfunction scoped_guardfunction tascam_digital_out_putfunction scoped_guardfunction tascam_capture_source_infofunction tascam_capture_12_getfunction scoped_guardfunction tascam_capture_12_putfunction scoped_guardfunction tascam_capture_34_getfunction scoped_guardfunction tascam_capture_34_putfunction scoped_guardfunction tascam_samplerate_infofunction tascam_samplerate_getfunction scoped_guardfunction tascam_create_controls
Annotated Snippet
if (tascam->line_out_source != ucontrol->value.enumerated.item[0]) {
tascam->line_out_source = ucontrol->value.enumerated.item[0];
changed = 1;
}
}
return changed;
}
/*
* tascam_line_out_control - ALSA kcontrol definition for Line Outputs Source.
*
* This defines a new ALSA mixer control named "Line OUTPUTS Source" that allows
* the user to select between "Playback 1-2" and "Playback 3-4" for the analog
* line outputs of the device. It uses the `tascam_playback_source_info` for
* information and `tascam_line_out_get`/`tascam_line_out_put` for value
* handling.
*/
static const struct snd_kcontrol_new tascam_line_out_control = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Line Playback Source",
.info = tascam_playback_source_info,
.get = tascam_line_out_get,
.put = tascam_line_out_put,
};
/*
* tascam_digital_out_get() - ALSA control get callback for Digital Outputs
* Source.
* @kcontrol: The ALSA kcontrol instance.
* @ucontrol: The ALSA control element value structure to fill.
*
* This function retrieves the current selection for the Digital Outputs source
* (Playback 1-2 or Playback 3-4) from the driver's private data and populates
* the ALSA control element value.
*
* Return: 0 on success.
*/
static int tascam_digital_out_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct tascam_card *tascam = snd_kcontrol_chip(kcontrol);
scoped_guard(spinlock_irqsave, &tascam->lock) {
ucontrol->value.enumerated.item[0] = tascam->digital_out_source;
}
return 0;
}
/*
* tascam_digital_out_put() - ALSA control put callback for Digital Outputs
* Source.
* @kcontrol: The ALSA kcontrol instance.
* @ucontrol: The ALSA control element value structure containing the new value.
*
* This function sets the Digital Outputs source (Playback 1-2 or Playback 3-4)
* based on the user's selection from the ALSA control element. It validates
* the input and updates the driver's private data.
*
* Return: 1 if the value was changed, 0 if unchanged, or a negative error code.
*/
static int tascam_digital_out_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct tascam_card *tascam = snd_kcontrol_chip(kcontrol);
int changed = 0;
if (ucontrol->value.enumerated.item[0] > 1)
return -EINVAL;
scoped_guard(spinlock_irqsave, &tascam->lock) {
if (tascam->digital_out_source != ucontrol->value.enumerated.item[0]) {
tascam->digital_out_source = ucontrol->value.enumerated.item[0];
changed = 1;
}
}
return changed;
}
/*
* tascam_digital_out_control - ALSA kcontrol definition for Digital Outputs
* Source.
*
* This defines a new ALSA mixer control named "Digital OUTPUTS Source" that
* allows the user to select between "Playback 1-2" and "Playback 3-4" for the
* digital outputs of the device. It uses the `tascam_playback_source_info` for
* information and `tascam_digital_out_get`/`tascam_digital_out_put` for value
* handling.
*/
static const struct snd_kcontrol_new tascam_digital_out_control = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
Annotation
- Immediate include surface: `us144mkii.h`.
- Detected declarations: `function tascam_playback_source_info`, `function tascam_line_out_get`, `function scoped_guard`, `function tascam_line_out_put`, `function scoped_guard`, `function tascam_digital_out_get`, `function scoped_guard`, `function tascam_digital_out_put`, `function scoped_guard`, `function tascam_capture_source_info`.
- 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.