sound/pci/cs5535audio/cs5535audio_olpc.c
Source file repositories/reference/linux-study-clean/sound/pci/cs5535audio/cs5535audio_olpc.c
File Facts
- System
- Linux kernel
- Corpus path
sound/pci/cs5535audio/cs5535audio_olpc.c- Extension
.c- Size
- 4598 bytes
- Lines
- 188
- 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
sound/core.hsound/info.hsound/control.hsound/ac97_codec.hlinux/gpio.hasm/olpc.hcs5535audio.h
Detected Declarations
function intofunction olpc_mic_biasfunction olpc_dc_infofunction olpc_dc_getfunction olpc_dc_putfunction olpc_mic_infofunction olpc_mic_getfunction olpc_mic_putfunction olpc_prequirksfunction olpc_quirksfunction olpc_quirks_cleanup
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* OLPC XO-1 additional sound features
*
* Copyright © 2006 Jaya Kumar <jayakumar.lkml@gmail.com>
* Copyright © 2007-2008 Andres Salomon <dilinger@debian.org>
*/
#include <sound/core.h>
#include <sound/info.h>
#include <sound/control.h>
#include <sound/ac97_codec.h>
#include <linux/gpio.h>
#include <asm/olpc.h>
#include "cs5535audio.h"
#define DRV_NAME "cs5535audio-olpc"
/*
* OLPC has an additional feature on top of the regular AD1888 codec features.
* It has an Analog Input mode that is switched into (after disabling the
* High Pass Filter) via GPIO. It is supported on B2 and later models.
*/
void olpc_analog_input(struct snd_ac97 *ac97, int on)
{
int err;
if (!machine_is_olpc())
return;
/* update the High Pass Filter (via AC97_AD_TEST2) */
err = snd_ac97_update_bits(ac97, AC97_AD_TEST2,
1 << AC97_AD_HPFD_SHIFT, on << AC97_AD_HPFD_SHIFT);
if (err < 0) {
dev_err(ac97->bus->card->dev,
"setting High Pass Filter - %d\n", err);
return;
}
/* set Analog Input through GPIO */
gpio_set_value(OLPC_GPIO_MIC_AC, on);
}
/*
* OLPC XO-1's V_REFOUT is a mic bias enable.
*/
void olpc_mic_bias(struct snd_ac97 *ac97, int on)
{
int err;
if (!machine_is_olpc())
return;
on = on ? 0 : 1;
err = snd_ac97_update_bits(ac97, AC97_AD_MISC,
1 << AC97_AD_VREFD_SHIFT, on << AC97_AD_VREFD_SHIFT);
if (err < 0)
dev_err(ac97->bus->card->dev, "setting MIC Bias - %d\n", err);
}
static int olpc_dc_info(struct snd_kcontrol *kctl,
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 olpc_dc_get(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *v)
{
v->value.integer.value[0] = gpio_get_value(OLPC_GPIO_MIC_AC);
return 0;
}
static int olpc_dc_put(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *v)
{
struct cs5535audio *cs5535au = snd_kcontrol_chip(kctl);
olpc_analog_input(cs5535au->ac97, v->value.integer.value[0]);
return 1;
}
static int olpc_mic_info(struct snd_kcontrol *kctl,
struct snd_ctl_elem_info *uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
uinfo->count = 1;
uinfo->value.integer.min = 0;
Annotation
- Immediate include surface: `sound/core.h`, `sound/info.h`, `sound/control.h`, `sound/ac97_codec.h`, `linux/gpio.h`, `asm/olpc.h`, `cs5535audio.h`.
- Detected declarations: `function into`, `function olpc_mic_bias`, `function olpc_dc_info`, `function olpc_dc_get`, `function olpc_dc_put`, `function olpc_mic_info`, `function olpc_mic_get`, `function olpc_mic_put`, `function olpc_prequirks`, `function olpc_quirks`.
- 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.