sound/hda/codecs/analog.c
Source file repositories/reference/linux-study-clean/sound/hda/codecs/analog.c
File Facts
- System
- Linux kernel
- Corpus path
sound/hda/codecs/analog.c- Extension
.c- Size
- 30389 bytes
- Lines
- 1177
- Domain
- Driver Families
- Bucket
- sound/hda
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/init.hlinux/slab.hlinux/module.hsound/core.hsound/hda_codec.hhda_local.hhda_auto_parser.hhda_beep.hhda_jack.hgeneric.h
Detected Declarations
struct ad198x_specfunction create_beep_ctlsfunction ad198x_power_eapd_writefunction ad198x_power_eapdfunction ad_codec_suspendfunction ad_vmaster_eapd_hookfunction ad_codec_build_controlsfunction ad198x_parse_auto_configfunction alloc_ad_specfunction ad_fixup_inv_jack_detectfunction ad1986a_fixup_eapdfunction ad1986a_fixup_eapd_mix_infunction ad1986a_probefunction ad1983_auto_smux_enum_infofunction ad1983_auto_smux_enum_getfunction ad1983_auto_smux_enum_putfunction ad1983_add_spdif_mux_ctlfunction ad1983_probefunction ad1981_fixup_hp_eapdfunction ad1981_fixup_amp_overridefunction ad1981_probefunction DACfunction ad1988_auto_smux_enum_getfunction ad1988_auto_smux_enum_putfunction ad_codec_initfunction ad1988_add_spdif_mux_ctlfunction ad1988_probefunction ad1884_fixup_amp_overridefunction ad1884_vmaster_hp_gpio_hookfunction ad1884_fixup_hp_eapdfunction ad1884_fixup_thinkpadfunction ad1884_probefunction ad1882_probefunction ad_codec_probe
Annotated Snippet
struct ad198x_spec {
struct hda_gen_spec gen;
int model;
/* for auto parser */
int smux_paths[4];
unsigned int cur_smux;
hda_nid_t eapd_nid;
unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
int num_smux_conns;
unsigned int gpio_data;
};
#ifdef CONFIG_SND_HDA_INPUT_BEEP
/* additional beep mixers; the actual parameters are overwritten at build */
static const struct snd_kcontrol_new ad_beep_mixer[] = {
HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_OUTPUT),
HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_OUTPUT),
{ } /* end */
};
#define set_beep_amp(spec, nid, idx, dir) \
((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 1, idx, dir)) /* mono */
#else
#define set_beep_amp(spec, nid, idx, dir) /* NOP */
#endif
#ifdef CONFIG_SND_HDA_INPUT_BEEP
static int create_beep_ctls(struct hda_codec *codec)
{
struct ad198x_spec *spec = codec->spec;
const struct snd_kcontrol_new *knew;
if (!spec->beep_amp)
return 0;
for (knew = ad_beep_mixer ; knew->name; knew++) {
int err;
struct snd_kcontrol *kctl;
kctl = snd_ctl_new1(knew, codec);
if (!kctl)
return -ENOMEM;
kctl->private_value = spec->beep_amp;
err = snd_hda_ctl_add(codec, 0, kctl);
if (err < 0)
return err;
}
return 0;
}
#else
#define create_beep_ctls(codec) 0
#endif
static void ad198x_power_eapd_write(struct hda_codec *codec, hda_nid_t front,
hda_nid_t hp)
{
if (snd_hda_query_pin_caps(codec, front) & AC_PINCAP_EAPD)
snd_hda_codec_write(codec, front, 0, AC_VERB_SET_EAPD_BTLENABLE,
!codec->inv_eapd ? 0x00 : 0x02);
if (snd_hda_query_pin_caps(codec, hp) & AC_PINCAP_EAPD)
snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_EAPD_BTLENABLE,
!codec->inv_eapd ? 0x00 : 0x02);
}
static void ad198x_power_eapd(struct hda_codec *codec)
{
/* We currently only handle front, HP */
switch (codec->core.vendor_id) {
case 0x11d41882:
case 0x11d4882a:
case 0x11d41884:
case 0x11d41984:
case 0x11d41883:
case 0x11d4184a:
case 0x11d4194a:
case 0x11d4194b:
case 0x11d41988:
case 0x11d4198b:
case 0x11d4989a:
case 0x11d4989b:
ad198x_power_eapd_write(codec, 0x12, 0x11);
break;
case 0x11d41981:
case 0x11d41983:
ad198x_power_eapd_write(codec, 0x05, 0x06);
break;
case 0x11d41986:
Annotation
- Immediate include surface: `linux/init.h`, `linux/slab.h`, `linux/module.h`, `sound/core.h`, `sound/hda_codec.h`, `hda_local.h`, `hda_auto_parser.h`, `hda_beep.h`.
- Detected declarations: `struct ad198x_spec`, `function create_beep_ctls`, `function ad198x_power_eapd_write`, `function ad198x_power_eapd`, `function ad_codec_suspend`, `function ad_vmaster_eapd_hook`, `function ad_codec_build_controls`, `function ad198x_parse_auto_config`, `function alloc_ad_spec`, `function ad_fixup_inv_jack_detect`.
- Atlas domain: Driver Families / sound/hda.
- 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.