1d0fa1179SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later 2c9b443d4STobin Davis /* 3c9b443d4STobin Davis * HD audio interface patch for Conexant HDA audio codec 4c9b443d4STobin Davis * 5c9b443d4STobin Davis * Copyright (c) 2006 Pototskiy Akex <alex.pototskiy@gmail.com> 6c9b443d4STobin Davis * Takashi Iwai <tiwai@suse.de> 7c9b443d4STobin Davis * Tobin Davis <tdavis@dsl-only.net> 8c9b443d4STobin Davis */ 9c9b443d4STobin Davis 10c9b443d4STobin Davis #include <linux/init.h> 11c9b443d4STobin Davis #include <linux/delay.h> 12c9b443d4STobin Davis #include <linux/slab.h> 13da155d5bSPaul Gortmaker #include <linux/module.h> 14c9b443d4STobin Davis #include <sound/core.h> 15bc7a166dSUlrich Dangel #include <sound/jack.h> 16bc7a166dSUlrich Dangel 17be57bfffSPierre-Louis Bossart #include <sound/hda_codec.h> 18c9b443d4STobin Davis #include "hda_local.h" 1923d30f28STakashi Iwai #include "hda_auto_parser.h" 20c0f8faf0SEinar Rünkaru #include "hda_beep.h" 211835a0f9STakashi Iwai #include "hda_jack.h" 22aed523f1STakashi Iwai #include "hda_generic.h" 23c9b443d4STobin Davis 24c9b443d4STobin Davis struct conexant_spec { 2523d30f28STakashi Iwai struct hda_gen_spec gen; 26c9b443d4STobin Davis 27bf92d1d5STakashi Iwai /* extra EAPD pins */ 28bf92d1d5STakashi Iwai unsigned int num_eapds; 29bf92d1d5STakashi Iwai hda_nid_t eapds[4]; 30ff359b14STakashi Iwai bool dynamic_eapd; 313542aed7STakashi Iwai hda_nid_t mute_led_eapd; 32bf92d1d5STakashi Iwai 33e4c3bce2SDavid Henningsson unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */ 34e4c3bce2SDavid Henningsson 353a00c660STakashi Iwai /* OPLC XO specific */ 363a00c660STakashi Iwai bool recording; 373a00c660STakashi Iwai bool dc_enable; 383a00c660STakashi Iwai unsigned int dc_input_bias; /* offset into olpc_xo_dc_bias */ 393a00c660STakashi Iwai struct nid_path *dc_mode_path; 405cd5b1bdSJerónimo Borque 415cd5b1bdSJerónimo Borque int mute_led_polarity; 425cd5b1bdSJerónimo Borque unsigned int gpio_led; 435cd5b1bdSJerónimo Borque unsigned int gpio_mute_led_mask; 445cd5b1bdSJerónimo Borque unsigned int gpio_mic_led_mask; 4524d74841Sbo liu bool is_cx8070_sn6140; 46c9b443d4STobin Davis }; 47c9b443d4STobin Davis 48bf92d1d5STakashi Iwai 49bf92d1d5STakashi Iwai #ifdef CONFIG_SND_HDA_INPUT_BEEP 5051e19ca5STakashi Iwai /* additional beep mixers; private_value will be overwritten */ 51bf92d1d5STakashi Iwai static const struct snd_kcontrol_new cxt_beep_mixer[] = { 52bf92d1d5STakashi Iwai HDA_CODEC_VOLUME_MONO("Beep Playback Volume", 0, 1, 0, HDA_OUTPUT), 53bf92d1d5STakashi Iwai HDA_CODEC_MUTE_BEEP_MONO("Beep Playback Switch", 0, 1, 0, HDA_OUTPUT), 54bf92d1d5STakashi Iwai }; 55bf92d1d5STakashi Iwai 5651e19ca5STakashi Iwai static int set_beep_amp(struct conexant_spec *spec, hda_nid_t nid, 5751e19ca5STakashi Iwai int idx, int dir) 58bf92d1d5STakashi Iwai { 5951e19ca5STakashi Iwai struct snd_kcontrol_new *knew; 6051e19ca5STakashi Iwai unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 1, idx, dir); 6151e19ca5STakashi Iwai int i; 62bf92d1d5STakashi Iwai 6351e19ca5STakashi Iwai spec->gen.beep_nid = nid; 6451e19ca5STakashi Iwai for (i = 0; i < ARRAY_SIZE(cxt_beep_mixer); i++) { 6551e19ca5STakashi Iwai knew = snd_hda_gen_add_kctl(&spec->gen, NULL, 6651e19ca5STakashi Iwai &cxt_beep_mixer[i]); 6751e19ca5STakashi Iwai if (!knew) 68bf92d1d5STakashi Iwai return -ENOMEM; 6951e19ca5STakashi Iwai knew->private_value = beep_amp; 70bf92d1d5STakashi Iwai } 71bf92d1d5STakashi Iwai return 0; 72bf92d1d5STakashi Iwai } 73bf92d1d5STakashi Iwai 7451e19ca5STakashi Iwai static int cx_auto_parse_beep(struct hda_codec *codec) 75f2e5731dSTakashi Iwai { 76f2e5731dSTakashi Iwai struct conexant_spec *spec = codec->spec; 777639a06cSTakashi Iwai hda_nid_t nid; 78f2e5731dSTakashi Iwai 797639a06cSTakashi Iwai for_each_hda_codec_node(nid, codec) 8051e19ca5STakashi Iwai if (get_wcaps_type(get_wcaps(codec, nid)) == AC_WID_BEEP) 8151e19ca5STakashi Iwai return set_beep_amp(spec, nid, 0, HDA_OUTPUT); 8251e19ca5STakashi Iwai return 0; 83f2e5731dSTakashi Iwai } 84f2e5731dSTakashi Iwai #else 8551e19ca5STakashi Iwai #define cx_auto_parse_beep(codec) 0 86f2e5731dSTakashi Iwai #endif 87f2e5731dSTakashi Iwai 8851e19ca5STakashi Iwai /* 8951e19ca5STakashi Iwai * Automatic parser for CX20641 & co 9051e19ca5STakashi Iwai */ 9151e19ca5STakashi Iwai 92254f2968STakashi Iwai /* parse EAPDs */ 9319110595STakashi Iwai static void cx_auto_parse_eapd(struct hda_codec *codec) 9419110595STakashi Iwai { 9519110595STakashi Iwai struct conexant_spec *spec = codec->spec; 967639a06cSTakashi Iwai hda_nid_t nid; 9719110595STakashi Iwai 987639a06cSTakashi Iwai for_each_hda_codec_node(nid, codec) { 9919110595STakashi Iwai if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) 10019110595STakashi Iwai continue; 10119110595STakashi Iwai if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)) 10219110595STakashi Iwai continue; 10319110595STakashi Iwai spec->eapds[spec->num_eapds++] = nid; 10419110595STakashi Iwai if (spec->num_eapds >= ARRAY_SIZE(spec->eapds)) 10519110595STakashi Iwai break; 10619110595STakashi Iwai } 107254f2968STakashi Iwai 108254f2968STakashi Iwai /* NOTE: below is a wild guess; if we have more than two EAPDs, 109254f2968STakashi Iwai * it's a new chip, where EAPDs are supposed to be associated to 110254f2968STakashi Iwai * pins, and we can control EAPD per pin. 111254f2968STakashi Iwai * OTOH, if only one or two EAPDs are found, it's an old chip, 112254f2968STakashi Iwai * thus it might control over all pins. 113254f2968STakashi Iwai */ 114aed523f1STakashi Iwai if (spec->num_eapds > 2) 115ff359b14STakashi Iwai spec->dynamic_eapd = 1; 116f2e5731dSTakashi Iwai } 117f2e5731dSTakashi Iwai 118da339866STakashi Iwai static void cx_auto_turn_eapd(struct hda_codec *codec, int num_pins, 119caf3c043SMichał Mirosław const hda_nid_t *pins, bool on) 120f2e5731dSTakashi Iwai { 121f2e5731dSTakashi Iwai int i; 122f2e5731dSTakashi Iwai for (i = 0; i < num_pins; i++) { 123f2e5731dSTakashi Iwai if (snd_hda_query_pin_caps(codec, pins[i]) & AC_PINCAP_EAPD) 124f2e5731dSTakashi Iwai snd_hda_codec_write(codec, pins[i], 0, 125da339866STakashi Iwai AC_VERB_SET_EAPD_BTLENABLE, 126da339866STakashi Iwai on ? 0x02 : 0); 127f2e5731dSTakashi Iwai } 128f2e5731dSTakashi Iwai } 129f2e5731dSTakashi Iwai 130527c73baSTakashi Iwai /* turn on/off EAPD according to Master switch */ 131527c73baSTakashi Iwai static void cx_auto_vmaster_hook(void *private_data, int enabled) 132527c73baSTakashi Iwai { 133527c73baSTakashi Iwai struct hda_codec *codec = private_data; 134527c73baSTakashi Iwai struct conexant_spec *spec = codec->spec; 135527c73baSTakashi Iwai 136527c73baSTakashi Iwai cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, enabled); 137527c73baSTakashi Iwai } 138527c73baSTakashi Iwai 1393542aed7STakashi Iwai /* turn on/off EAPD according to Master switch (inversely!) for mute LED */ 140929f718cSTakashi Iwai static int cx_auto_vmaster_mute_led(struct led_classdev *led_cdev, 141929f718cSTakashi Iwai enum led_brightness brightness) 1423542aed7STakashi Iwai { 143929f718cSTakashi Iwai struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); 1443542aed7STakashi Iwai struct conexant_spec *spec = codec->spec; 1453542aed7STakashi Iwai 1463542aed7STakashi Iwai snd_hda_codec_write(codec, spec->mute_led_eapd, 0, 1473542aed7STakashi Iwai AC_VERB_SET_EAPD_BTLENABLE, 148929f718cSTakashi Iwai brightness ? 0x02 : 0x00); 149929f718cSTakashi Iwai return 0; 1503542aed7STakashi Iwai } 1513542aed7STakashi Iwai 15256b26497STakashi Iwai static void cxt_init_gpio_led(struct hda_codec *codec) 15356b26497STakashi Iwai { 15456b26497STakashi Iwai struct conexant_spec *spec = codec->spec; 15556b26497STakashi Iwai unsigned int mask = spec->gpio_mute_led_mask | spec->gpio_mic_led_mask; 15656b26497STakashi Iwai 15756b26497STakashi Iwai if (mask) { 15856b26497STakashi Iwai snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_MASK, 15956b26497STakashi Iwai mask); 16056b26497STakashi Iwai snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DIRECTION, 16156b26497STakashi Iwai mask); 16256b26497STakashi Iwai snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 16356b26497STakashi Iwai spec->gpio_led); 16456b26497STakashi Iwai } 16556b26497STakashi Iwai } 16656b26497STakashi Iwai 16724d74841Sbo liu static void cx_fixup_headset_recog(struct hda_codec *codec) 16824d74841Sbo liu { 16924d74841Sbo liu unsigned int mic_persent; 17024d74841Sbo liu 17124d74841Sbo liu /* fix some headset type recognize fail issue, such as EDIFIER headset */ 17224d74841Sbo liu /* set micbiasd output current comparator threshold from 66% to 55%. */ 17324d74841Sbo liu snd_hda_codec_write(codec, 0x1c, 0, 0x320, 0x010); 17424d74841Sbo liu /* set OFF voltage for DFET from -1.2V to -0.8V, set headset micbias registor 17524d74841Sbo liu * value adjustment trim from 2.2K ohms to 2.0K ohms. 17624d74841Sbo liu */ 17724d74841Sbo liu snd_hda_codec_write(codec, 0x1c, 0, 0x3b0, 0xe10); 17824d74841Sbo liu /* fix reboot headset type recognize fail issue */ 17924d74841Sbo liu mic_persent = snd_hda_codec_read(codec, 0x19, 0, AC_VERB_GET_PIN_SENSE, 0x0); 18024d74841Sbo liu if (mic_persent & AC_PINSENSE_PRESENCE) 18124d74841Sbo liu /* enable headset mic VREF */ 18224d74841Sbo liu snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24); 18324d74841Sbo liu else 18424d74841Sbo liu /* disable headset mic VREF */ 18524d74841Sbo liu snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20); 18624d74841Sbo liu } 18724d74841Sbo liu 188ff359b14STakashi Iwai static int cx_auto_init(struct hda_codec *codec) 189ff359b14STakashi Iwai { 190ff359b14STakashi Iwai struct conexant_spec *spec = codec->spec; 191ff359b14STakashi Iwai snd_hda_gen_init(codec); 192ff359b14STakashi Iwai if (!spec->dynamic_eapd) 193ff359b14STakashi Iwai cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, true); 194e4c3bce2SDavid Henningsson 19556b26497STakashi Iwai cxt_init_gpio_led(codec); 196e4c3bce2SDavid Henningsson snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT); 197e4c3bce2SDavid Henningsson 19824d74841Sbo liu if (spec->is_cx8070_sn6140) 19924d74841Sbo liu cx_fixup_headset_recog(codec); 20024d74841Sbo liu 201ff359b14STakashi Iwai return 0; 202ff359b14STakashi Iwai } 203ff359b14STakashi Iwai 20495dc85dbSTakashi Iwai static void cx_auto_shutdown(struct hda_codec *codec) 205f6b28e4dSDavid Henningsson { 206f6b28e4dSDavid Henningsson struct conexant_spec *spec = codec->spec; 207f6b28e4dSDavid Henningsson 208bd819563STakashi Iwai snd_hda_gen_shutup_speakers(codec); 209bd819563STakashi Iwai 210d77a4b4aSPark Ju Hyung /* Turn the problematic codec into D3 to avoid spurious noises 211f6b28e4dSDavid Henningsson from the internal speaker during (and after) reboot */ 212f6b28e4dSDavid Henningsson cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, false); 21395dc85dbSTakashi Iwai } 21495dc85dbSTakashi Iwai 215f6b28e4dSDavid Henningsson static void cx_auto_free(struct hda_codec *codec) 216f6b28e4dSDavid Henningsson { 217327b34f2STakashi Iwai cx_auto_shutdown(codec); 218f6b28e4dSDavid Henningsson snd_hda_gen_free(codec); 219f6b28e4dSDavid Henningsson } 22008cf680cSDavid Henningsson 22124d74841Sbo liu static void cx_process_headset_plugin(struct hda_codec *codec) 22224d74841Sbo liu { 22324d74841Sbo liu unsigned int val; 22424d74841Sbo liu unsigned int count = 0; 22524d74841Sbo liu 22624d74841Sbo liu /* Wait headset detect done. */ 22724d74841Sbo liu do { 22824d74841Sbo liu val = snd_hda_codec_read(codec, 0x1c, 0, 0xca0, 0x0); 22924d74841Sbo liu if (val & 0x080) { 23024d74841Sbo liu codec_dbg(codec, "headset type detect done!\n"); 23124d74841Sbo liu break; 23224d74841Sbo liu } 23324d74841Sbo liu msleep(20); 23424d74841Sbo liu count++; 23524d74841Sbo liu } while (count < 3); 23624d74841Sbo liu val = snd_hda_codec_read(codec, 0x1c, 0, 0xcb0, 0x0); 23724d74841Sbo liu if (val & 0x800) { 23824d74841Sbo liu codec_dbg(codec, "headset plugin, type is CTIA\n"); 23924d74841Sbo liu snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24); 24024d74841Sbo liu } else if (val & 0x400) { 24124d74841Sbo liu codec_dbg(codec, "headset plugin, type is OMTP\n"); 24224d74841Sbo liu snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24); 24324d74841Sbo liu } else { 24424d74841Sbo liu codec_dbg(codec, "headphone plugin\n"); 24524d74841Sbo liu } 24624d74841Sbo liu } 24724d74841Sbo liu 248bc773441Ssongxiebing static void cx_update_headset_mic_vref(struct hda_codec *codec, struct hda_jack_callback *event) 24924d74841Sbo liu { 250bc773441Ssongxiebing unsigned int mic_present; 25124d74841Sbo liu 25224d74841Sbo liu /* In cx8070 and sn6140, the node 16 can only be config to headphone or disabled, 25324d74841Sbo liu * the node 19 can only be config to microphone or disabled. 25424d74841Sbo liu * Check hp&mic tag to process headset pulgin&plugout. 25524d74841Sbo liu */ 256bc773441Ssongxiebing mic_present = snd_hda_codec_read(codec, 0x19, 0, AC_VERB_GET_PIN_SENSE, 0x0); 257bc773441Ssongxiebing if (!(mic_present & AC_PINSENSE_PRESENCE)) /* mic plugout */ 25824d74841Sbo liu snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20); 259bc773441Ssongxiebing else 26024d74841Sbo liu cx_process_headset_plugin(codec); 26124d74841Sbo liu } 26224d74841Sbo liu 26395dc85dbSTakashi Iwai #ifdef CONFIG_PM 26495dc85dbSTakashi Iwai static int cx_auto_suspend(struct hda_codec *codec) 26595dc85dbSTakashi Iwai { 26695dc85dbSTakashi Iwai cx_auto_shutdown(codec); 26795dc85dbSTakashi Iwai return 0; 26895dc85dbSTakashi Iwai } 26995dc85dbSTakashi Iwai #endif 27095dc85dbSTakashi Iwai 27134cbe3a6STakashi Iwai static const struct hda_codec_ops cx_auto_patch_ops = { 27251e19ca5STakashi Iwai .build_controls = snd_hda_gen_build_controls, 273aed523f1STakashi Iwai .build_pcms = snd_hda_gen_build_pcms, 274ff359b14STakashi Iwai .init = cx_auto_init, 27508cf680cSDavid Henningsson .free = cx_auto_free, 276bc773441Ssongxiebing .unsol_event = snd_hda_jack_unsol_event, 277164a7adaSTakashi Iwai #ifdef CONFIG_PM 27895dc85dbSTakashi Iwai .suspend = cx_auto_suspend, 279164a7adaSTakashi Iwai .check_power_status = snd_hda_gen_check_power_status, 280164a7adaSTakashi Iwai #endif 281f2e5731dSTakashi Iwai }; 282f2e5731dSTakashi Iwai 283e92d4b08STakashi Iwai /* 284e92d4b08STakashi Iwai * pin fix-up 285e92d4b08STakashi Iwai */ 28618dcd304SDavid Henningsson enum { 28718dcd304SDavid Henningsson CXT_PINCFG_LENOVO_X200, 288d3980110STakashi Iwai CXT_PINCFG_LENOVO_TP410, 289239fb862SHuacai Chen CXT_PINCFG_LEMOTE_A1004, 290239fb862SHuacai Chen CXT_PINCFG_LEMOTE_A1205, 291ddb6ca75STakashi Iwai CXT_PINCFG_COMPAQ_CQ60, 29218dcd304SDavid Henningsson CXT_FIXUP_STEREO_DMIC, 293f83bb259SMeng Tang CXT_PINCFG_LENOVO_NOTEBOOK, 294239fb862SHuacai Chen CXT_FIXUP_INC_MIC_BOOST, 295e4c3bce2SDavid Henningsson CXT_FIXUP_HEADPHONE_MIC_PIN, 296e4c3bce2SDavid Henningsson CXT_FIXUP_HEADPHONE_MIC, 2974a437044STakashi Iwai CXT_FIXUP_GPIO1, 298ff50479aSTakashi Iwai CXT_FIXUP_ASPIRE_DMIC, 29908cf680cSDavid Henningsson CXT_FIXUP_THINKPAD_ACPI, 3003a00c660STakashi Iwai CXT_FIXUP_OLPC_XO, 301ad7725d3STakashi Iwai CXT_FIXUP_CAP_MIX_AMP, 3026dcbadefSTakashi Iwai CXT_FIXUP_TOSHIBA_P105, 303e5eac90dSTakashi Iwai CXT_FIXUP_HP_530, 304ea30e7dfSTakashi Iwai CXT_FIXUP_CAP_MIX_AMP_5047, 3053542aed7STakashi Iwai CXT_FIXUP_MUTE_LED_EAPD, 306cc3a47a2SJaroslav Kysela CXT_FIXUP_HP_DOCK, 3070eec8809STakashi Iwai CXT_FIXUP_HP_SPECTRE, 308f73cd43aSTakashi Iwai CXT_FIXUP_HP_GATE_MIC, 3095cd5b1bdSJerónimo Borque CXT_FIXUP_MUTE_LED_GPIO, 31056b26497STakashi Iwai CXT_FIXUP_HP_ZBOOK_MUTE_LED, 311322f74edSHui Wang CXT_FIXUP_HEADSET_MIC, 312322f74edSHui Wang CXT_FIXUP_HP_MIC_NO_PRESENCE, 31353447b46Sbo liu CXT_PINCFG_SWS_JS201D, 314*638e61b0SChristoffer Sandberg CXT_PINCFG_TOP_SPEAKER, 31518dcd304SDavid Henningsson }; 31618dcd304SDavid Henningsson 317b317b032STakashi Iwai /* for hda_fixup_thinkpad_acpi() */ 318b317b032STakashi Iwai #include "thinkpad_helper.c" 31908cf680cSDavid Henningsson 32023d30f28STakashi Iwai static void cxt_fixup_stereo_dmic(struct hda_codec *codec, 32123d30f28STakashi Iwai const struct hda_fixup *fix, int action) 322e92d4b08STakashi Iwai { 32318dcd304SDavid Henningsson struct conexant_spec *spec = codec->spec; 324aed523f1STakashi Iwai spec->gen.inv_dmic_split = 1; 325e92d4b08STakashi Iwai } 326e92d4b08STakashi Iwai 327239fb862SHuacai Chen static void cxt5066_increase_mic_boost(struct hda_codec *codec, 328239fb862SHuacai Chen const struct hda_fixup *fix, int action) 329239fb862SHuacai Chen { 330239fb862SHuacai Chen if (action != HDA_FIXUP_ACT_PRE_PROBE) 331239fb862SHuacai Chen return; 332239fb862SHuacai Chen 333239fb862SHuacai Chen snd_hda_override_amp_caps(codec, 0x17, HDA_OUTPUT, 334239fb862SHuacai Chen (0x3 << AC_AMPCAP_OFFSET_SHIFT) | 335239fb862SHuacai Chen (0x4 << AC_AMPCAP_NUM_STEPS_SHIFT) | 336239fb862SHuacai Chen (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) | 337239fb862SHuacai Chen (0 << AC_AMPCAP_MUTE_SHIFT)); 338239fb862SHuacai Chen } 339239fb862SHuacai Chen 340e4c3bce2SDavid Henningsson static void cxt_update_headset_mode(struct hda_codec *codec) 341e4c3bce2SDavid Henningsson { 342e4c3bce2SDavid Henningsson /* The verbs used in this function were tested on a Conexant CX20751/2 codec. */ 343e4c3bce2SDavid Henningsson int i; 344e4c3bce2SDavid Henningsson bool mic_mode = false; 345e4c3bce2SDavid Henningsson struct conexant_spec *spec = codec->spec; 346e4c3bce2SDavid Henningsson struct auto_pin_cfg *cfg = &spec->gen.autocfg; 347e4c3bce2SDavid Henningsson 348e4c3bce2SDavid Henningsson hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]]; 349e4c3bce2SDavid Henningsson 350e4c3bce2SDavid Henningsson for (i = 0; i < cfg->num_inputs; i++) 351e4c3bce2SDavid Henningsson if (cfg->inputs[i].pin == mux_pin) { 352e4c3bce2SDavid Henningsson mic_mode = !!cfg->inputs[i].is_headphone_mic; 353e4c3bce2SDavid Henningsson break; 354e4c3bce2SDavid Henningsson } 355e4c3bce2SDavid Henningsson 356e4c3bce2SDavid Henningsson if (mic_mode) { 357e4c3bce2SDavid Henningsson snd_hda_codec_write_cache(codec, 0x1c, 0, 0x410, 0x7c); /* enable merged mode for analog int-mic */ 358e4c3bce2SDavid Henningsson spec->gen.hp_jack_present = false; 359e4c3bce2SDavid Henningsson } else { 360e4c3bce2SDavid Henningsson snd_hda_codec_write_cache(codec, 0x1c, 0, 0x410, 0x54); /* disable merged mode for analog int-mic */ 361e4c3bce2SDavid Henningsson spec->gen.hp_jack_present = snd_hda_jack_detect(codec, spec->gen.autocfg.hp_pins[0]); 362e4c3bce2SDavid Henningsson } 363e4c3bce2SDavid Henningsson 364e4c3bce2SDavid Henningsson snd_hda_gen_update_outputs(codec); 365e4c3bce2SDavid Henningsson } 366e4c3bce2SDavid Henningsson 367e4c3bce2SDavid Henningsson static void cxt_update_headset_mode_hook(struct hda_codec *codec, 3687fe30711STakashi Iwai struct snd_kcontrol *kcontrol, 369e4c3bce2SDavid Henningsson struct snd_ctl_elem_value *ucontrol) 370e4c3bce2SDavid Henningsson { 371e4c3bce2SDavid Henningsson cxt_update_headset_mode(codec); 372e4c3bce2SDavid Henningsson } 373e4c3bce2SDavid Henningsson 374e4c3bce2SDavid Henningsson static void cxt_fixup_headphone_mic(struct hda_codec *codec, 375e4c3bce2SDavid Henningsson const struct hda_fixup *fix, int action) 376e4c3bce2SDavid Henningsson { 377e4c3bce2SDavid Henningsson struct conexant_spec *spec = codec->spec; 378e4c3bce2SDavid Henningsson 379e4c3bce2SDavid Henningsson switch (action) { 380e4c3bce2SDavid Henningsson case HDA_FIXUP_ACT_PRE_PROBE: 381e4c3bce2SDavid Henningsson spec->parse_flags |= HDA_PINCFG_HEADPHONE_MIC; 382a551d914STakashi Iwai snd_hdac_regmap_add_vendor_verb(&codec->core, 0x410); 383e4c3bce2SDavid Henningsson break; 384e4c3bce2SDavid Henningsson case HDA_FIXUP_ACT_PROBE: 3850bed2aa3STakashi Iwai WARN_ON(spec->gen.cap_sync_hook); 386e4c3bce2SDavid Henningsson spec->gen.cap_sync_hook = cxt_update_headset_mode_hook; 387e4c3bce2SDavid Henningsson spec->gen.automute_hook = cxt_update_headset_mode; 388e4c3bce2SDavid Henningsson break; 389e4c3bce2SDavid Henningsson case HDA_FIXUP_ACT_INIT: 390e4c3bce2SDavid Henningsson cxt_update_headset_mode(codec); 391e4c3bce2SDavid Henningsson break; 392e4c3bce2SDavid Henningsson } 393e4c3bce2SDavid Henningsson } 394e4c3bce2SDavid Henningsson 395322f74edSHui Wang static void cxt_fixup_headset_mic(struct hda_codec *codec, 396322f74edSHui Wang const struct hda_fixup *fix, int action) 397322f74edSHui Wang { 398322f74edSHui Wang struct conexant_spec *spec = codec->spec; 399322f74edSHui Wang 400322f74edSHui Wang switch (action) { 401322f74edSHui Wang case HDA_FIXUP_ACT_PRE_PROBE: 402322f74edSHui Wang spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; 403322f74edSHui Wang break; 404322f74edSHui Wang } 405322f74edSHui Wang } 406322f74edSHui Wang 4073a00c660STakashi Iwai /* OPLC XO 1.5 fixup */ 4083a00c660STakashi Iwai 4093a00c660STakashi Iwai /* OLPC XO-1.5 supports DC input mode (e.g. for use with analog sensors) 4103a00c660STakashi Iwai * through the microphone jack. 4113a00c660STakashi Iwai * When the user enables this through a mixer switch, both internal and 4123a00c660STakashi Iwai * external microphones are disabled. Gain is fixed at 0dB. In this mode, 4133a00c660STakashi Iwai * we also allow the bias to be configured through a separate mixer 4143a00c660STakashi Iwai * control. */ 4153a00c660STakashi Iwai 4163a00c660STakashi Iwai #define update_mic_pin(codec, nid, val) \ 417401caff7STakashi Iwai snd_hda_codec_write_cache(codec, nid, 0, \ 4183a00c660STakashi Iwai AC_VERB_SET_PIN_WIDGET_CONTROL, val) 4193a00c660STakashi Iwai 4203a00c660STakashi Iwai static const struct hda_input_mux olpc_xo_dc_bias = { 4213a00c660STakashi Iwai .num_items = 3, 4223a00c660STakashi Iwai .items = { 4233a00c660STakashi Iwai { "Off", PIN_IN }, 4243a00c660STakashi Iwai { "50%", PIN_VREF50 }, 4253a00c660STakashi Iwai { "80%", PIN_VREF80 }, 4263a00c660STakashi Iwai }, 4273a00c660STakashi Iwai }; 4283a00c660STakashi Iwai 4293a00c660STakashi Iwai static void olpc_xo_update_mic_boost(struct hda_codec *codec) 4303a00c660STakashi Iwai { 4313a00c660STakashi Iwai struct conexant_spec *spec = codec->spec; 4323a00c660STakashi Iwai int ch, val; 4333a00c660STakashi Iwai 4343a00c660STakashi Iwai for (ch = 0; ch < 2; ch++) { 4353a00c660STakashi Iwai val = AC_AMP_SET_OUTPUT | 4363a00c660STakashi Iwai (ch ? AC_AMP_SET_RIGHT : AC_AMP_SET_LEFT); 4373a00c660STakashi Iwai if (!spec->dc_enable) 4383a00c660STakashi Iwai val |= snd_hda_codec_amp_read(codec, 0x17, ch, HDA_OUTPUT, 0); 4393a00c660STakashi Iwai snd_hda_codec_write(codec, 0x17, 0, 4403a00c660STakashi Iwai AC_VERB_SET_AMP_GAIN_MUTE, val); 4413a00c660STakashi Iwai } 4423a00c660STakashi Iwai } 4433a00c660STakashi Iwai 4443a00c660STakashi Iwai static void olpc_xo_update_mic_pins(struct hda_codec *codec) 4453a00c660STakashi Iwai { 4463a00c660STakashi Iwai struct conexant_spec *spec = codec->spec; 4473a00c660STakashi Iwai int cur_input, val; 4483a00c660STakashi Iwai struct nid_path *path; 4493a00c660STakashi Iwai 4503a00c660STakashi Iwai cur_input = spec->gen.input_paths[0][spec->gen.cur_mux[0]]; 4513a00c660STakashi Iwai 4523a00c660STakashi Iwai /* Set up mic pins for port-B, C and F dynamically as the recording 4533a00c660STakashi Iwai * LED is turned on/off by these pin controls 4543a00c660STakashi Iwai */ 4553a00c660STakashi Iwai if (!spec->dc_enable) { 4563a00c660STakashi Iwai /* disable DC bias path and pin for port F */ 4573a00c660STakashi Iwai update_mic_pin(codec, 0x1e, 0); 4583a00c660STakashi Iwai snd_hda_activate_path(codec, spec->dc_mode_path, false, false); 4593a00c660STakashi Iwai 4603a00c660STakashi Iwai /* update port B (ext mic) and C (int mic) */ 4613a00c660STakashi Iwai /* OLPC defers mic widget control until when capture is 4623a00c660STakashi Iwai * started because the microphone LED comes on as soon as 4633a00c660STakashi Iwai * these settings are put in place. if we did this before 4643a00c660STakashi Iwai * recording, it would give the false indication that 4653a00c660STakashi Iwai * recording is happening when it is not. 4663a00c660STakashi Iwai */ 4673a00c660STakashi Iwai update_mic_pin(codec, 0x1a, spec->recording ? 4683a00c660STakashi Iwai snd_hda_codec_get_pin_target(codec, 0x1a) : 0); 4693a00c660STakashi Iwai update_mic_pin(codec, 0x1b, spec->recording ? 4703a00c660STakashi Iwai snd_hda_codec_get_pin_target(codec, 0x1b) : 0); 4713a00c660STakashi Iwai /* enable normal mic path */ 4723a00c660STakashi Iwai path = snd_hda_get_path_from_idx(codec, cur_input); 4733a00c660STakashi Iwai if (path) 4743a00c660STakashi Iwai snd_hda_activate_path(codec, path, true, false); 4753a00c660STakashi Iwai } else { 4763a00c660STakashi Iwai /* disable normal mic path */ 4773a00c660STakashi Iwai path = snd_hda_get_path_from_idx(codec, cur_input); 4783a00c660STakashi Iwai if (path) 4793a00c660STakashi Iwai snd_hda_activate_path(codec, path, false, false); 4803a00c660STakashi Iwai 4813a00c660STakashi Iwai /* Even though port F is the DC input, the bias is controlled 4823a00c660STakashi Iwai * on port B. We also leave that port as an active input (but 4833a00c660STakashi Iwai * unselected) in DC mode just in case that is necessary to 4843a00c660STakashi Iwai * make the bias setting take effect. 4853a00c660STakashi Iwai */ 4863a00c660STakashi Iwai if (spec->recording) 4873a00c660STakashi Iwai val = olpc_xo_dc_bias.items[spec->dc_input_bias].index; 4883a00c660STakashi Iwai else 4893a00c660STakashi Iwai val = 0; 4903a00c660STakashi Iwai update_mic_pin(codec, 0x1a, val); 4913a00c660STakashi Iwai update_mic_pin(codec, 0x1b, 0); 4923a00c660STakashi Iwai /* enable DC bias path and pin */ 4933a00c660STakashi Iwai update_mic_pin(codec, 0x1e, spec->recording ? PIN_IN : 0); 4943a00c660STakashi Iwai snd_hda_activate_path(codec, spec->dc_mode_path, true, false); 4953a00c660STakashi Iwai } 4963a00c660STakashi Iwai } 4973a00c660STakashi Iwai 4983a00c660STakashi Iwai /* mic_autoswitch hook */ 4991a4f69d5STakashi Iwai static void olpc_xo_automic(struct hda_codec *codec, 5001a4f69d5STakashi Iwai struct hda_jack_callback *jack) 5013a00c660STakashi Iwai { 5023a00c660STakashi Iwai struct conexant_spec *spec = codec->spec; 5033a00c660STakashi Iwai 5043a00c660STakashi Iwai /* in DC mode, we don't handle automic */ 5053a00c660STakashi Iwai if (!spec->dc_enable) 5063a00c660STakashi Iwai snd_hda_gen_mic_autoswitch(codec, jack); 5073a00c660STakashi Iwai olpc_xo_update_mic_pins(codec); 5083a00c660STakashi Iwai if (spec->dc_enable) 5093a00c660STakashi Iwai olpc_xo_update_mic_boost(codec); 5103a00c660STakashi Iwai } 5113a00c660STakashi Iwai 5123a00c660STakashi Iwai /* pcm_capture hook */ 5133a00c660STakashi Iwai static void olpc_xo_capture_hook(struct hda_pcm_stream *hinfo, 5143a00c660STakashi Iwai struct hda_codec *codec, 5153a00c660STakashi Iwai struct snd_pcm_substream *substream, 5163a00c660STakashi Iwai int action) 5173a00c660STakashi Iwai { 5183a00c660STakashi Iwai struct conexant_spec *spec = codec->spec; 5193a00c660STakashi Iwai 5203a00c660STakashi Iwai /* toggle spec->recording flag and update mic pins accordingly 5213a00c660STakashi Iwai * for turning on/off LED 5223a00c660STakashi Iwai */ 5233a00c660STakashi Iwai switch (action) { 5243a00c660STakashi Iwai case HDA_GEN_PCM_ACT_PREPARE: 5253a00c660STakashi Iwai spec->recording = 1; 5263a00c660STakashi Iwai olpc_xo_update_mic_pins(codec); 5273a00c660STakashi Iwai break; 5283a00c660STakashi Iwai case HDA_GEN_PCM_ACT_CLEANUP: 5293a00c660STakashi Iwai spec->recording = 0; 5303a00c660STakashi Iwai olpc_xo_update_mic_pins(codec); 5313a00c660STakashi Iwai break; 5323a00c660STakashi Iwai } 5333a00c660STakashi Iwai } 5343a00c660STakashi Iwai 5353a00c660STakashi Iwai static int olpc_xo_dc_mode_get(struct snd_kcontrol *kcontrol, 5363a00c660STakashi Iwai struct snd_ctl_elem_value *ucontrol) 5373a00c660STakashi Iwai { 5383a00c660STakashi Iwai struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 5393a00c660STakashi Iwai struct conexant_spec *spec = codec->spec; 5403a00c660STakashi Iwai ucontrol->value.integer.value[0] = spec->dc_enable; 5413a00c660STakashi Iwai return 0; 5423a00c660STakashi Iwai } 5433a00c660STakashi Iwai 5443a00c660STakashi Iwai static int olpc_xo_dc_mode_put(struct snd_kcontrol *kcontrol, 5453a00c660STakashi Iwai struct snd_ctl_elem_value *ucontrol) 5463a00c660STakashi Iwai { 5473a00c660STakashi Iwai struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 5483a00c660STakashi Iwai struct conexant_spec *spec = codec->spec; 5493a00c660STakashi Iwai int dc_enable = !!ucontrol->value.integer.value[0]; 5503a00c660STakashi Iwai 5513a00c660STakashi Iwai if (dc_enable == spec->dc_enable) 5523a00c660STakashi Iwai return 0; 5533a00c660STakashi Iwai 5543a00c660STakashi Iwai spec->dc_enable = dc_enable; 5553a00c660STakashi Iwai olpc_xo_update_mic_pins(codec); 5563a00c660STakashi Iwai olpc_xo_update_mic_boost(codec); 5573a00c660STakashi Iwai return 1; 5583a00c660STakashi Iwai } 5593a00c660STakashi Iwai 5603a00c660STakashi Iwai static int olpc_xo_dc_bias_enum_get(struct snd_kcontrol *kcontrol, 5613a00c660STakashi Iwai struct snd_ctl_elem_value *ucontrol) 5623a00c660STakashi Iwai { 5633a00c660STakashi Iwai struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 5643a00c660STakashi Iwai struct conexant_spec *spec = codec->spec; 5653a00c660STakashi Iwai ucontrol->value.enumerated.item[0] = spec->dc_input_bias; 5663a00c660STakashi Iwai return 0; 5673a00c660STakashi Iwai } 5683a00c660STakashi Iwai 5693a00c660STakashi Iwai static int olpc_xo_dc_bias_enum_info(struct snd_kcontrol *kcontrol, 5703a00c660STakashi Iwai struct snd_ctl_elem_info *uinfo) 5713a00c660STakashi Iwai { 5723a00c660STakashi Iwai return snd_hda_input_mux_info(&olpc_xo_dc_bias, uinfo); 5733a00c660STakashi Iwai } 5743a00c660STakashi Iwai 5753a00c660STakashi Iwai static int olpc_xo_dc_bias_enum_put(struct snd_kcontrol *kcontrol, 5763a00c660STakashi Iwai struct snd_ctl_elem_value *ucontrol) 5773a00c660STakashi Iwai { 5783a00c660STakashi Iwai struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 5793a00c660STakashi Iwai struct conexant_spec *spec = codec->spec; 5803a00c660STakashi Iwai const struct hda_input_mux *imux = &olpc_xo_dc_bias; 5813a00c660STakashi Iwai unsigned int idx; 5823a00c660STakashi Iwai 5833a00c660STakashi Iwai idx = ucontrol->value.enumerated.item[0]; 5843a00c660STakashi Iwai if (idx >= imux->num_items) 5853a00c660STakashi Iwai idx = imux->num_items - 1; 5863a00c660STakashi Iwai if (spec->dc_input_bias == idx) 5873a00c660STakashi Iwai return 0; 5883a00c660STakashi Iwai 5893a00c660STakashi Iwai spec->dc_input_bias = idx; 5903a00c660STakashi Iwai if (spec->dc_enable) 5913a00c660STakashi Iwai olpc_xo_update_mic_pins(codec); 5923a00c660STakashi Iwai return 1; 5933a00c660STakashi Iwai } 5943a00c660STakashi Iwai 5953a00c660STakashi Iwai static const struct snd_kcontrol_new olpc_xo_mixers[] = { 5963a00c660STakashi Iwai { 5973a00c660STakashi Iwai .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 5983a00c660STakashi Iwai .name = "DC Mode Enable Switch", 5993a00c660STakashi Iwai .info = snd_ctl_boolean_mono_info, 6003a00c660STakashi Iwai .get = olpc_xo_dc_mode_get, 6013a00c660STakashi Iwai .put = olpc_xo_dc_mode_put, 6023a00c660STakashi Iwai }, 6033a00c660STakashi Iwai { 6043a00c660STakashi Iwai .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 6053a00c660STakashi Iwai .name = "DC Input Bias Enum", 6063a00c660STakashi Iwai .info = olpc_xo_dc_bias_enum_info, 6073a00c660STakashi Iwai .get = olpc_xo_dc_bias_enum_get, 6083a00c660STakashi Iwai .put = olpc_xo_dc_bias_enum_put, 6093a00c660STakashi Iwai }, 6103a00c660STakashi Iwai {} 6113a00c660STakashi Iwai }; 6123a00c660STakashi Iwai 6133a00c660STakashi Iwai /* overriding mic boost put callback; update mic boost volume only when 6143a00c660STakashi Iwai * DC mode is disabled 6153a00c660STakashi Iwai */ 6163a00c660STakashi Iwai static int olpc_xo_mic_boost_put(struct snd_kcontrol *kcontrol, 6173a00c660STakashi Iwai struct snd_ctl_elem_value *ucontrol) 6183a00c660STakashi Iwai { 6193a00c660STakashi Iwai struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 6203a00c660STakashi Iwai struct conexant_spec *spec = codec->spec; 6213a00c660STakashi Iwai int ret = snd_hda_mixer_amp_volume_put(kcontrol, ucontrol); 6223a00c660STakashi Iwai if (ret > 0 && spec->dc_enable) 6233a00c660STakashi Iwai olpc_xo_update_mic_boost(codec); 6243a00c660STakashi Iwai return ret; 6253a00c660STakashi Iwai } 6263a00c660STakashi Iwai 6273a00c660STakashi Iwai static void cxt_fixup_olpc_xo(struct hda_codec *codec, 6283a00c660STakashi Iwai const struct hda_fixup *fix, int action) 6293a00c660STakashi Iwai { 6303a00c660STakashi Iwai struct conexant_spec *spec = codec->spec; 631a9c2dfc8STakashi Iwai struct snd_kcontrol_new *kctl; 6323a00c660STakashi Iwai int i; 6333a00c660STakashi Iwai 6343a00c660STakashi Iwai if (action != HDA_FIXUP_ACT_PROBE) 6353a00c660STakashi Iwai return; 6363a00c660STakashi Iwai 6373a00c660STakashi Iwai spec->gen.mic_autoswitch_hook = olpc_xo_automic; 6383a00c660STakashi Iwai spec->gen.pcm_capture_hook = olpc_xo_capture_hook; 6393a00c660STakashi Iwai spec->dc_mode_path = snd_hda_add_new_path(codec, 0x1e, 0x14, 0); 6403a00c660STakashi Iwai 6413a00c660STakashi Iwai snd_hda_add_new_ctls(codec, olpc_xo_mixers); 6423a00c660STakashi Iwai 6433a00c660STakashi Iwai /* OLPC's microphone port is DC coupled for use with external sensors, 6443a00c660STakashi Iwai * therefore we use a 50% mic bias in order to center the input signal 6453a00c660STakashi Iwai * with the DC input range of the codec. 6463a00c660STakashi Iwai */ 6473a00c660STakashi Iwai snd_hda_codec_set_pin_target(codec, 0x1a, PIN_VREF50); 6483a00c660STakashi Iwai 6493a00c660STakashi Iwai /* override mic boost control */ 650a9c2dfc8STakashi Iwai snd_array_for_each(&spec->gen.kctls, i, kctl) { 6513a00c660STakashi Iwai if (!strcmp(kctl->name, "Mic Boost Volume")) { 6523a00c660STakashi Iwai kctl->put = olpc_xo_mic_boost_put; 6533a00c660STakashi Iwai break; 6543a00c660STakashi Iwai } 6553a00c660STakashi Iwai } 6563a00c660STakashi Iwai } 6573a00c660STakashi Iwai 6583542aed7STakashi Iwai static void cxt_fixup_mute_led_eapd(struct hda_codec *codec, 6593542aed7STakashi Iwai const struct hda_fixup *fix, int action) 6603542aed7STakashi Iwai { 6613542aed7STakashi Iwai struct conexant_spec *spec = codec->spec; 6623542aed7STakashi Iwai 6633542aed7STakashi Iwai if (action == HDA_FIXUP_ACT_PRE_PROBE) { 6643542aed7STakashi Iwai spec->mute_led_eapd = 0x1b; 665d15f7331SJiapeng Zhong spec->dynamic_eapd = true; 666929f718cSTakashi Iwai snd_hda_gen_add_mute_led_cdev(codec, cx_auto_vmaster_mute_led); 6673542aed7STakashi Iwai } 6683542aed7STakashi Iwai } 6693542aed7STakashi Iwai 670ad7725d3STakashi Iwai /* 671ad7725d3STakashi Iwai * Fix max input level on mixer widget to 0dB 672ad7725d3STakashi Iwai * (originally it has 0x2b steps with 0dB offset 0x14) 673ad7725d3STakashi Iwai */ 674ad7725d3STakashi Iwai static void cxt_fixup_cap_mix_amp(struct hda_codec *codec, 675ad7725d3STakashi Iwai const struct hda_fixup *fix, int action) 676ad7725d3STakashi Iwai { 677ad7725d3STakashi Iwai snd_hda_override_amp_caps(codec, 0x17, HDA_INPUT, 678ad7725d3STakashi Iwai (0x14 << AC_AMPCAP_OFFSET_SHIFT) | 679ad7725d3STakashi Iwai (0x14 << AC_AMPCAP_NUM_STEPS_SHIFT) | 680ad7725d3STakashi Iwai (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) | 681ad7725d3STakashi Iwai (1 << AC_AMPCAP_MUTE_SHIFT)); 682ad7725d3STakashi Iwai } 683e4c3bce2SDavid Henningsson 684ea30e7dfSTakashi Iwai /* 685ea30e7dfSTakashi Iwai * Fix max input level on mixer widget to 0dB 686ea30e7dfSTakashi Iwai * (originally it has 0x1e steps with 0 dB offset 0x17) 687ea30e7dfSTakashi Iwai */ 688ea30e7dfSTakashi Iwai static void cxt_fixup_cap_mix_amp_5047(struct hda_codec *codec, 689ea30e7dfSTakashi Iwai const struct hda_fixup *fix, int action) 690ea30e7dfSTakashi Iwai { 691ea30e7dfSTakashi Iwai snd_hda_override_amp_caps(codec, 0x10, HDA_INPUT, 692ea30e7dfSTakashi Iwai (0x17 << AC_AMPCAP_OFFSET_SHIFT) | 693ea30e7dfSTakashi Iwai (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) | 694ea30e7dfSTakashi Iwai (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) | 695ea30e7dfSTakashi Iwai (1 << AC_AMPCAP_MUTE_SHIFT)); 696ea30e7dfSTakashi Iwai } 697ea30e7dfSTakashi Iwai 698f73cd43aSTakashi Iwai static void cxt_fixup_hp_gate_mic_jack(struct hda_codec *codec, 699f73cd43aSTakashi Iwai const struct hda_fixup *fix, 700f73cd43aSTakashi Iwai int action) 701f73cd43aSTakashi Iwai { 702f73cd43aSTakashi Iwai /* the mic pin (0x19) doesn't give an unsolicited event; 703f73cd43aSTakashi Iwai * probe the mic pin together with the headphone pin (0x16) 704f73cd43aSTakashi Iwai */ 705f73cd43aSTakashi Iwai if (action == HDA_FIXUP_ACT_PROBE) 706f73cd43aSTakashi Iwai snd_hda_jack_set_gating_jack(codec, 0x19, 0x16); 707f73cd43aSTakashi Iwai } 708f73cd43aSTakashi Iwai 7095cd5b1bdSJerónimo Borque /* update LED status via GPIO */ 7105cd5b1bdSJerónimo Borque static void cxt_update_gpio_led(struct hda_codec *codec, unsigned int mask, 711f9ef724dSJeronimo Borque bool led_on) 7125cd5b1bdSJerónimo Borque { 7135cd5b1bdSJerónimo Borque struct conexant_spec *spec = codec->spec; 7145cd5b1bdSJerónimo Borque unsigned int oldval = spec->gpio_led; 7155cd5b1bdSJerónimo Borque 7165cd5b1bdSJerónimo Borque if (spec->mute_led_polarity) 717f9ef724dSJeronimo Borque led_on = !led_on; 7185cd5b1bdSJerónimo Borque 719f9ef724dSJeronimo Borque if (led_on) 7205cd5b1bdSJerónimo Borque spec->gpio_led |= mask; 721f9ef724dSJeronimo Borque else 722f9ef724dSJeronimo Borque spec->gpio_led &= ~mask; 723f9ef724dSJeronimo Borque codec_dbg(codec, "mask:%d enabled:%d gpio_led:%d\n", 724f9ef724dSJeronimo Borque mask, led_on, spec->gpio_led); 7255cd5b1bdSJerónimo Borque if (spec->gpio_led != oldval) 7265cd5b1bdSJerónimo Borque snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 7275cd5b1bdSJerónimo Borque spec->gpio_led); 7285cd5b1bdSJerónimo Borque } 7295cd5b1bdSJerónimo Borque 7305cd5b1bdSJerónimo Borque /* turn on/off mute LED via GPIO per vmaster hook */ 731929f718cSTakashi Iwai static int cxt_gpio_mute_update(struct led_classdev *led_cdev, 732929f718cSTakashi Iwai enum led_brightness brightness) 7335cd5b1bdSJerónimo Borque { 734929f718cSTakashi Iwai struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); 7355cd5b1bdSJerónimo Borque struct conexant_spec *spec = codec->spec; 736929f718cSTakashi Iwai 737929f718cSTakashi Iwai cxt_update_gpio_led(codec, spec->gpio_mute_led_mask, brightness); 738929f718cSTakashi Iwai return 0; 7395cd5b1bdSJerónimo Borque } 7405cd5b1bdSJerónimo Borque 7415cd5b1bdSJerónimo Borque /* turn on/off mic-mute LED via GPIO per capture hook */ 742e65a2cafSTakashi Iwai static int cxt_gpio_micmute_update(struct led_classdev *led_cdev, 743e65a2cafSTakashi Iwai enum led_brightness brightness) 7445cd5b1bdSJerónimo Borque { 745e65a2cafSTakashi Iwai struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); 7465cd5b1bdSJerónimo Borque struct conexant_spec *spec = codec->spec; 7475cd5b1bdSJerónimo Borque 748e65a2cafSTakashi Iwai cxt_update_gpio_led(codec, spec->gpio_mic_led_mask, brightness); 749e65a2cafSTakashi Iwai return 0; 7505cd5b1bdSJerónimo Borque } 7515cd5b1bdSJerónimo Borque 75256b26497STakashi Iwai static void cxt_setup_mute_led(struct hda_codec *codec, 75356b26497STakashi Iwai unsigned int mute, unsigned int mic_mute) 75456b26497STakashi Iwai { 75556b26497STakashi Iwai struct conexant_spec *spec = codec->spec; 75656b26497STakashi Iwai 75756b26497STakashi Iwai spec->gpio_led = 0; 75856b26497STakashi Iwai spec->mute_led_polarity = 0; 75956b26497STakashi Iwai if (mute) { 76056b26497STakashi Iwai snd_hda_gen_add_mute_led_cdev(codec, cxt_gpio_mute_update); 76156b26497STakashi Iwai spec->gpio_mute_led_mask = mute; 76256b26497STakashi Iwai } 76356b26497STakashi Iwai if (mic_mute) { 76456b26497STakashi Iwai snd_hda_gen_add_micmute_led_cdev(codec, cxt_gpio_micmute_update); 76556b26497STakashi Iwai spec->gpio_mic_led_mask = mic_mute; 76656b26497STakashi Iwai } 76756b26497STakashi Iwai } 7685cd5b1bdSJerónimo Borque 7695cd5b1bdSJerónimo Borque static void cxt_fixup_mute_led_gpio(struct hda_codec *codec, 7705cd5b1bdSJerónimo Borque const struct hda_fixup *fix, int action) 7715cd5b1bdSJerónimo Borque { 77256b26497STakashi Iwai if (action == HDA_FIXUP_ACT_PRE_PROBE) 77356b26497STakashi Iwai cxt_setup_mute_led(codec, 0x01, 0x02); 7745cd5b1bdSJerónimo Borque } 7755cd5b1bdSJerónimo Borque 77656b26497STakashi Iwai static void cxt_fixup_hp_zbook_mute_led(struct hda_codec *codec, 77756b26497STakashi Iwai const struct hda_fixup *fix, int action) 77856b26497STakashi Iwai { 77956b26497STakashi Iwai if (action == HDA_FIXUP_ACT_PRE_PROBE) 78056b26497STakashi Iwai cxt_setup_mute_led(codec, 0x10, 0x20); 78156b26497STakashi Iwai } 7825cd5b1bdSJerónimo Borque 783d70f3632STakashi Iwai /* ThinkPad X200 & co with cxt5051 */ 78423d30f28STakashi Iwai static const struct hda_pintbl cxt_pincfg_lenovo_x200[] = { 785e92d4b08STakashi Iwai { 0x16, 0x042140ff }, /* HP (seq# overridden) */ 786e92d4b08STakashi Iwai { 0x17, 0x21a11000 }, /* dock-mic */ 787e92d4b08STakashi Iwai { 0x19, 0x2121103f }, /* dock-HP */ 7883e93f5efSTakashi Iwai { 0x1c, 0x21440100 }, /* dock SPDIF out */ 789e92d4b08STakashi Iwai {} 790e92d4b08STakashi Iwai }; 791e92d4b08STakashi Iwai 792d70f3632STakashi Iwai /* ThinkPad 410/420/510/520, X201 & co with cxt5066 */ 79323d30f28STakashi Iwai static const struct hda_pintbl cxt_pincfg_lenovo_tp410[] = { 794d70f3632STakashi Iwai { 0x19, 0x042110ff }, /* HP (seq# overridden) */ 795d70f3632STakashi Iwai { 0x1a, 0x21a190f0 }, /* dock-mic */ 796d70f3632STakashi Iwai { 0x1c, 0x212140ff }, /* dock-HP */ 797d70f3632STakashi Iwai {} 798e92d4b08STakashi Iwai }; 799e92d4b08STakashi Iwai 800239fb862SHuacai Chen /* Lemote A1004/A1205 with cxt5066 */ 801239fb862SHuacai Chen static const struct hda_pintbl cxt_pincfg_lemote[] = { 802239fb862SHuacai Chen { 0x1a, 0x90a10020 }, /* Internal mic */ 803239fb862SHuacai Chen { 0x1b, 0x03a11020 }, /* External mic */ 804239fb862SHuacai Chen { 0x1d, 0x400101f0 }, /* Not used */ 805239fb862SHuacai Chen { 0x1e, 0x40a701f0 }, /* Not used */ 806239fb862SHuacai Chen { 0x20, 0x404501f0 }, /* Not used */ 807239fb862SHuacai Chen { 0x22, 0x404401f0 }, /* Not used */ 808239fb862SHuacai Chen { 0x23, 0x40a701f0 }, /* Not used */ 809239fb862SHuacai Chen {} 810239fb862SHuacai Chen }; 811239fb862SHuacai Chen 81253447b46Sbo liu /* SuoWoSi/South-holding JS201D with sn6140 */ 81353447b46Sbo liu static const struct hda_pintbl cxt_pincfg_sws_js201d[] = { 81453447b46Sbo liu { 0x16, 0x03211040 }, /* hp out */ 81553447b46Sbo liu { 0x17, 0x91170110 }, /* SPK/Class_D */ 81653447b46Sbo liu { 0x18, 0x95a70130 }, /* Internal mic */ 81753447b46Sbo liu { 0x19, 0x03a11020 }, /* Headset Mic */ 81853447b46Sbo liu { 0x1a, 0x40f001f0 }, /* Not used */ 81953447b46Sbo liu { 0x21, 0x40f001f0 }, /* Not used */ 82053447b46Sbo liu {} 82153447b46Sbo liu }; 82253447b46Sbo liu 82323d30f28STakashi Iwai static const struct hda_fixup cxt_fixups[] = { 82423d30f28STakashi Iwai [CXT_PINCFG_LENOVO_X200] = { 82523d30f28STakashi Iwai .type = HDA_FIXUP_PINS, 82623d30f28STakashi Iwai .v.pins = cxt_pincfg_lenovo_x200, 82723d30f28STakashi Iwai }, 82823d30f28STakashi Iwai [CXT_PINCFG_LENOVO_TP410] = { 82923d30f28STakashi Iwai .type = HDA_FIXUP_PINS, 83023d30f28STakashi Iwai .v.pins = cxt_pincfg_lenovo_tp410, 83108cf680cSDavid Henningsson .chained = true, 83208cf680cSDavid Henningsson .chain_id = CXT_FIXUP_THINKPAD_ACPI, 83323d30f28STakashi Iwai }, 834239fb862SHuacai Chen [CXT_PINCFG_LEMOTE_A1004] = { 835239fb862SHuacai Chen .type = HDA_FIXUP_PINS, 836239fb862SHuacai Chen .chained = true, 837239fb862SHuacai Chen .chain_id = CXT_FIXUP_INC_MIC_BOOST, 838239fb862SHuacai Chen .v.pins = cxt_pincfg_lemote, 839239fb862SHuacai Chen }, 840239fb862SHuacai Chen [CXT_PINCFG_LEMOTE_A1205] = { 841239fb862SHuacai Chen .type = HDA_FIXUP_PINS, 842239fb862SHuacai Chen .v.pins = cxt_pincfg_lemote, 843239fb862SHuacai Chen }, 844ddb6ca75STakashi Iwai [CXT_PINCFG_COMPAQ_CQ60] = { 845ddb6ca75STakashi Iwai .type = HDA_FIXUP_PINS, 846ddb6ca75STakashi Iwai .v.pins = (const struct hda_pintbl[]) { 847ddb6ca75STakashi Iwai /* 0x17 was falsely set up as a mic, it should 0x1d */ 848ddb6ca75STakashi Iwai { 0x17, 0x400001f0 }, 849ddb6ca75STakashi Iwai { 0x1d, 0x97a70120 }, 850ddb6ca75STakashi Iwai { } 851ddb6ca75STakashi Iwai } 852ddb6ca75STakashi Iwai }, 85323d30f28STakashi Iwai [CXT_FIXUP_STEREO_DMIC] = { 85423d30f28STakashi Iwai .type = HDA_FIXUP_FUNC, 85523d30f28STakashi Iwai .v.func = cxt_fixup_stereo_dmic, 85623d30f28STakashi Iwai }, 857f83bb259SMeng Tang [CXT_PINCFG_LENOVO_NOTEBOOK] = { 858f83bb259SMeng Tang .type = HDA_FIXUP_PINS, 859f83bb259SMeng Tang .v.pins = (const struct hda_pintbl[]) { 860f83bb259SMeng Tang { 0x1a, 0x05d71030 }, 861f83bb259SMeng Tang { } 862f83bb259SMeng Tang }, 863f83bb259SMeng Tang .chain_id = CXT_FIXUP_STEREO_DMIC, 864f83bb259SMeng Tang }, 865239fb862SHuacai Chen [CXT_FIXUP_INC_MIC_BOOST] = { 866239fb862SHuacai Chen .type = HDA_FIXUP_FUNC, 867239fb862SHuacai Chen .v.func = cxt5066_increase_mic_boost, 868239fb862SHuacai Chen }, 869e4c3bce2SDavid Henningsson [CXT_FIXUP_HEADPHONE_MIC_PIN] = { 870e4c3bce2SDavid Henningsson .type = HDA_FIXUP_PINS, 871e4c3bce2SDavid Henningsson .chained = true, 872e4c3bce2SDavid Henningsson .chain_id = CXT_FIXUP_HEADPHONE_MIC, 873e4c3bce2SDavid Henningsson .v.pins = (const struct hda_pintbl[]) { 874e4c3bce2SDavid Henningsson { 0x18, 0x03a1913d }, /* use as headphone mic, without its own jack detect */ 875e4c3bce2SDavid Henningsson { } 876e4c3bce2SDavid Henningsson } 877e4c3bce2SDavid Henningsson }, 878e4c3bce2SDavid Henningsson [CXT_FIXUP_HEADPHONE_MIC] = { 879e4c3bce2SDavid Henningsson .type = HDA_FIXUP_FUNC, 880e4c3bce2SDavid Henningsson .v.func = cxt_fixup_headphone_mic, 881e4c3bce2SDavid Henningsson }, 8824a437044STakashi Iwai [CXT_FIXUP_GPIO1] = { 8834a437044STakashi Iwai .type = HDA_FIXUP_VERBS, 8844a437044STakashi Iwai .v.verbs = (const struct hda_verb[]) { 8854a437044STakashi Iwai { 0x01, AC_VERB_SET_GPIO_MASK, 0x01 }, 8864a437044STakashi Iwai { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01 }, 8874a437044STakashi Iwai { 0x01, AC_VERB_SET_GPIO_DATA, 0x01 }, 8884a437044STakashi Iwai { } 8894a437044STakashi Iwai }, 8904a437044STakashi Iwai }, 891ff50479aSTakashi Iwai [CXT_FIXUP_ASPIRE_DMIC] = { 892ff50479aSTakashi Iwai .type = HDA_FIXUP_FUNC, 893ff50479aSTakashi Iwai .v.func = cxt_fixup_stereo_dmic, 894ff50479aSTakashi Iwai .chained = true, 895ff50479aSTakashi Iwai .chain_id = CXT_FIXUP_GPIO1, 896ff50479aSTakashi Iwai }, 89708cf680cSDavid Henningsson [CXT_FIXUP_THINKPAD_ACPI] = { 89808cf680cSDavid Henningsson .type = HDA_FIXUP_FUNC, 899b317b032STakashi Iwai .v.func = hda_fixup_thinkpad_acpi, 90008cf680cSDavid Henningsson }, 9013a00c660STakashi Iwai [CXT_FIXUP_OLPC_XO] = { 9023a00c660STakashi Iwai .type = HDA_FIXUP_FUNC, 9033a00c660STakashi Iwai .v.func = cxt_fixup_olpc_xo, 9043a00c660STakashi Iwai }, 905ad7725d3STakashi Iwai [CXT_FIXUP_CAP_MIX_AMP] = { 906ad7725d3STakashi Iwai .type = HDA_FIXUP_FUNC, 907ad7725d3STakashi Iwai .v.func = cxt_fixup_cap_mix_amp, 908ad7725d3STakashi Iwai }, 9096dcbadefSTakashi Iwai [CXT_FIXUP_TOSHIBA_P105] = { 9106dcbadefSTakashi Iwai .type = HDA_FIXUP_PINS, 9116dcbadefSTakashi Iwai .v.pins = (const struct hda_pintbl[]) { 9126dcbadefSTakashi Iwai { 0x10, 0x961701f0 }, /* speaker/hp */ 9136dcbadefSTakashi Iwai { 0x12, 0x02a1901e }, /* ext mic */ 9146dcbadefSTakashi Iwai { 0x14, 0x95a70110 }, /* int mic */ 9156dcbadefSTakashi Iwai {} 9166dcbadefSTakashi Iwai }, 9176dcbadefSTakashi Iwai }, 918e5eac90dSTakashi Iwai [CXT_FIXUP_HP_530] = { 919e5eac90dSTakashi Iwai .type = HDA_FIXUP_PINS, 920e5eac90dSTakashi Iwai .v.pins = (const struct hda_pintbl[]) { 921e5eac90dSTakashi Iwai { 0x12, 0x90a60160 }, /* int mic */ 922e5eac90dSTakashi Iwai {} 923e5eac90dSTakashi Iwai }, 924e5eac90dSTakashi Iwai .chained = true, 925e5eac90dSTakashi Iwai .chain_id = CXT_FIXUP_CAP_MIX_AMP, 926e5eac90dSTakashi Iwai }, 927ea30e7dfSTakashi Iwai [CXT_FIXUP_CAP_MIX_AMP_5047] = { 928ea30e7dfSTakashi Iwai .type = HDA_FIXUP_FUNC, 929ea30e7dfSTakashi Iwai .v.func = cxt_fixup_cap_mix_amp_5047, 930ea30e7dfSTakashi Iwai }, 9313542aed7STakashi Iwai [CXT_FIXUP_MUTE_LED_EAPD] = { 9323542aed7STakashi Iwai .type = HDA_FIXUP_FUNC, 9333542aed7STakashi Iwai .v.func = cxt_fixup_mute_led_eapd, 9343542aed7STakashi Iwai }, 935cc3a47a2SJaroslav Kysela [CXT_FIXUP_HP_DOCK] = { 936cc3a47a2SJaroslav Kysela .type = HDA_FIXUP_PINS, 937cc3a47a2SJaroslav Kysela .v.pins = (const struct hda_pintbl[]) { 938cc3a47a2SJaroslav Kysela { 0x16, 0x21011020 }, /* line-out */ 939cc3a47a2SJaroslav Kysela { 0x18, 0x2181103f }, /* line-in */ 940cc3a47a2SJaroslav Kysela { } 941c3123d6aSFlorin Tudorache }, 942c3123d6aSFlorin Tudorache .chained = true, 943c3123d6aSFlorin Tudorache .chain_id = CXT_FIXUP_MUTE_LED_GPIO, 944cc3a47a2SJaroslav Kysela }, 9450eec8809STakashi Iwai [CXT_FIXUP_HP_SPECTRE] = { 9460eec8809STakashi Iwai .type = HDA_FIXUP_PINS, 9470eec8809STakashi Iwai .v.pins = (const struct hda_pintbl[]) { 9480eec8809STakashi Iwai /* enable NID 0x1d for the speaker on top */ 9490eec8809STakashi Iwai { 0x1d, 0x91170111 }, 9500eec8809STakashi Iwai { } 9510eec8809STakashi Iwai } 9520eec8809STakashi Iwai }, 953f73cd43aSTakashi Iwai [CXT_FIXUP_HP_GATE_MIC] = { 954f73cd43aSTakashi Iwai .type = HDA_FIXUP_FUNC, 955f73cd43aSTakashi Iwai .v.func = cxt_fixup_hp_gate_mic_jack, 956f73cd43aSTakashi Iwai }, 9575cd5b1bdSJerónimo Borque [CXT_FIXUP_MUTE_LED_GPIO] = { 9585cd5b1bdSJerónimo Borque .type = HDA_FIXUP_FUNC, 9595cd5b1bdSJerónimo Borque .v.func = cxt_fixup_mute_led_gpio, 9605cd5b1bdSJerónimo Borque }, 96156b26497STakashi Iwai [CXT_FIXUP_HP_ZBOOK_MUTE_LED] = { 96256b26497STakashi Iwai .type = HDA_FIXUP_FUNC, 96356b26497STakashi Iwai .v.func = cxt_fixup_hp_zbook_mute_led, 96456b26497STakashi Iwai }, 965322f74edSHui Wang [CXT_FIXUP_HEADSET_MIC] = { 966322f74edSHui Wang .type = HDA_FIXUP_FUNC, 967322f74edSHui Wang .v.func = cxt_fixup_headset_mic, 968322f74edSHui Wang }, 969322f74edSHui Wang [CXT_FIXUP_HP_MIC_NO_PRESENCE] = { 970322f74edSHui Wang .type = HDA_FIXUP_PINS, 971322f74edSHui Wang .v.pins = (const struct hda_pintbl[]) { 972322f74edSHui Wang { 0x1a, 0x02a1113c }, 973322f74edSHui Wang { } 974322f74edSHui Wang }, 975322f74edSHui Wang .chained = true, 976322f74edSHui Wang .chain_id = CXT_FIXUP_HEADSET_MIC, 977322f74edSHui Wang }, 97853447b46Sbo liu [CXT_PINCFG_SWS_JS201D] = { 97953447b46Sbo liu .type = HDA_FIXUP_PINS, 98053447b46Sbo liu .v.pins = cxt_pincfg_sws_js201d, 98153447b46Sbo liu }, 982*638e61b0SChristoffer Sandberg [CXT_PINCFG_TOP_SPEAKER] = { 983*638e61b0SChristoffer Sandberg .type = HDA_FIXUP_PINS, 984*638e61b0SChristoffer Sandberg .v.pins = (const struct hda_pintbl[]) { 985*638e61b0SChristoffer Sandberg { 0x1d, 0x82170111 }, 986*638e61b0SChristoffer Sandberg { } 987*638e61b0SChristoffer Sandberg }, 988*638e61b0SChristoffer Sandberg }, 989ad7725d3STakashi Iwai }; 990ad7725d3STakashi Iwai 991ad7725d3STakashi Iwai static const struct snd_pci_quirk cxt5045_fixups[] = { 992e5eac90dSTakashi Iwai SND_PCI_QUIRK(0x103c, 0x30d5, "HP 530", CXT_FIXUP_HP_530), 9936dcbadefSTakashi Iwai SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba P105", CXT_FIXUP_TOSHIBA_P105), 994ad7725d3STakashi Iwai /* HP, Packard Bell, Fujitsu-Siemens & Lenovo laptops have 995ad7725d3STakashi Iwai * really bad sound over 0dB on NID 0x17. 996ad7725d3STakashi Iwai */ 997ad7725d3STakashi Iwai SND_PCI_QUIRK_VENDOR(0x103c, "HP", CXT_FIXUP_CAP_MIX_AMP), 998ad7725d3STakashi Iwai SND_PCI_QUIRK_VENDOR(0x1631, "Packard Bell", CXT_FIXUP_CAP_MIX_AMP), 999ad7725d3STakashi Iwai SND_PCI_QUIRK_VENDOR(0x1734, "Fujitsu", CXT_FIXUP_CAP_MIX_AMP), 1000ad7725d3STakashi Iwai SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", CXT_FIXUP_CAP_MIX_AMP), 1001ad7725d3STakashi Iwai {} 1002ad7725d3STakashi Iwai }; 1003ad7725d3STakashi Iwai 1004ad7725d3STakashi Iwai static const struct hda_model_fixup cxt5045_fixup_models[] = { 1005ad7725d3STakashi Iwai { .id = CXT_FIXUP_CAP_MIX_AMP, .name = "cap-mix-amp" }, 10066dcbadefSTakashi Iwai { .id = CXT_FIXUP_TOSHIBA_P105, .name = "toshiba-p105" }, 1007e5eac90dSTakashi Iwai { .id = CXT_FIXUP_HP_530, .name = "hp-530" }, 1008ad7725d3STakashi Iwai {} 1009e92d4b08STakashi Iwai }; 1010e92d4b08STakashi Iwai 1011ea30e7dfSTakashi Iwai static const struct snd_pci_quirk cxt5047_fixups[] = { 1012ea30e7dfSTakashi Iwai /* HP laptops have really bad sound over 0 dB on NID 0x10. 1013ea30e7dfSTakashi Iwai */ 1014ea30e7dfSTakashi Iwai SND_PCI_QUIRK_VENDOR(0x103c, "HP", CXT_FIXUP_CAP_MIX_AMP_5047), 1015ea30e7dfSTakashi Iwai {} 1016ea30e7dfSTakashi Iwai }; 1017ea30e7dfSTakashi Iwai 1018ea30e7dfSTakashi Iwai static const struct hda_model_fixup cxt5047_fixup_models[] = { 1019ea30e7dfSTakashi Iwai { .id = CXT_FIXUP_CAP_MIX_AMP_5047, .name = "cap-mix-amp" }, 1020ea30e7dfSTakashi Iwai {} 1021ea30e7dfSTakashi Iwai }; 1022ea30e7dfSTakashi Iwai 1023d70f3632STakashi Iwai static const struct snd_pci_quirk cxt5051_fixups[] = { 1024ddb6ca75STakashi Iwai SND_PCI_QUIRK(0x103c, 0x360b, "Compaq CQ60", CXT_PINCFG_COMPAQ_CQ60), 1025e92d4b08STakashi Iwai SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo X200", CXT_PINCFG_LENOVO_X200), 1026e92d4b08STakashi Iwai {} 1027e92d4b08STakashi Iwai }; 1028e92d4b08STakashi Iwai 1029a2dd933dSTakashi Iwai static const struct hda_model_fixup cxt5051_fixup_models[] = { 1030a2dd933dSTakashi Iwai { .id = CXT_PINCFG_LENOVO_X200, .name = "lenovo-x200" }, 1031a2dd933dSTakashi Iwai {} 1032a2dd933dSTakashi Iwai }; 1033a2dd933dSTakashi Iwai 1034d70f3632STakashi Iwai static const struct snd_pci_quirk cxt5066_fixups[] = { 103563a077e2STakashi Iwai SND_PCI_QUIRK(0x1025, 0x0543, "Acer Aspire One 522", CXT_FIXUP_STEREO_DMIC), 1036ff50479aSTakashi Iwai SND_PCI_QUIRK(0x1025, 0x054c, "Acer Aspire 3830TG", CXT_FIXUP_ASPIRE_DMIC), 1037522a7fa8SDavid Henningsson SND_PCI_QUIRK(0x1025, 0x054f, "Acer Aspire 4830T", CXT_FIXUP_ASPIRE_DMIC), 1038cc3a47a2SJaroslav Kysela SND_PCI_QUIRK(0x103c, 0x8079, "HP EliteBook 840 G3", CXT_FIXUP_HP_DOCK), 1039aea80817SDennis Wassenberg SND_PCI_QUIRK(0x103c, 0x807C, "HP EliteBook 820 G3", CXT_FIXUP_HP_DOCK), 1040099fd6caSDennis Wassenberg SND_PCI_QUIRK(0x103c, 0x80FD, "HP ProBook 640 G2", CXT_FIXUP_HP_DOCK), 10412e6a7312STakashi Iwai SND_PCI_QUIRK(0x103c, 0x8115, "HP Z1 Gen3", CXT_FIXUP_HP_GATE_MIC), 10422e6a7312STakashi Iwai SND_PCI_QUIRK(0x103c, 0x814f, "HP ZBook 15u G3", CXT_FIXUP_MUTE_LED_GPIO), 10432e6a7312STakashi Iwai SND_PCI_QUIRK(0x103c, 0x8174, "HP Spectre x360", CXT_FIXUP_HP_SPECTRE), 10442e6a7312STakashi Iwai SND_PCI_QUIRK(0x103c, 0x822e, "HP ProBook 440 G4", CXT_FIXUP_MUTE_LED_GPIO), 104540906ebeSMantas Mikulėnas SND_PCI_QUIRK(0x103c, 0x828c, "HP EliteBook 840 G4", CXT_FIXUP_HP_DOCK), 10462e6a7312STakashi Iwai SND_PCI_QUIRK(0x103c, 0x8299, "HP 800 G3 SFF", CXT_FIXUP_HP_MIC_NO_PRESENCE), 10472e6a7312STakashi Iwai SND_PCI_QUIRK(0x103c, 0x829a, "HP 800 G3 DM", CXT_FIXUP_HP_MIC_NO_PRESENCE), 1048d16d69bfSMeng Tang SND_PCI_QUIRK(0x103c, 0x82b4, "HP ProDesk 600 G3", CXT_FIXUP_HP_MIC_NO_PRESENCE), 10492e6a7312STakashi Iwai SND_PCI_QUIRK(0x103c, 0x836e, "HP ProBook 455 G5", CXT_FIXUP_MUTE_LED_GPIO), 10502e6a7312STakashi Iwai SND_PCI_QUIRK(0x103c, 0x837f, "HP ProBook 470 G5", CXT_FIXUP_MUTE_LED_GPIO), 10514cd3016cSJurica Vukadin SND_PCI_QUIRK(0x103c, 0x83b2, "HP EliteBook 840 G5", CXT_FIXUP_HP_DOCK), 10522861751fSDennis Wassenberg SND_PCI_QUIRK(0x103c, 0x83b3, "HP EliteBook 830 G5", CXT_FIXUP_HP_DOCK), 10537eef32c1SDennis Wassenberg SND_PCI_QUIRK(0x103c, 0x83d3, "HP ProBook 640 G4", CXT_FIXUP_HP_DOCK), 1054e190de69SKai-Heng Feng SND_PCI_QUIRK(0x103c, 0x8402, "HP ProBook 645 G4", CXT_FIXUP_MUTE_LED_GPIO), 105556b26497STakashi Iwai SND_PCI_QUIRK(0x103c, 0x8427, "HP ZBook Studio G5", CXT_FIXUP_HP_ZBOOK_MUTE_LED), 1056c6423ed2STakashi Iwai SND_PCI_QUIRK(0x103c, 0x844f, "HP ZBook Studio G5", CXT_FIXUP_HP_ZBOOK_MUTE_LED), 1057f16041dfSTakashi Iwai SND_PCI_QUIRK(0x103c, 0x8455, "HP Z2 G4", CXT_FIXUP_HP_MIC_NO_PRESENCE), 1058167897f4SJaroslav Kysela SND_PCI_QUIRK(0x103c, 0x8456, "HP Z2 G4 SFF", CXT_FIXUP_HP_MIC_NO_PRESENCE), 1059167897f4SJaroslav Kysela SND_PCI_QUIRK(0x103c, 0x8457, "HP Z2 G4 mini", CXT_FIXUP_HP_MIC_NO_PRESENCE), 1060167897f4SJaroslav Kysela SND_PCI_QUIRK(0x103c, 0x8458, "HP Z2 G4 mini premium", CXT_FIXUP_HP_MIC_NO_PRESENCE), 1061e4c3bce2SDavid Henningsson SND_PCI_QUIRK(0x1043, 0x138d, "Asus", CXT_FIXUP_HEADPHONE_MIC_PIN), 106253447b46Sbo liu SND_PCI_QUIRK(0x14f1, 0x0265, "SWS JS201D", CXT_PINCFG_SWS_JS201D), 10633a00c660STakashi Iwai SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT_FIXUP_OLPC_XO), 1064d70f3632STakashi Iwai SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410), 1065d70f3632STakashi Iwai SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo T410", CXT_PINCFG_LENOVO_TP410), 1066d70f3632STakashi Iwai SND_PCI_QUIRK(0x17aa, 0x215f, "Lenovo T510", CXT_PINCFG_LENOVO_TP410), 1067d70f3632STakashi Iwai SND_PCI_QUIRK(0x17aa, 0x21ce, "Lenovo T420", CXT_PINCFG_LENOVO_TP410), 1068d70f3632STakashi Iwai SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520", CXT_PINCFG_LENOVO_TP410), 1069ef7d84caSPeter Große SND_PCI_QUIRK(0x17aa, 0x21d2, "Lenovo T420s", CXT_PINCFG_LENOVO_TP410), 1070a555bb8cSDavid Henningsson SND_PCI_QUIRK(0x17aa, 0x21da, "Lenovo X220", CXT_PINCFG_LENOVO_TP410), 107188d57606SDavid Henningsson SND_PCI_QUIRK(0x17aa, 0x21db, "Lenovo X220-tablet", CXT_PINCFG_LENOVO_TP410), 10723542aed7STakashi Iwai SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo IdeaPad Z560", CXT_FIXUP_MUTE_LED_EAPD), 1073e7bb6ad5SJeremy Cline SND_PCI_QUIRK(0x17aa, 0x3905, "Lenovo G50-30", CXT_FIXUP_STEREO_DMIC), 1074e8d65a8dSDavid Henningsson SND_PCI_QUIRK(0x17aa, 0x390b, "Lenovo G50-80", CXT_FIXUP_STEREO_DMIC), 107518dcd304SDavid Henningsson SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC), 1076b871cb97STakashi Iwai /* NOTE: we'd need to extend the quirk for 17aa:3977 as the same 1077b871cb97STakashi Iwai * PCI SSID is used on multiple Lenovo models 1078b871cb97STakashi Iwai */ 1079b871cb97STakashi Iwai SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMIC), 1080bbba6f9dSTakashi Iwai SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo G50-70", CXT_FIXUP_STEREO_DMIC), 1081b3c5dce8SDavid Henningsson SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC), 10822fd3f170SHui Wang SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", CXT_FIXUP_THINKPAD_ACPI), 1083239fb862SHuacai Chen SND_PCI_QUIRK(0x1c06, 0x2011, "Lemote A1004", CXT_PINCFG_LEMOTE_A1004), 1084239fb862SHuacai Chen SND_PCI_QUIRK(0x1c06, 0x2012, "Lemote A1205", CXT_PINCFG_LEMOTE_A1205), 1085*638e61b0SChristoffer Sandberg SND_PCI_QUIRK(0x2782, 0x12c3, "Sirius Gen1", CXT_PINCFG_TOP_SPEAKER), 1086*638e61b0SChristoffer Sandberg SND_PCI_QUIRK(0x2782, 0x12c5, "Sirius Gen2", CXT_PINCFG_TOP_SPEAKER), 1087f2e5731dSTakashi Iwai {} 1088f2e5731dSTakashi Iwai }; 1089f2e5731dSTakashi Iwai 1090a2dd933dSTakashi Iwai static const struct hda_model_fixup cxt5066_fixup_models[] = { 1091a2dd933dSTakashi Iwai { .id = CXT_FIXUP_STEREO_DMIC, .name = "stereo-dmic" }, 1092a2dd933dSTakashi Iwai { .id = CXT_FIXUP_GPIO1, .name = "gpio1" }, 1093a2dd933dSTakashi Iwai { .id = CXT_FIXUP_HEADPHONE_MIC_PIN, .name = "headphone-mic-pin" }, 1094a2dd933dSTakashi Iwai { .id = CXT_PINCFG_LENOVO_TP410, .name = "tp410" }, 1095a2dd933dSTakashi Iwai { .id = CXT_FIXUP_THINKPAD_ACPI, .name = "thinkpad" }, 1096a2dd933dSTakashi Iwai { .id = CXT_PINCFG_LEMOTE_A1004, .name = "lemote-a1004" }, 10978245b363SHuacai Chen { .id = CXT_PINCFG_LEMOTE_A1205, .name = "lemote-a1205" }, 10983a00c660STakashi Iwai { .id = CXT_FIXUP_OLPC_XO, .name = "olpc-xo" }, 10993542aed7STakashi Iwai { .id = CXT_FIXUP_MUTE_LED_EAPD, .name = "mute-led-eapd" }, 1100cc3a47a2SJaroslav Kysela { .id = CXT_FIXUP_HP_DOCK, .name = "hp-dock" }, 11015cd5b1bdSJerónimo Borque { .id = CXT_FIXUP_MUTE_LED_GPIO, .name = "mute-led-gpio" }, 110256b26497STakashi Iwai { .id = CXT_FIXUP_HP_ZBOOK_MUTE_LED, .name = "hp-zbook-mute-led" }, 110309b83d10STakashi Iwai { .id = CXT_FIXUP_HP_MIC_NO_PRESENCE, .name = "hp-mic-fix" }, 1104b871cb97STakashi Iwai { .id = CXT_PINCFG_LENOVO_NOTEBOOK, .name = "lenovo-20149" }, 110553447b46Sbo liu { .id = CXT_PINCFG_SWS_JS201D, .name = "sws-js201d" }, 1106*638e61b0SChristoffer Sandberg { .id = CXT_PINCFG_TOP_SPEAKER, .name = "sirius-top-speaker" }, 1107a2dd933dSTakashi Iwai {} 1108a2dd933dSTakashi Iwai }; 1109a2dd933dSTakashi Iwai 11103868137eSTakashi Iwai /* add "fake" mute amp-caps to DACs on cx5051 so that mixer mute switches 11113868137eSTakashi Iwai * can be created (bko#42825) 11123868137eSTakashi Iwai */ 11133868137eSTakashi Iwai static void add_cx5051_fake_mutes(struct hda_codec *codec) 11143868137eSTakashi Iwai { 1115d89c6c0cSTakashi Iwai struct conexant_spec *spec = codec->spec; 1116caf3c043SMichał Mirosław static const hda_nid_t out_nids[] = { 11173868137eSTakashi Iwai 0x10, 0x11, 0 11183868137eSTakashi Iwai }; 1119caf3c043SMichał Mirosław const hda_nid_t *p; 11203868137eSTakashi Iwai 11213868137eSTakashi Iwai for (p = out_nids; *p; p++) 11223868137eSTakashi Iwai snd_hda_override_amp_caps(codec, *p, HDA_OUTPUT, 11233868137eSTakashi Iwai AC_AMPCAP_MIN_MUTE | 11243868137eSTakashi Iwai query_amp_caps(codec, *p, HDA_OUTPUT)); 1125d89c6c0cSTakashi Iwai spec->gen.dac_min_mute = true; 11263868137eSTakashi Iwai } 11273868137eSTakashi Iwai 1128f2e5731dSTakashi Iwai static int patch_conexant_auto(struct hda_codec *codec) 1129f2e5731dSTakashi Iwai { 1130f2e5731dSTakashi Iwai struct conexant_spec *spec; 1131f2e5731dSTakashi Iwai int err; 1132f2e5731dSTakashi Iwai 11337639a06cSTakashi Iwai codec_info(codec, "%s: BIOS auto-probing.\n", codec->core.chip_name); 11341f8458a2STakashi Iwai 1135f2e5731dSTakashi Iwai spec = kzalloc(sizeof(*spec), GFP_KERNEL); 1136f2e5731dSTakashi Iwai if (!spec) 1137f2e5731dSTakashi Iwai return -ENOMEM; 1138aed523f1STakashi Iwai snd_hda_gen_spec_init(&spec->gen); 1139f2e5731dSTakashi Iwai codec->spec = spec; 1140225068abSTakashi Iwai codec->patch_ops = cx_auto_patch_ops; 1141e92d4b08STakashi Iwai 114224d74841Sbo liu /* init cx8070/sn6140 flag and reset headset_present_flag */ 114324d74841Sbo liu switch (codec->core.vendor_id) { 114424d74841Sbo liu case 0x14f11f86: 114524d74841Sbo liu case 0x14f11f87: 114624d74841Sbo liu spec->is_cx8070_sn6140 = true; 1147bc773441Ssongxiebing snd_hda_jack_detect_enable_callback(codec, 0x19, cx_update_headset_mic_vref); 114824d74841Sbo liu break; 114924d74841Sbo liu } 115024d74841Sbo liu 1151aed523f1STakashi Iwai cx_auto_parse_eapd(codec); 1152ff359b14STakashi Iwai spec->gen.own_eapd_ctl = 1; 1153e92d4b08STakashi Iwai 11547639a06cSTakashi Iwai switch (codec->core.vendor_id) { 11556b452142STakashi Iwai case 0x14f15045: 11564f32456eSMichael Karcher codec->single_adc_amp = 1; 115770540e24STakashi Iwai spec->gen.mixer_nid = 0x17; 115874f14b36STakashi Iwai spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO; 1159ad7725d3STakashi Iwai snd_hda_pick_fixup(codec, cxt5045_fixup_models, 1160ad7725d3STakashi Iwai cxt5045_fixups, cxt_fixups); 11616b452142STakashi Iwai break; 1162164a7adaSTakashi Iwai case 0x14f15047: 1163164a7adaSTakashi Iwai codec->pin_amp_workaround = 1; 1164164a7adaSTakashi Iwai spec->gen.mixer_nid = 0x19; 116574f14b36STakashi Iwai spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO; 1166ea30e7dfSTakashi Iwai snd_hda_pick_fixup(codec, cxt5047_fixup_models, 1167ea30e7dfSTakashi Iwai cxt5047_fixups, cxt_fixups); 1168164a7adaSTakashi Iwai break; 11693868137eSTakashi Iwai case 0x14f15051: 11703868137eSTakashi Iwai add_cx5051_fake_mutes(codec); 117151969d62SMichael Karcher codec->pin_amp_workaround = 1; 1172a2dd933dSTakashi Iwai snd_hda_pick_fixup(codec, cxt5051_fixup_models, 1173a2dd933dSTakashi Iwai cxt5051_fixups, cxt_fixups); 11743868137eSTakashi Iwai break; 1175d5ea7544Shuangwenhui case 0x14f15098: 1176d5ea7544Shuangwenhui codec->pin_amp_workaround = 1; 1177d5ea7544Shuangwenhui spec->gen.mixer_nid = 0x22; 1178d5ea7544Shuangwenhui spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO; 1179d5ea7544Shuangwenhui snd_hda_pick_fixup(codec, cxt5066_fixup_models, 1180d5ea7544Shuangwenhui cxt5066_fixups, cxt_fixups); 1181d5ea7544Shuangwenhui break; 1182b03d61d6SDavid Henningsson case 0x14f150f2: 1183b03d61d6SDavid Henningsson codec->power_save_node = 1; 1184c0dbbdadSGustavo A. R. Silva fallthrough; 118551969d62SMichael Karcher default: 118651969d62SMichael Karcher codec->pin_amp_workaround = 1; 1187a2dd933dSTakashi Iwai snd_hda_pick_fixup(codec, cxt5066_fixup_models, 1188a2dd933dSTakashi Iwai cxt5066_fixups, cxt_fixups); 118923d30f28STakashi Iwai break; 11906b452142STakashi Iwai } 11916b452142STakashi Iwai 1192929f718cSTakashi Iwai if (!spec->gen.vmaster_mute.hook && spec->dynamic_eapd) 1193929f718cSTakashi Iwai spec->gen.vmaster_mute.hook = cx_auto_vmaster_hook; 1194527c73baSTakashi Iwai 1195aed523f1STakashi Iwai snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); 1196aed523f1STakashi Iwai 1197e4c3bce2SDavid Henningsson err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL, 1198e4c3bce2SDavid Henningsson spec->parse_flags); 119922ce5f74STakashi Iwai if (err < 0) 1200aed523f1STakashi Iwai goto error; 1201aed523f1STakashi Iwai 12025faa0bc6STakashi Iwai err = cx_auto_parse_beep(codec); 1203aed523f1STakashi Iwai if (err < 0) 1204aed523f1STakashi Iwai goto error; 1205aed523f1STakashi Iwai 12065faa0bc6STakashi Iwai err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg); 120751e19ca5STakashi Iwai if (err < 0) 120851e19ca5STakashi Iwai goto error; 120951e19ca5STakashi Iwai 12104f2864a4STakashi Iwai /* Some laptops with Conexant chips show stalls in S3 resume, 12114f2864a4STakashi Iwai * which falls into the single-cmd mode. 12124f2864a4STakashi Iwai * Better to make reset, then. 12134f2864a4STakashi Iwai */ 1214d068ebc2STakashi Iwai if (!codec->bus->core.sync_write) { 12154e76a883STakashi Iwai codec_info(codec, 12164f2864a4STakashi Iwai "Enable sync_write for stable communication\n"); 1217d068ebc2STakashi Iwai codec->bus->core.sync_write = 1; 12184f2864a4STakashi Iwai codec->bus->allow_bus_reset = 1; 12194f2864a4STakashi Iwai } 12204f2864a4STakashi Iwai 1221e4c3bce2SDavid Henningsson snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); 1222e4c3bce2SDavid Henningsson 1223f2e5731dSTakashi Iwai return 0; 1224aed523f1STakashi Iwai 1225aed523f1STakashi Iwai error: 122608cf680cSDavid Henningsson cx_auto_free(codec); 1227aed523f1STakashi Iwai return err; 1228f2e5731dSTakashi Iwai } 1229f2e5731dSTakashi Iwai 1230f2e5731dSTakashi Iwai /* 1231461e2c78STakashi Iwai */ 1232461e2c78STakashi Iwai 1233b9a94a9cSTakashi Iwai static const struct hda_device_id snd_hda_id_conexant[] = { 12343f880949SHui Wang HDA_CODEC_ENTRY(0x14f11f86, "CX8070", patch_conexant_auto), 1235ca348e7fSbo liu HDA_CODEC_ENTRY(0x14f11f87, "SN6140", patch_conexant_auto), 1236bcdda2ecSTakashi Iwai HDA_CODEC_ENTRY(0x14f12008, "CX8200", patch_conexant_auto), 1237744a11abSbo liu HDA_CODEC_ENTRY(0x14f120d0, "CX11970", patch_conexant_auto), 123818d7e16cSBo Liu HDA_CODEC_ENTRY(0x14f120d1, "SN6180", patch_conexant_auto), 1239b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f15045, "CX20549 (Venice)", patch_conexant_auto), 1240b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f15047, "CX20551 (Waikiki)", patch_conexant_auto), 1241b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f15051, "CX20561 (Hermosa)", patch_conexant_auto), 1242b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f15066, "CX20582 (Pebble)", patch_conexant_auto), 1243b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f15067, "CX20583 (Pebble HSF)", patch_conexant_auto), 1244b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f15068, "CX20584", patch_conexant_auto), 1245b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f15069, "CX20585", patch_conexant_auto), 1246b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f1506c, "CX20588", patch_conexant_auto), 1247b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f1506e, "CX20590", patch_conexant_auto), 1248b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f15097, "CX20631", patch_conexant_auto), 1249b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f15098, "CX20632", patch_conexant_auto), 1250b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f150a1, "CX20641", patch_conexant_auto), 1251b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f150a2, "CX20642", patch_conexant_auto), 1252b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f150ab, "CX20651", patch_conexant_auto), 1253b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f150ac, "CX20652", patch_conexant_auto), 1254b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f150b8, "CX20664", patch_conexant_auto), 1255b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f150b9, "CX20665", patch_conexant_auto), 12563b7e2a7dSTakashi Iwai HDA_CODEC_ENTRY(0x14f150f1, "CX21722", patch_conexant_auto), 1257b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f150f2, "CX20722", patch_conexant_auto), 12583b7e2a7dSTakashi Iwai HDA_CODEC_ENTRY(0x14f150f3, "CX21724", patch_conexant_auto), 1259b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f150f4, "CX20724", patch_conexant_auto), 1260b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f1510f, "CX20751/2", patch_conexant_auto), 1261b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f15110, "CX20751/2", patch_conexant_auto), 1262b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f15111, "CX20753/4", patch_conexant_auto), 1263b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f15113, "CX20755", patch_conexant_auto), 1264b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f15114, "CX20756", patch_conexant_auto), 1265b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f15115, "CX20757", patch_conexant_auto), 1266b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f151d7, "CX20952", patch_conexant_auto), 1267c9b443d4STobin Davis {} /* terminator */ 1268c9b443d4STobin Davis }; 1269b9a94a9cSTakashi Iwai MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_conexant); 12701289e9e8STakashi Iwai 12711289e9e8STakashi Iwai MODULE_LICENSE("GPL"); 12721289e9e8STakashi Iwai MODULE_DESCRIPTION("Conexant HD-audio codec"); 12731289e9e8STakashi Iwai 1274d8a766a1STakashi Iwai static struct hda_codec_driver conexant_driver = { 1275b9a94a9cSTakashi Iwai .id = snd_hda_id_conexant, 12761289e9e8STakashi Iwai }; 12771289e9e8STakashi Iwai 1278d8a766a1STakashi Iwai module_hda_codec_driver(conexant_driver); 1279