sound/isa/msnd/msnd_pinnacle_mixer.c
Source file repositories/reference/linux-study-clean/sound/isa/msnd/msnd_pinnacle_mixer.c
File Facts
- System
- Linux kernel
- Corpus path
sound/isa/msnd/msnd_pinnacle_mixer.c- Extension
.c- Size
- 9811 bytes
- Lines
- 334
- Domain
- Driver Families
- Bucket
- sound/isa
- 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/io.hlinux/export.hsound/core.hsound/control.hmsnd.hmsnd_pinnacle.h
Detected Declarations
function snd_msndmix_info_muxfunction snd_msndmix_get_muxfunction test_bitfunction snd_msndmix_set_muxfunction snd_msndmix_put_muxfunction snd_msndmix_volume_infofunction snd_msndmix_volume_getfunction snd_msndmix_setfunction snd_msndmix_volume_putfunction snd_msndmix_newfunction snd_msndmix_setupfunction snd_msndmix_force_recsrcexport snd_msndmix_newexport snd_msndmix_setupexport snd_msndmix_force_recsrc
Annotated Snippet
test_bit(F_HAVEDIGITAL, &chip->flags)) {
ucontrol->value.enumerated.item[0] = 2;
}
return 0;
}
static int snd_msndmix_set_mux(struct snd_msnd *chip, int val)
{
unsigned newrecsrc;
int change;
unsigned char msndbyte;
switch (val) {
case 0:
newrecsrc = MSND_MASK_IMIX;
msndbyte = HDEXAR_SET_ANA_IN;
break;
case 1:
newrecsrc = MSND_MASK_SYNTH;
msndbyte = HDEXAR_SET_SYNTH_IN;
break;
case 2:
newrecsrc = MSND_MASK_DIGITAL;
msndbyte = HDEXAR_SET_DAT_IN;
break;
default:
return -EINVAL;
}
change = newrecsrc != chip->recsrc;
if (change) {
change = 0;
if (!snd_msnd_send_word(chip, 0, 0, msndbyte))
if (!snd_msnd_send_dsp_cmd(chip, HDEX_AUX_REQ)) {
chip->recsrc = newrecsrc;
change = 1;
}
}
return change;
}
static int snd_msndmix_put_mux(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_msnd *msnd = snd_kcontrol_chip(kcontrol);
return snd_msndmix_set_mux(msnd, ucontrol->value.enumerated.item[0]);
}
static int snd_msndmix_volume_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 2;
uinfo->value.integer.min = 0;
uinfo->value.integer.max = 100;
return 0;
}
static int snd_msndmix_volume_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_msnd *msnd = snd_kcontrol_chip(kcontrol);
int addr = kcontrol->private_value;
guard(spinlock_irqsave)(&msnd->mixer_lock);
ucontrol->value.integer.value[0] = msnd->left_levels[addr] * 100;
ucontrol->value.integer.value[0] /= 0xFFFF;
ucontrol->value.integer.value[1] = msnd->right_levels[addr] * 100;
ucontrol->value.integer.value[1] /= 0xFFFF;
return 0;
}
#define update_volm(a, b) \
do { \
writew((dev->left_levels[a] >> 1) * \
readw(dev->SMA + SMA_wCurrMastVolLeft) / 0xffff, \
dev->SMA + SMA_##b##Left); \
writew((dev->right_levels[a] >> 1) * \
readw(dev->SMA + SMA_wCurrMastVolRight) / 0xffff, \
dev->SMA + SMA_##b##Right); \
} while (0);
#define update_potm(d, s, ar) \
do { \
writeb((dev->left_levels[d] >> 8) * \
readw(dev->SMA + SMA_wCurrMastVolLeft) / 0xffff, \
dev->SMA + SMA_##s##Left); \
writeb((dev->right_levels[d] >> 8) * \
Annotation
- Immediate include surface: `linux/io.h`, `linux/export.h`, `sound/core.h`, `sound/control.h`, `msnd.h`, `msnd_pinnacle.h`.
- Detected declarations: `function snd_msndmix_info_mux`, `function snd_msndmix_get_mux`, `function test_bit`, `function snd_msndmix_set_mux`, `function snd_msndmix_put_mux`, `function snd_msndmix_volume_info`, `function snd_msndmix_volume_get`, `function snd_msndmix_set`, `function snd_msndmix_volume_put`, `function snd_msndmix_new`.
- Atlas domain: Driver Families / sound/isa.
- 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.