sound/pci/oxygen/oxygen_mixer.c
Source file repositories/reference/linux-study-clean/sound/pci/oxygen/oxygen_mixer.c
File Facts
- System
- Linux kernel
- Corpus path
sound/pci/oxygen/oxygen_mixer.c- Extension
.c- Size
- 31620 bytes
- Lines
- 1106
- Domain
- Driver Families
- Bucket
- sound/pci
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/mutex.hsound/ac97_codec.hsound/asoundef.hsound/control.hsound/tlv.hoxygen.hcm9780.h
Detected Declarations
function Copyrightfunction dac_volume_getfunction dac_volume_putfunction dac_mute_getfunction dac_mute_putfunction upmix_item_countfunction upmix_infofunction upmix_getfunction oxygen_update_dac_routingfunction upmix_putfunction spdif_switch_getfunction oxygen_spdif_ratefunction oxygen_update_spdif_sourcefunction spdif_switch_putfunction spdif_infofunction oxygen_to_iec958function iec958_to_oxygenfunction write_spdif_bitsfunction spdif_default_getfunction spdif_default_putfunction spdif_mask_getfunction spdif_pcm_getfunction spdif_pcm_putfunction spdif_input_mask_getfunction spdif_input_default_getfunction spdif_bit_switch_getfunction spdif_bit_switch_putfunction monitor_volume_infofunction monitor_getfunction monitor_putfunction ac97_switch_getfunction mute_ac97_ctlfunction ac97_switch_putfunction ac97_volume_infofunction ac97_volume_getfunction ac97_volume_putfunction mic_fmic_source_infofunction mic_fmic_source_getfunction mic_fmic_source_putfunction ac97_fp_rec_volume_infofunction ac97_fp_rec_volume_getfunction ac97_fp_rec_volume_putfunction oxygen_any_ctl_freefunction add_controlsfunction oxygen_mixer_initexport oxygen_update_dac_routing
Annotated Snippet
if (value->value.integer.value[i] != chip->dac_volume[i]) {
chip->dac_volume[i] = value->value.integer.value[i];
changed = 1;
}
if (changed)
chip->model.update_dac_volume(chip);
return changed;
}
static int dac_mute_get(struct snd_kcontrol *ctl,
struct snd_ctl_elem_value *value)
{
struct oxygen *chip = ctl->private_data;
guard(mutex)(&chip->mutex);
value->value.integer.value[0] = !chip->dac_mute;
return 0;
}
static int dac_mute_put(struct snd_kcontrol *ctl,
struct snd_ctl_elem_value *value)
{
struct oxygen *chip = ctl->private_data;
int changed;
guard(mutex)(&chip->mutex);
changed = (!value->value.integer.value[0]) != chip->dac_mute;
if (changed) {
chip->dac_mute = !value->value.integer.value[0];
chip->model.update_dac_mute(chip);
}
return changed;
}
static unsigned int upmix_item_count(struct oxygen *chip)
{
if (chip->model.dac_channels_pcm < 8)
return 2;
else if (chip->model.update_center_lfe_mix)
return 5;
else
return 3;
}
static int upmix_info(struct snd_kcontrol *ctl, struct snd_ctl_elem_info *info)
{
static const char *const names[5] = {
"Front",
"Front+Surround",
"Front+Surround+Back",
"Front+Surround+Center/LFE",
"Front+Surround+Center/LFE+Back",
};
struct oxygen *chip = ctl->private_data;
unsigned int count = upmix_item_count(chip);
return snd_ctl_enum_info(info, 1, count, names);
}
static int upmix_get(struct snd_kcontrol *ctl, struct snd_ctl_elem_value *value)
{
struct oxygen *chip = ctl->private_data;
guard(mutex)(&chip->mutex);
value->value.enumerated.item[0] = chip->dac_routing;
return 0;
}
void oxygen_update_dac_routing(struct oxygen *chip)
{
/* DAC 0: front, DAC 1: surround, DAC 2: center/LFE, DAC 3: back */
static const unsigned int reg_values[5] = {
/* stereo -> front */
(0 << OXYGEN_PLAY_DAC0_SOURCE_SHIFT) |
(1 << OXYGEN_PLAY_DAC1_SOURCE_SHIFT) |
(2 << OXYGEN_PLAY_DAC2_SOURCE_SHIFT) |
(3 << OXYGEN_PLAY_DAC3_SOURCE_SHIFT),
/* stereo -> front+surround */
(0 << OXYGEN_PLAY_DAC0_SOURCE_SHIFT) |
(0 << OXYGEN_PLAY_DAC1_SOURCE_SHIFT) |
(2 << OXYGEN_PLAY_DAC2_SOURCE_SHIFT) |
(3 << OXYGEN_PLAY_DAC3_SOURCE_SHIFT),
/* stereo -> front+surround+back */
(0 << OXYGEN_PLAY_DAC0_SOURCE_SHIFT) |
(0 << OXYGEN_PLAY_DAC1_SOURCE_SHIFT) |
(2 << OXYGEN_PLAY_DAC2_SOURCE_SHIFT) |
(0 << OXYGEN_PLAY_DAC3_SOURCE_SHIFT),
/* stereo -> front+surround+center/LFE */
(0 << OXYGEN_PLAY_DAC0_SOURCE_SHIFT) |
(0 << OXYGEN_PLAY_DAC1_SOURCE_SHIFT) |
Annotation
- Immediate include surface: `linux/mutex.h`, `sound/ac97_codec.h`, `sound/asoundef.h`, `sound/control.h`, `sound/tlv.h`, `oxygen.h`, `cm9780.h`.
- Detected declarations: `function Copyright`, `function dac_volume_get`, `function dac_volume_put`, `function dac_mute_get`, `function dac_mute_put`, `function upmix_item_count`, `function upmix_info`, `function upmix_get`, `function oxygen_update_dac_routing`, `function upmix_put`.
- Atlas domain: Driver Families / sound/pci.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.