sound/pci/pcxhr/pcxhr_mixer.c
Source file repositories/reference/linux-study-clean/sound/pci/pcxhr/pcxhr_mixer.c
File Facts
- System
- Linux kernel
- Corpus path
sound/pci/pcxhr/pcxhr_mixer.c- Extension
.c- Size
- 35244 bytes
- Lines
- 1233
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/time.hlinux/interrupt.hlinux/init.hlinux/mutex.hsound/core.hpcxhr.hpcxhr_hwdep.hpcxhr_core.hsound/control.hsound/tlv.hsound/asoundef.hpcxhr_mixer.hpcxhr_mix22.h
Detected Declarations
function pcxhr_update_analog_audio_levelfunction pcxhr_analog_vol_infofunction pcxhr_analog_vol_getfunction pcxhr_analog_vol_putfunction pcxhr_audio_sw_getfunction pcxhr_audio_sw_putfunction pcxhr_update_playback_stream_levelfunction pcxhr_update_audio_pipe_levelfunction pcxhr_digital_vol_infofunction pcxhr_pcm_vol_getfunction pcxhr_pcm_vol_putfunction pcxhr_pcm_sw_getfunction pcxhr_pcm_sw_putfunction pcxhr_monitor_vol_getfunction pcxhr_monitor_vol_putfunction pcxhr_monitor_sw_getfunction pcxhr_monitor_sw_putfunction pcxhr_set_audio_sourcefunction pcxhr_audio_src_infofunction pcxhr_audio_src_getfunction pcxhr_audio_src_putfunction pcxhr_clock_type_infofunction pcxhr_clock_type_getfunction pcxhr_clock_type_putfunction pcxhr_clock_rate_infofunction pcxhr_clock_rate_getfunction pcxhr_iec958_infofunction pcxhr_iec958_capture_bytefunction pcxhr_iec958_getfunction pcxhr_iec958_mask_getfunction pcxhr_iec958_update_bytefunction pcxhr_iec958_putfunction pcxhr_init_audio_levelsfunction pcxhr_create_mixer
Annotated Snippet
if (chip->mgr->is_hr_stereo) {
uinfo->value.integer.min =
HR222_LINE_PLAYBACK_LEVEL_MIN; /* -25 dB */
uinfo->value.integer.max =
HR222_LINE_PLAYBACK_LEVEL_MAX; /* +24 dB */
} else {
uinfo->value.integer.min =
PCXHR_LINE_PLAYBACK_LEVEL_MIN; /*-104 dB */
uinfo->value.integer.max =
PCXHR_LINE_PLAYBACK_LEVEL_MAX; /* +24 dB */
}
} else { /* capture */
if (chip->mgr->is_hr_stereo) {
uinfo->value.integer.min =
HR222_LINE_CAPTURE_LEVEL_MIN; /*-112 dB */
uinfo->value.integer.max =
HR222_LINE_CAPTURE_LEVEL_MAX; /* +15.5 dB */
} else {
uinfo->value.integer.min =
PCXHR_LINE_CAPTURE_LEVEL_MIN; /*-112 dB */
uinfo->value.integer.max =
PCXHR_LINE_CAPTURE_LEVEL_MAX; /* +15.5 dB */
}
}
return 0;
}
static int pcxhr_analog_vol_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol);
guard(mutex)(&chip->mgr->mixer_mutex);
if (kcontrol->private_value == 0) { /* playback */
ucontrol->value.integer.value[0] = chip->analog_playback_volume[0];
ucontrol->value.integer.value[1] = chip->analog_playback_volume[1];
} else { /* capture */
ucontrol->value.integer.value[0] = chip->analog_capture_volume[0];
ucontrol->value.integer.value[1] = chip->analog_capture_volume[1];
}
return 0;
}
static int pcxhr_analog_vol_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_pcxhr *chip = snd_kcontrol_chip(kcontrol);
int changed = 0;
int is_capture, i;
guard(mutex)(&chip->mgr->mixer_mutex);
is_capture = (kcontrol->private_value != 0);
for (i = 0; i < 2; i++) {
int new_volume = ucontrol->value.integer.value[i];
int *stored_volume = is_capture ?
&chip->analog_capture_volume[i] :
&chip->analog_playback_volume[i];
if (is_capture) {
if (chip->mgr->is_hr_stereo) {
if (new_volume < HR222_LINE_CAPTURE_LEVEL_MIN ||
new_volume > HR222_LINE_CAPTURE_LEVEL_MAX)
continue;
} else {
if (new_volume < PCXHR_LINE_CAPTURE_LEVEL_MIN ||
new_volume > PCXHR_LINE_CAPTURE_LEVEL_MAX)
continue;
}
} else {
if (chip->mgr->is_hr_stereo) {
if (new_volume < HR222_LINE_PLAYBACK_LEVEL_MIN ||
new_volume > HR222_LINE_PLAYBACK_LEVEL_MAX)
continue;
} else {
if (new_volume < PCXHR_LINE_PLAYBACK_LEVEL_MIN ||
new_volume > PCXHR_LINE_PLAYBACK_LEVEL_MAX)
continue;
}
}
if (*stored_volume != new_volume) {
*stored_volume = new_volume;
changed = 1;
if (chip->mgr->is_hr_stereo)
hr222_update_analog_audio_level(chip,
is_capture, i);
else
pcxhr_update_analog_audio_level(chip,
is_capture, i);
}
}
return changed;
Annotation
- Immediate include surface: `linux/time.h`, `linux/interrupt.h`, `linux/init.h`, `linux/mutex.h`, `sound/core.h`, `pcxhr.h`, `pcxhr_hwdep.h`, `pcxhr_core.h`.
- Detected declarations: `function pcxhr_update_analog_audio_level`, `function pcxhr_analog_vol_info`, `function pcxhr_analog_vol_get`, `function pcxhr_analog_vol_put`, `function pcxhr_audio_sw_get`, `function pcxhr_audio_sw_put`, `function pcxhr_update_playback_stream_level`, `function pcxhr_update_audio_pipe_level`, `function pcxhr_digital_vol_info`, `function pcxhr_pcm_vol_get`.
- Atlas domain: Driver Families / sound/pci.
- 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.