sound/drivers/pcsp/pcsp_mixer.c
Source file repositories/reference/linux-study-clean/sound/drivers/pcsp/pcsp_mixer.c
File Facts
- System
- Linux kernel
- Corpus path
sound/drivers/pcsp/pcsp_mixer.c- Extension
.c- Size
- 4139 bytes
- Lines
- 165
- Domain
- Driver Families
- Bucket
- sound/drivers
- 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
sound/core.hsound/control.hpcsp.h
Detected Declarations
function Copyrightfunction pcsp_enable_getfunction pcsp_enable_putfunction pcsp_treble_infofunction pcsp_treble_getfunction pcsp_treble_putfunction pcsp_pcspkr_infofunction pcsp_pcspkr_getfunction pcsp_pcspkr_putfunction snd_pcsp_ctls_addfunction snd_pcsp_new_mixer
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* PC-Speaker driver for Linux
*
* Mixer implementation.
* Copyright (C) 2001-2008 Stas Sergeev
*/
#include <sound/core.h>
#include <sound/control.h>
#include "pcsp.h"
static int pcsp_enable_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
uinfo->count = 1;
uinfo->value.integer.min = 0;
uinfo->value.integer.max = 1;
return 0;
}
static int pcsp_enable_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_pcsp *chip = snd_kcontrol_chip(kcontrol);
ucontrol->value.integer.value[0] = chip->enable;
return 0;
}
static int pcsp_enable_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_pcsp *chip = snd_kcontrol_chip(kcontrol);
int changed = 0;
int enab = ucontrol->value.integer.value[0];
if (enab != chip->enable) {
chip->enable = enab;
changed = 1;
}
return changed;
}
static int pcsp_treble_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
struct snd_pcsp *chip = snd_kcontrol_chip(kcontrol);
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
uinfo->count = 1;
uinfo->value.enumerated.items = chip->max_treble + 1;
if (uinfo->value.enumerated.item > chip->max_treble)
uinfo->value.enumerated.item = chip->max_treble;
sprintf(uinfo->value.enumerated.name, "%lu",
(unsigned long)PCSP_CALC_RATE(uinfo->value.enumerated.item));
return 0;
}
static int pcsp_treble_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_pcsp *chip = snd_kcontrol_chip(kcontrol);
ucontrol->value.enumerated.item[0] = chip->treble;
return 0;
}
static int pcsp_treble_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_pcsp *chip = snd_kcontrol_chip(kcontrol);
int changed = 0;
int treble = ucontrol->value.enumerated.item[0];
if (treble != chip->treble) {
chip->treble = treble;
#if PCSP_DEBUG
dev_dbg(chip->card->dev, "PCSP: rate set to %li\n", PCSP_RATE());
#endif
changed = 1;
}
return changed;
}
static int pcsp_pcspkr_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
uinfo->count = 1;
uinfo->value.integer.min = 0;
uinfo->value.integer.max = 1;
return 0;
Annotation
- Immediate include surface: `sound/core.h`, `sound/control.h`, `pcsp.h`.
- Detected declarations: `function Copyright`, `function pcsp_enable_get`, `function pcsp_enable_put`, `function pcsp_treble_info`, `function pcsp_treble_get`, `function pcsp_treble_put`, `function pcsp_pcspkr_info`, `function pcsp_pcspkr_get`, `function pcsp_pcspkr_put`, `function snd_pcsp_ctls_add`.
- Atlas domain: Driver Families / sound/drivers.
- 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.