sound/hda/codecs/senarytech.c
Source file repositories/reference/linux-study-clean/sound/hda/codecs/senarytech.c
File Facts
- System
- Linux kernel
- Corpus path
sound/hda/codecs/senarytech.c- Extension
.c- Size
- 7622 bytes
- Lines
- 305
- 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/delay.hlinux/slab.hlinux/module.hsound/core.hsound/jack.hsound/hda_codec.hhda_local.hhda_auto_parser.hhda_beep.hhda_jack.hgeneric.h
Detected Declarations
struct senary_specfunction set_beep_ampfunction senary_auto_parse_beepfunction senary_auto_parse_eapdfunction for_each_hda_codec_nodefunction senary_init_verbfunction senary_auto_turn_eapdfunction senary_auto_vmaster_hookfunction senary_init_gpio_ledfunction senary_initfunction senary_shutdownfunction senary_removefunction senary_suspendfunction senary_probe
Annotated Snippet
struct senary_spec {
struct hda_gen_spec gen;
/* extra EAPD pins */
unsigned int num_eapds;
hda_nid_t eapds[4];
bool dynamic_eapd;
hda_nid_t mute_led_eapd;
unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
int mute_led_polarity;
unsigned int gpio_led;
unsigned int gpio_mute_led_mask;
unsigned int gpio_mic_led_mask;
};
enum {
SENARY_FIXUP_PINCFG_DEFAULT,
};
static const struct hda_pintbl senary_pincfg_default[] = {
{ 0x16, 0x02211020 }, /* Headphone */
{ 0x17, 0x40f001f0 }, /* Not used */
{ 0x18, 0x05a1904d }, /* Mic */
{ 0x19, 0x02a1104e }, /* Headset Mic */
{ 0x1a, 0x01819030 }, /* Line-in */
{ 0x1d, 0x01014010 }, /* Line-out */
{}
};
static const struct hda_fixup senary_fixups[] = {
[SENARY_FIXUP_PINCFG_DEFAULT] = {
.type = HDA_FIXUP_PINS,
.v.pins = senary_pincfg_default,
},
};
/* Quirk table for specific machines can be added here */
static const struct hda_quirk sn6186_fixups[] = {
{}
};
#ifdef CONFIG_SND_HDA_INPUT_BEEP
/* additional beep mixers; private_value will be overwritten */
static const struct snd_kcontrol_new senary_beep_mixer[] = {
HDA_CODEC_VOLUME_MONO("Beep Playback Volume", 0, 1, 0, HDA_OUTPUT),
HDA_CODEC_MUTE_BEEP_MONO("Beep Playback Switch", 0, 1, 0, HDA_OUTPUT),
};
static int set_beep_amp(struct senary_spec *spec, hda_nid_t nid,
int idx, int dir)
{
struct snd_kcontrol_new *knew;
unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 1, idx, dir);
int i;
for (i = 0; i < ARRAY_SIZE(senary_beep_mixer); i++) {
knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
&senary_beep_mixer[i]);
if (!knew)
return -ENOMEM;
knew->private_value = beep_amp;
}
spec->gen.beep_nid = nid;
return 0;
}
static int senary_auto_parse_beep(struct hda_codec *codec)
{
struct senary_spec *spec = codec->spec;
hda_nid_t nid;
for_each_hda_codec_node(nid, codec)
if ((get_wcaps_type(get_wcaps(codec, nid)) == AC_WID_BEEP) &&
(get_wcaps(codec, nid) & (AC_WCAP_OUT_AMP | AC_WCAP_AMP_OVRD)))
return set_beep_amp(spec, nid, 0, HDA_OUTPUT);
return 0;
}
#else
#define senary_auto_parse_beep(codec) 0
#endif
/* parse EAPDs */
static void senary_auto_parse_eapd(struct hda_codec *codec)
{
struct senary_spec *spec = codec->spec;
hda_nid_t nid;
Annotation
- Immediate include surface: `linux/init.h`, `linux/delay.h`, `linux/slab.h`, `linux/module.h`, `sound/core.h`, `sound/jack.h`, `sound/hda_codec.h`, `hda_local.h`.
- Detected declarations: `struct senary_spec`, `function set_beep_amp`, `function senary_auto_parse_beep`, `function senary_auto_parse_eapd`, `function for_each_hda_codec_node`, `function senary_init_verb`, `function senary_auto_turn_eapd`, `function senary_auto_vmaster_hook`, `function senary_init_gpio_led`, `function senary_init`.
- 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.