sound/pci/lola/lola_mixer.c
Source file repositories/reference/linux-study-clean/sound/pci/lola/lola_mixer.c
File Facts
- System
- Linux kernel
- Corpus path
sound/pci/lola/lola_mixer.c- Extension
.c- Size
- 24118 bytes
- Lines
- 843
- Domain
- Driver Families
- Bucket
- sound/pci
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/kernel.hlinux/init.hlinux/vmalloc.hlinux/io.hsound/core.hsound/control.hsound/pcm.hsound/tlv.hlola.h
Detected Declarations
function Copyrightfunction lola_init_pinsfunction lola_free_mixerfunction lola_init_mixer_widgetfunction lola_mixer_set_src_gainfunction lola_mixer_set_src_gainsfunction lola_mixer_set_mapping_gainfunction lola_mixer_set_dest_gainsfunction lola_setup_all_analog_gainsfunction set_analog_volumefunction lola_set_src_configfunction init_mixer_valuesfunction lola_analog_vol_infofunction lola_analog_vol_getfunction lola_analog_vol_putfunction lola_analog_vol_tlvfunction create_analog_mixerfunction lola_input_src_infofunction lola_input_src_getfunction lola_input_src_putfunction create_input_src_mixerfunction lola_src_gain_infofunction lola_src_gain_getfunction lola_src_gain_putfunction create_src_gain_mixerfunction gainfunction lola_dest_gain_getfunction lola_dest_gain_putfunction create_dest_gain_mixerfunction lola_create_mixer
Annotated Snippet
if (mask & (1 << i)) {
writew(*gains, &chip->mixer.array->src_gain[i]);
gains++;
}
}
writel(mask, &chip->mixer.array->src_gain_enable);
lola_codec_flush(chip);
if (chip->mixer.caps & LOLA_PEAK_METER_CAN_AGC_MASK) {
/* update for all srcs at once */
return lola_codec_write(chip, chip->mixer.nid,
LOLA_VERB_SET_SOURCE_GAIN, 0x80, 0);
}
/* update manually */
for (i = 0; i < LOLA_MIXER_DIM; i++) {
if (mask & (1 << i)) {
lola_codec_write(chip, chip->mixer.nid,
LOLA_VERB_SET_SOURCE_GAIN, i, 0);
}
}
return 0;
}
#endif /* not used */
static int lola_mixer_set_mapping_gain(struct lola *chip,
unsigned int src, unsigned int dest,
unsigned short gain, bool on)
{
unsigned int val;
if (!(chip->mixer.src_mask & (1 << src)) ||
!(chip->mixer.dest_mask & (1 << dest)))
return -EINVAL;
if (on)
writew(gain, &chip->mixer.array->dest_mix_gain[dest][src]);
val = readl(&chip->mixer.array->dest_mix_gain_enable[dest]);
if (on)
val |= (1 << src);
else
val &= ~(1 << src);
writel(val, &chip->mixer.array->dest_mix_gain_enable[dest]);
lola_codec_flush(chip);
return lola_codec_write(chip, chip->mixer.nid, LOLA_VERB_SET_MIX_GAIN,
src, dest);
}
#if 0 /* not used */
static int lola_mixer_set_dest_gains(struct lola *chip, unsigned int id,
unsigned int mask, unsigned short *gains)
{
int i;
if (!(chip->mixer.dest_mask & (1 << id)) ||
(chip->mixer.src_mask & mask) != mask)
return -EINVAL;
for (i = 0; i < LOLA_MIXER_DIM; i++) {
if (mask & (1 << i)) {
writew(*gains, &chip->mixer.array->dest_mix_gain[id][i]);
gains++;
}
}
writel(mask, &chip->mixer.array->dest_mix_gain_enable[id]);
lola_codec_flush(chip);
/* update for all dests at once */
return lola_codec_write(chip, chip->mixer.nid,
LOLA_VERB_SET_DESTINATION_GAIN, id, 0);
}
#endif /* not used */
/*
*/
static int set_analog_volume(struct lola *chip, int dir,
unsigned int idx, unsigned int val,
bool external_call);
int lola_setup_all_analog_gains(struct lola *chip, int dir, bool mute)
{
struct lola_pin *pin;
int idx, max_idx;
pin = chip->pin[dir].pins;
max_idx = chip->pin[dir].num_pins;
for (idx = 0; idx < max_idx; idx++) {
if (pin[idx].is_analog) {
unsigned int val = mute ? 0 : pin[idx].cur_gain_step;
/* set volume and do not save the value */
set_analog_volume(chip, dir, idx, val, false);
}
}
return lola_codec_flush(chip);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/init.h`, `linux/vmalloc.h`, `linux/io.h`, `sound/core.h`, `sound/control.h`, `sound/pcm.h`, `sound/tlv.h`.
- Detected declarations: `function Copyright`, `function lola_init_pins`, `function lola_free_mixer`, `function lola_init_mixer_widget`, `function lola_mixer_set_src_gain`, `function lola_mixer_set_src_gains`, `function lola_mixer_set_mapping_gain`, `function lola_mixer_set_dest_gains`, `function lola_setup_all_analog_gains`, `function set_analog_volume`.
- Atlas domain: Driver Families / sound/pci.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
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.