sound/hda/codecs/conexant.c
Source file repositories/reference/linux-study-clean/sound/hda/codecs/conexant.c
File Facts
- System
- Linux kernel
- Corpus path
sound/hda/codecs/conexant.c- Extension
.c- Size
- 40846 bytes
- Lines
- 1344
- 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.hhelpers/thinkpad.chelpers/ideapad_hotkey_led.c
Detected Declarations
struct conexant_specfunction set_beep_ampfunction cx_auto_parse_beepfunction cx_auto_parse_eapdfunction for_each_hda_codec_nodefunction cx_auto_turn_eapdfunction cx_auto_vmaster_hookfunction cx_auto_vmaster_mute_ledfunction cxt_init_gpio_ledfunction cx_fixup_headset_recogfunction cx_initfunction cx_auto_shutdownfunction cx_removefunction cx_process_headset_pluginfunction cx_update_headset_mic_vreffunction cx_suspendfunction cxt_fixup_stereo_dmicfunction cxt_fixup_update_pinctlfunction cxt5066_increase_mic_boostfunction cxt_update_headset_modefunction cxt_update_headset_mode_hookfunction cxt_fixup_headphone_micfunction cxt_fixup_headset_micfunction olpc_xo_update_mic_boostfunction olpc_xo_update_mic_pinsfunction olpc_xo_automicfunction olpc_xo_capture_hookfunction olpc_xo_dc_mode_getfunction olpc_xo_dc_mode_putfunction olpc_xo_dc_bias_enum_getfunction olpc_xo_dc_bias_enum_infofunction olpc_xo_dc_bias_enum_putfunction olpc_xo_mic_boost_putfunction cxt_fixup_olpc_xofunction cxt_fixup_mute_led_eapdfunction cxt_fixup_cap_mix_ampfunction cxt_fixup_cap_mix_amp_5047function cxt_fixup_hp_gate_mic_jackfunction cxt_update_gpio_ledfunction cxt_gpio_mute_updatefunction cxt_gpio_micmute_updatefunction cxt_setup_mute_ledfunction cxt_setup_gpio_unmutefunction cxt_fixup_mute_led_gpiofunction cxt_fixup_hp_zbook_mute_ledfunction cxt_fixup_hp_a_ufunction createdfunction cx_probe
Annotated Snippet
struct conexant_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() */
/* OLPC XO specific */
bool recording;
bool dc_enable;
unsigned int dc_input_bias; /* offset into olpc_xo_dc_bias */
struct nid_path *dc_mode_path;
int mute_led_polarity;
unsigned int gpio_led;
unsigned int gpio_mute_led_mask;
unsigned int gpio_mic_led_mask;
bool is_cx11880_sn6140;
};
#ifdef CONFIG_SND_HDA_INPUT_BEEP
/* additional beep mixers; private_value will be overwritten */
static const struct snd_kcontrol_new cxt_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 conexant_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;
spec->gen.beep_nid = nid;
for (i = 0; i < ARRAY_SIZE(cxt_beep_mixer); i++) {
knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
&cxt_beep_mixer[i]);
if (!knew)
return -ENOMEM;
knew->private_value = beep_amp;
}
return 0;
}
static int cx_auto_parse_beep(struct hda_codec *codec)
{
struct conexant_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)
return set_beep_amp(spec, nid, 0, HDA_OUTPUT);
return 0;
}
#else
#define cx_auto_parse_beep(codec) 0
#endif
/*
* Automatic parser for CX20641 & co
*/
/* parse EAPDs */
static void cx_auto_parse_eapd(struct hda_codec *codec)
{
struct conexant_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_PIN)
continue;
if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD))
continue;
spec->eapds[spec->num_eapds++] = nid;
if (spec->num_eapds >= ARRAY_SIZE(spec->eapds))
break;
}
/* NOTE: below is a wild guess; if we have more than two EAPDs,
* it's a new chip, where EAPDs are supposed to be associated to
* pins, and we can control EAPD per pin.
* OTOH, if only one or two EAPDs are found, it's an old chip,
* thus it might control over all pins.
*/
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 conexant_spec`, `function set_beep_amp`, `function cx_auto_parse_beep`, `function cx_auto_parse_eapd`, `function for_each_hda_codec_node`, `function cx_auto_turn_eapd`, `function cx_auto_vmaster_hook`, `function cx_auto_vmaster_mute_led`, `function cxt_init_gpio_led`, `function cx_fixup_headset_recog`.
- 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.