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 24*24d74841Sbo liu enum { 25*24d74841Sbo liu CX_HEADSET_NOPRESENT = 0, 26*24d74841Sbo liu CX_HEADSET_PARTPRESENT, 27*24d74841Sbo liu CX_HEADSET_ALLPRESENT, 28*24d74841Sbo liu }; 29*24d74841Sbo liu 30c9b443d4STobin Davis struct conexant_spec { 3123d30f28STakashi Iwai struct hda_gen_spec gen; 32c9b443d4STobin Davis 33bf92d1d5STakashi Iwai /* extra EAPD pins */ 34bf92d1d5STakashi Iwai unsigned int num_eapds; 35bf92d1d5STakashi Iwai hda_nid_t eapds[4]; 36ff359b14STakashi Iwai bool dynamic_eapd; 373542aed7STakashi Iwai hda_nid_t mute_led_eapd; 38bf92d1d5STakashi Iwai 39e4c3bce2SDavid Henningsson unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */ 40e4c3bce2SDavid Henningsson 413a00c660STakashi Iwai /* OPLC XO specific */ 423a00c660STakashi Iwai bool recording; 433a00c660STakashi Iwai bool dc_enable; 443a00c660STakashi Iwai unsigned int dc_input_bias; /* offset into olpc_xo_dc_bias */ 453a00c660STakashi Iwai struct nid_path *dc_mode_path; 465cd5b1bdSJerónimo Borque 475cd5b1bdSJerónimo Borque int mute_led_polarity; 485cd5b1bdSJerónimo Borque unsigned int gpio_led; 495cd5b1bdSJerónimo Borque unsigned int gpio_mute_led_mask; 505cd5b1bdSJerónimo Borque unsigned int gpio_mic_led_mask; 51*24d74841Sbo liu unsigned int headset_present_flag; 52*24d74841Sbo liu bool is_cx8070_sn6140; 53c9b443d4STobin Davis }; 54c9b443d4STobin Davis 55bf92d1d5STakashi Iwai 56bf92d1d5STakashi Iwai #ifdef CONFIG_SND_HDA_INPUT_BEEP 5751e19ca5STakashi Iwai /* additional beep mixers; private_value will be overwritten */ 58bf92d1d5STakashi Iwai static const struct snd_kcontrol_new cxt_beep_mixer[] = { 59bf92d1d5STakashi Iwai HDA_CODEC_VOLUME_MONO("Beep Playback Volume", 0, 1, 0, HDA_OUTPUT), 60bf92d1d5STakashi Iwai HDA_CODEC_MUTE_BEEP_MONO("Beep Playback Switch", 0, 1, 0, HDA_OUTPUT), 61bf92d1d5STakashi Iwai }; 62bf92d1d5STakashi Iwai 6351e19ca5STakashi Iwai static int set_beep_amp(struct conexant_spec *spec, hda_nid_t nid, 6451e19ca5STakashi Iwai int idx, int dir) 65bf92d1d5STakashi Iwai { 6651e19ca5STakashi Iwai struct snd_kcontrol_new *knew; 6751e19ca5STakashi Iwai unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 1, idx, dir); 6851e19ca5STakashi Iwai int i; 69bf92d1d5STakashi Iwai 7051e19ca5STakashi Iwai spec->gen.beep_nid = nid; 7151e19ca5STakashi Iwai for (i = 0; i < ARRAY_SIZE(cxt_beep_mixer); i++) { 7251e19ca5STakashi Iwai knew = snd_hda_gen_add_kctl(&spec->gen, NULL, 7351e19ca5STakashi Iwai &cxt_beep_mixer[i]); 7451e19ca5STakashi Iwai if (!knew) 75bf92d1d5STakashi Iwai return -ENOMEM; 7651e19ca5STakashi Iwai knew->private_value = beep_amp; 77bf92d1d5STakashi Iwai } 78bf92d1d5STakashi Iwai return 0; 79bf92d1d5STakashi Iwai } 80bf92d1d5STakashi Iwai 8151e19ca5STakashi Iwai static int cx_auto_parse_beep(struct hda_codec *codec) 82f2e5731dSTakashi Iwai { 83f2e5731dSTakashi Iwai struct conexant_spec *spec = codec->spec; 847639a06cSTakashi Iwai hda_nid_t nid; 85f2e5731dSTakashi Iwai 867639a06cSTakashi Iwai for_each_hda_codec_node(nid, codec) 8751e19ca5STakashi Iwai if (get_wcaps_type(get_wcaps(codec, nid)) == AC_WID_BEEP) 8851e19ca5STakashi Iwai return set_beep_amp(spec, nid, 0, HDA_OUTPUT); 8951e19ca5STakashi Iwai return 0; 90f2e5731dSTakashi Iwai } 91f2e5731dSTakashi Iwai #else 9251e19ca5STakashi Iwai #define cx_auto_parse_beep(codec) 0 93f2e5731dSTakashi Iwai #endif 94f2e5731dSTakashi Iwai 9551e19ca5STakashi Iwai /* 9651e19ca5STakashi Iwai * Automatic parser for CX20641 & co 9751e19ca5STakashi Iwai */ 9851e19ca5STakashi Iwai 99254f2968STakashi Iwai /* parse EAPDs */ 10019110595STakashi Iwai static void cx_auto_parse_eapd(struct hda_codec *codec) 10119110595STakashi Iwai { 10219110595STakashi Iwai struct conexant_spec *spec = codec->spec; 1037639a06cSTakashi Iwai hda_nid_t nid; 10419110595STakashi Iwai 1057639a06cSTakashi Iwai for_each_hda_codec_node(nid, codec) { 10619110595STakashi Iwai if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) 10719110595STakashi Iwai continue; 10819110595STakashi Iwai if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)) 10919110595STakashi Iwai continue; 11019110595STakashi Iwai spec->eapds[spec->num_eapds++] = nid; 11119110595STakashi Iwai if (spec->num_eapds >= ARRAY_SIZE(spec->eapds)) 11219110595STakashi Iwai break; 11319110595STakashi Iwai } 114254f2968STakashi Iwai 115254f2968STakashi Iwai /* NOTE: below is a wild guess; if we have more than two EAPDs, 116254f2968STakashi Iwai * it's a new chip, where EAPDs are supposed to be associated to 117254f2968STakashi Iwai * pins, and we can control EAPD per pin. 118254f2968STakashi Iwai * OTOH, if only one or two EAPDs are found, it's an old chip, 119254f2968STakashi Iwai * thus it might control over all pins. 120254f2968STakashi Iwai */ 121aed523f1STakashi Iwai if (spec->num_eapds > 2) 122ff359b14STakashi Iwai spec->dynamic_eapd = 1; 123f2e5731dSTakashi Iwai } 124f2e5731dSTakashi Iwai 125da339866STakashi Iwai static void cx_auto_turn_eapd(struct hda_codec *codec, int num_pins, 126caf3c043SMichał Mirosław const hda_nid_t *pins, bool on) 127f2e5731dSTakashi Iwai { 128f2e5731dSTakashi Iwai int i; 129f2e5731dSTakashi Iwai for (i = 0; i < num_pins; i++) { 130f2e5731dSTakashi Iwai if (snd_hda_query_pin_caps(codec, pins[i]) & AC_PINCAP_EAPD) 131f2e5731dSTakashi Iwai snd_hda_codec_write(codec, pins[i], 0, 132da339866STakashi Iwai AC_VERB_SET_EAPD_BTLENABLE, 133da339866STakashi Iwai on ? 0x02 : 0); 134f2e5731dSTakashi Iwai } 135f2e5731dSTakashi Iwai } 136f2e5731dSTakashi Iwai 137527c73baSTakashi Iwai /* turn on/off EAPD according to Master switch */ 138527c73baSTakashi Iwai static void cx_auto_vmaster_hook(void *private_data, int enabled) 139527c73baSTakashi Iwai { 140527c73baSTakashi Iwai struct hda_codec *codec = private_data; 141527c73baSTakashi Iwai struct conexant_spec *spec = codec->spec; 142527c73baSTakashi Iwai 143527c73baSTakashi Iwai cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, enabled); 144527c73baSTakashi Iwai } 145527c73baSTakashi Iwai 1463542aed7STakashi Iwai /* turn on/off EAPD according to Master switch (inversely!) for mute LED */ 147929f718cSTakashi Iwai static int cx_auto_vmaster_mute_led(struct led_classdev *led_cdev, 148929f718cSTakashi Iwai enum led_brightness brightness) 1493542aed7STakashi Iwai { 150929f718cSTakashi Iwai struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); 1513542aed7STakashi Iwai struct conexant_spec *spec = codec->spec; 1523542aed7STakashi Iwai 1533542aed7STakashi Iwai snd_hda_codec_write(codec, spec->mute_led_eapd, 0, 1543542aed7STakashi Iwai AC_VERB_SET_EAPD_BTLENABLE, 155929f718cSTakashi Iwai brightness ? 0x02 : 0x00); 156929f718cSTakashi Iwai return 0; 1573542aed7STakashi Iwai } 1583542aed7STakashi Iwai 15956b26497STakashi Iwai static void cxt_init_gpio_led(struct hda_codec *codec) 16056b26497STakashi Iwai { 16156b26497STakashi Iwai struct conexant_spec *spec = codec->spec; 16256b26497STakashi Iwai unsigned int mask = spec->gpio_mute_led_mask | spec->gpio_mic_led_mask; 16356b26497STakashi Iwai 16456b26497STakashi Iwai if (mask) { 16556b26497STakashi Iwai snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_MASK, 16656b26497STakashi Iwai mask); 16756b26497STakashi Iwai snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DIRECTION, 16856b26497STakashi Iwai mask); 16956b26497STakashi Iwai snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 17056b26497STakashi Iwai spec->gpio_led); 17156b26497STakashi Iwai } 17256b26497STakashi Iwai } 17356b26497STakashi Iwai 174*24d74841Sbo liu static void cx_fixup_headset_recog(struct hda_codec *codec) 175*24d74841Sbo liu { 176*24d74841Sbo liu unsigned int mic_persent; 177*24d74841Sbo liu 178*24d74841Sbo liu /* fix some headset type recognize fail issue, such as EDIFIER headset */ 179*24d74841Sbo liu /* set micbiasd output current comparator threshold from 66% to 55%. */ 180*24d74841Sbo liu snd_hda_codec_write(codec, 0x1c, 0, 0x320, 0x010); 181*24d74841Sbo liu /* set OFF voltage for DFET from -1.2V to -0.8V, set headset micbias registor 182*24d74841Sbo liu * value adjustment trim from 2.2K ohms to 2.0K ohms. 183*24d74841Sbo liu */ 184*24d74841Sbo liu snd_hda_codec_write(codec, 0x1c, 0, 0x3b0, 0xe10); 185*24d74841Sbo liu /* fix reboot headset type recognize fail issue */ 186*24d74841Sbo liu mic_persent = snd_hda_codec_read(codec, 0x19, 0, AC_VERB_GET_PIN_SENSE, 0x0); 187*24d74841Sbo liu if (mic_persent & AC_PINSENSE_PRESENCE) 188*24d74841Sbo liu /* enable headset mic VREF */ 189*24d74841Sbo liu snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24); 190*24d74841Sbo liu else 191*24d74841Sbo liu /* disable headset mic VREF */ 192*24d74841Sbo liu snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20); 193*24d74841Sbo liu } 194*24d74841Sbo liu 195ff359b14STakashi Iwai static int cx_auto_init(struct hda_codec *codec) 196ff359b14STakashi Iwai { 197ff359b14STakashi Iwai struct conexant_spec *spec = codec->spec; 198ff359b14STakashi Iwai snd_hda_gen_init(codec); 199ff359b14STakashi Iwai if (!spec->dynamic_eapd) 200ff359b14STakashi Iwai cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, true); 201e4c3bce2SDavid Henningsson 20256b26497STakashi Iwai cxt_init_gpio_led(codec); 203e4c3bce2SDavid Henningsson snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT); 204e4c3bce2SDavid Henningsson 205*24d74841Sbo liu if (spec->is_cx8070_sn6140) 206*24d74841Sbo liu cx_fixup_headset_recog(codec); 207*24d74841Sbo liu 208ff359b14STakashi Iwai return 0; 209ff359b14STakashi Iwai } 210ff359b14STakashi Iwai 21195dc85dbSTakashi Iwai static void cx_auto_shutdown(struct hda_codec *codec) 212f6b28e4dSDavid Henningsson { 213f6b28e4dSDavid Henningsson struct conexant_spec *spec = codec->spec; 214f6b28e4dSDavid Henningsson 215d77a4b4aSPark Ju Hyung /* Turn the problematic codec into D3 to avoid spurious noises 216f6b28e4dSDavid Henningsson from the internal speaker during (and after) reboot */ 217f6b28e4dSDavid Henningsson cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, false); 21895dc85dbSTakashi Iwai } 21995dc85dbSTakashi Iwai 220f6b28e4dSDavid Henningsson static void cx_auto_free(struct hda_codec *codec) 221f6b28e4dSDavid Henningsson { 222327b34f2STakashi Iwai cx_auto_shutdown(codec); 223f6b28e4dSDavid Henningsson snd_hda_gen_free(codec); 224f6b28e4dSDavid Henningsson } 22508cf680cSDavid Henningsson 226*24d74841Sbo liu static void cx_process_headset_plugin(struct hda_codec *codec) 227*24d74841Sbo liu { 228*24d74841Sbo liu unsigned int val; 229*24d74841Sbo liu unsigned int count = 0; 230*24d74841Sbo liu 231*24d74841Sbo liu /* Wait headset detect done. */ 232*24d74841Sbo liu do { 233*24d74841Sbo liu val = snd_hda_codec_read(codec, 0x1c, 0, 0xca0, 0x0); 234*24d74841Sbo liu if (val & 0x080) { 235*24d74841Sbo liu codec_dbg(codec, "headset type detect done!\n"); 236*24d74841Sbo liu break; 237*24d74841Sbo liu } 238*24d74841Sbo liu msleep(20); 239*24d74841Sbo liu count++; 240*24d74841Sbo liu } while (count < 3); 241*24d74841Sbo liu val = snd_hda_codec_read(codec, 0x1c, 0, 0xcb0, 0x0); 242*24d74841Sbo liu if (val & 0x800) { 243*24d74841Sbo liu codec_dbg(codec, "headset plugin, type is CTIA\n"); 244*24d74841Sbo liu snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24); 245*24d74841Sbo liu } else if (val & 0x400) { 246*24d74841Sbo liu codec_dbg(codec, "headset plugin, type is OMTP\n"); 247*24d74841Sbo liu snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24); 248*24d74841Sbo liu } else { 249*24d74841Sbo liu codec_dbg(codec, "headphone plugin\n"); 250*24d74841Sbo liu } 251*24d74841Sbo liu } 252*24d74841Sbo liu 253*24d74841Sbo liu static void cx_update_headset_mic_vref(struct hda_codec *codec, unsigned int res) 254*24d74841Sbo liu { 255*24d74841Sbo liu unsigned int phone_present, mic_persent, phone_tag, mic_tag; 256*24d74841Sbo liu struct conexant_spec *spec = codec->spec; 257*24d74841Sbo liu 258*24d74841Sbo liu /* In cx8070 and sn6140, the node 16 can only be config to headphone or disabled, 259*24d74841Sbo liu * the node 19 can only be config to microphone or disabled. 260*24d74841Sbo liu * Check hp&mic tag to process headset pulgin&plugout. 261*24d74841Sbo liu */ 262*24d74841Sbo liu phone_tag = snd_hda_codec_read(codec, 0x16, 0, AC_VERB_GET_UNSOLICITED_RESPONSE, 0x0); 263*24d74841Sbo liu mic_tag = snd_hda_codec_read(codec, 0x19, 0, AC_VERB_GET_UNSOLICITED_RESPONSE, 0x0); 264*24d74841Sbo liu if ((phone_tag & (res >> AC_UNSOL_RES_TAG_SHIFT)) || 265*24d74841Sbo liu (mic_tag & (res >> AC_UNSOL_RES_TAG_SHIFT))) { 266*24d74841Sbo liu phone_present = snd_hda_codec_read(codec, 0x16, 0, AC_VERB_GET_PIN_SENSE, 0x0); 267*24d74841Sbo liu if (!(phone_present & AC_PINSENSE_PRESENCE)) {/* headphone plugout */ 268*24d74841Sbo liu spec->headset_present_flag = CX_HEADSET_NOPRESENT; 269*24d74841Sbo liu snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20); 270*24d74841Sbo liu return; 271*24d74841Sbo liu } 272*24d74841Sbo liu if (spec->headset_present_flag == CX_HEADSET_NOPRESENT) { 273*24d74841Sbo liu spec->headset_present_flag = CX_HEADSET_PARTPRESENT; 274*24d74841Sbo liu } else if (spec->headset_present_flag == CX_HEADSET_PARTPRESENT) { 275*24d74841Sbo liu mic_persent = snd_hda_codec_read(codec, 0x19, 0, 276*24d74841Sbo liu AC_VERB_GET_PIN_SENSE, 0x0); 277*24d74841Sbo liu /* headset is present */ 278*24d74841Sbo liu if ((phone_present & AC_PINSENSE_PRESENCE) && 279*24d74841Sbo liu (mic_persent & AC_PINSENSE_PRESENCE)) { 280*24d74841Sbo liu cx_process_headset_plugin(codec); 281*24d74841Sbo liu spec->headset_present_flag = CX_HEADSET_ALLPRESENT; 282*24d74841Sbo liu } 283*24d74841Sbo liu } 284*24d74841Sbo liu } 285*24d74841Sbo liu } 286*24d74841Sbo liu 287*24d74841Sbo liu static void cx_jack_unsol_event(struct hda_codec *codec, unsigned int res) 288*24d74841Sbo liu { 289*24d74841Sbo liu struct conexant_spec *spec = codec->spec; 290*24d74841Sbo liu 291*24d74841Sbo liu if (spec->is_cx8070_sn6140) 292*24d74841Sbo liu cx_update_headset_mic_vref(codec, res); 293*24d74841Sbo liu 294*24d74841Sbo liu snd_hda_jack_unsol_event(codec, res); 295*24d74841Sbo liu } 296*24d74841Sbo liu 29795dc85dbSTakashi Iwai #ifdef CONFIG_PM 29895dc85dbSTakashi Iwai static int cx_auto_suspend(struct hda_codec *codec) 29995dc85dbSTakashi Iwai { 30095dc85dbSTakashi Iwai cx_auto_shutdown(codec); 30195dc85dbSTakashi Iwai return 0; 30295dc85dbSTakashi Iwai } 30395dc85dbSTakashi Iwai #endif 30495dc85dbSTakashi Iwai 30534cbe3a6STakashi Iwai static const struct hda_codec_ops cx_auto_patch_ops = { 30651e19ca5STakashi Iwai .build_controls = snd_hda_gen_build_controls, 307aed523f1STakashi Iwai .build_pcms = snd_hda_gen_build_pcms, 308ff359b14STakashi Iwai .init = cx_auto_init, 30908cf680cSDavid Henningsson .free = cx_auto_free, 310*24d74841Sbo liu .unsol_event = cx_jack_unsol_event, 311164a7adaSTakashi Iwai #ifdef CONFIG_PM 31295dc85dbSTakashi Iwai .suspend = cx_auto_suspend, 313164a7adaSTakashi Iwai .check_power_status = snd_hda_gen_check_power_status, 314164a7adaSTakashi Iwai #endif 315f2e5731dSTakashi Iwai }; 316f2e5731dSTakashi Iwai 317e92d4b08STakashi Iwai /* 318e92d4b08STakashi Iwai * pin fix-up 319e92d4b08STakashi Iwai */ 32018dcd304SDavid Henningsson enum { 32118dcd304SDavid Henningsson CXT_PINCFG_LENOVO_X200, 322d3980110STakashi Iwai CXT_PINCFG_LENOVO_TP410, 323239fb862SHuacai Chen CXT_PINCFG_LEMOTE_A1004, 324239fb862SHuacai Chen CXT_PINCFG_LEMOTE_A1205, 325ddb6ca75STakashi Iwai CXT_PINCFG_COMPAQ_CQ60, 32618dcd304SDavid Henningsson CXT_FIXUP_STEREO_DMIC, 327f83bb259SMeng Tang CXT_PINCFG_LENOVO_NOTEBOOK, 328239fb862SHuacai Chen CXT_FIXUP_INC_MIC_BOOST, 329e4c3bce2SDavid Henningsson CXT_FIXUP_HEADPHONE_MIC_PIN, 330e4c3bce2SDavid Henningsson CXT_FIXUP_HEADPHONE_MIC, 3314a437044STakashi Iwai CXT_FIXUP_GPIO1, 332ff50479aSTakashi Iwai CXT_FIXUP_ASPIRE_DMIC, 33308cf680cSDavid Henningsson CXT_FIXUP_THINKPAD_ACPI, 3343a00c660STakashi Iwai CXT_FIXUP_OLPC_XO, 335ad7725d3STakashi Iwai CXT_FIXUP_CAP_MIX_AMP, 3366dcbadefSTakashi Iwai CXT_FIXUP_TOSHIBA_P105, 337e5eac90dSTakashi Iwai CXT_FIXUP_HP_530, 338ea30e7dfSTakashi Iwai CXT_FIXUP_CAP_MIX_AMP_5047, 3393542aed7STakashi Iwai CXT_FIXUP_MUTE_LED_EAPD, 340cc3a47a2SJaroslav Kysela CXT_FIXUP_HP_DOCK, 3410eec8809STakashi Iwai CXT_FIXUP_HP_SPECTRE, 342f73cd43aSTakashi Iwai CXT_FIXUP_HP_GATE_MIC, 3435cd5b1bdSJerónimo Borque CXT_FIXUP_MUTE_LED_GPIO, 34456b26497STakashi Iwai CXT_FIXUP_HP_ZBOOK_MUTE_LED, 345322f74edSHui Wang CXT_FIXUP_HEADSET_MIC, 346322f74edSHui Wang CXT_FIXUP_HP_MIC_NO_PRESENCE, 34718dcd304SDavid Henningsson }; 34818dcd304SDavid Henningsson 349b317b032STakashi Iwai /* for hda_fixup_thinkpad_acpi() */ 350b317b032STakashi Iwai #include "thinkpad_helper.c" 35108cf680cSDavid Henningsson 35223d30f28STakashi Iwai static void cxt_fixup_stereo_dmic(struct hda_codec *codec, 35323d30f28STakashi Iwai const struct hda_fixup *fix, int action) 354e92d4b08STakashi Iwai { 35518dcd304SDavid Henningsson struct conexant_spec *spec = codec->spec; 356aed523f1STakashi Iwai spec->gen.inv_dmic_split = 1; 357e92d4b08STakashi Iwai } 358e92d4b08STakashi Iwai 359239fb862SHuacai Chen static void cxt5066_increase_mic_boost(struct hda_codec *codec, 360239fb862SHuacai Chen const struct hda_fixup *fix, int action) 361239fb862SHuacai Chen { 362239fb862SHuacai Chen if (action != HDA_FIXUP_ACT_PRE_PROBE) 363239fb862SHuacai Chen return; 364239fb862SHuacai Chen 365239fb862SHuacai Chen snd_hda_override_amp_caps(codec, 0x17, HDA_OUTPUT, 366239fb862SHuacai Chen (0x3 << AC_AMPCAP_OFFSET_SHIFT) | 367239fb862SHuacai Chen (0x4 << AC_AMPCAP_NUM_STEPS_SHIFT) | 368239fb862SHuacai Chen (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) | 369239fb862SHuacai Chen (0 << AC_AMPCAP_MUTE_SHIFT)); 370239fb862SHuacai Chen } 371239fb862SHuacai Chen 372e4c3bce2SDavid Henningsson static void cxt_update_headset_mode(struct hda_codec *codec) 373e4c3bce2SDavid Henningsson { 374e4c3bce2SDavid Henningsson /* The verbs used in this function were tested on a Conexant CX20751/2 codec. */ 375e4c3bce2SDavid Henningsson int i; 376e4c3bce2SDavid Henningsson bool mic_mode = false; 377e4c3bce2SDavid Henningsson struct conexant_spec *spec = codec->spec; 378e4c3bce2SDavid Henningsson struct auto_pin_cfg *cfg = &spec->gen.autocfg; 379e4c3bce2SDavid Henningsson 380e4c3bce2SDavid Henningsson hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]]; 381e4c3bce2SDavid Henningsson 382e4c3bce2SDavid Henningsson for (i = 0; i < cfg->num_inputs; i++) 383e4c3bce2SDavid Henningsson if (cfg->inputs[i].pin == mux_pin) { 384e4c3bce2SDavid Henningsson mic_mode = !!cfg->inputs[i].is_headphone_mic; 385e4c3bce2SDavid Henningsson break; 386e4c3bce2SDavid Henningsson } 387e4c3bce2SDavid Henningsson 388e4c3bce2SDavid Henningsson if (mic_mode) { 389e4c3bce2SDavid Henningsson snd_hda_codec_write_cache(codec, 0x1c, 0, 0x410, 0x7c); /* enable merged mode for analog int-mic */ 390e4c3bce2SDavid Henningsson spec->gen.hp_jack_present = false; 391e4c3bce2SDavid Henningsson } else { 392e4c3bce2SDavid Henningsson snd_hda_codec_write_cache(codec, 0x1c, 0, 0x410, 0x54); /* disable merged mode for analog int-mic */ 393e4c3bce2SDavid Henningsson spec->gen.hp_jack_present = snd_hda_jack_detect(codec, spec->gen.autocfg.hp_pins[0]); 394e4c3bce2SDavid Henningsson } 395e4c3bce2SDavid Henningsson 396e4c3bce2SDavid Henningsson snd_hda_gen_update_outputs(codec); 397e4c3bce2SDavid Henningsson } 398e4c3bce2SDavid Henningsson 399e4c3bce2SDavid Henningsson static void cxt_update_headset_mode_hook(struct hda_codec *codec, 4007fe30711STakashi Iwai struct snd_kcontrol *kcontrol, 401e4c3bce2SDavid Henningsson struct snd_ctl_elem_value *ucontrol) 402e4c3bce2SDavid Henningsson { 403e4c3bce2SDavid Henningsson cxt_update_headset_mode(codec); 404e4c3bce2SDavid Henningsson } 405e4c3bce2SDavid Henningsson 406e4c3bce2SDavid Henningsson static void cxt_fixup_headphone_mic(struct hda_codec *codec, 407e4c3bce2SDavid Henningsson const struct hda_fixup *fix, int action) 408e4c3bce2SDavid Henningsson { 409e4c3bce2SDavid Henningsson struct conexant_spec *spec = codec->spec; 410e4c3bce2SDavid Henningsson 411e4c3bce2SDavid Henningsson switch (action) { 412e4c3bce2SDavid Henningsson case HDA_FIXUP_ACT_PRE_PROBE: 413e4c3bce2SDavid Henningsson spec->parse_flags |= HDA_PINCFG_HEADPHONE_MIC; 414a551d914STakashi Iwai snd_hdac_regmap_add_vendor_verb(&codec->core, 0x410); 415e4c3bce2SDavid Henningsson break; 416e4c3bce2SDavid Henningsson case HDA_FIXUP_ACT_PROBE: 4170bed2aa3STakashi Iwai WARN_ON(spec->gen.cap_sync_hook); 418e4c3bce2SDavid Henningsson spec->gen.cap_sync_hook = cxt_update_headset_mode_hook; 419e4c3bce2SDavid Henningsson spec->gen.automute_hook = cxt_update_headset_mode; 420e4c3bce2SDavid Henningsson break; 421e4c3bce2SDavid Henningsson case HDA_FIXUP_ACT_INIT: 422e4c3bce2SDavid Henningsson cxt_update_headset_mode(codec); 423e4c3bce2SDavid Henningsson break; 424e4c3bce2SDavid Henningsson } 425e4c3bce2SDavid Henningsson } 426e4c3bce2SDavid Henningsson 427322f74edSHui Wang static void cxt_fixup_headset_mic(struct hda_codec *codec, 428322f74edSHui Wang const struct hda_fixup *fix, int action) 429322f74edSHui Wang { 430322f74edSHui Wang struct conexant_spec *spec = codec->spec; 431322f74edSHui Wang 432322f74edSHui Wang switch (action) { 433322f74edSHui Wang case HDA_FIXUP_ACT_PRE_PROBE: 434322f74edSHui Wang spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; 435322f74edSHui Wang break; 436322f74edSHui Wang } 437322f74edSHui Wang } 438322f74edSHui Wang 4393a00c660STakashi Iwai /* OPLC XO 1.5 fixup */ 4403a00c660STakashi Iwai 4413a00c660STakashi Iwai /* OLPC XO-1.5 supports DC input mode (e.g. for use with analog sensors) 4423a00c660STakashi Iwai * through the microphone jack. 4433a00c660STakashi Iwai * When the user enables this through a mixer switch, both internal and 4443a00c660STakashi Iwai * external microphones are disabled. Gain is fixed at 0dB. In this mode, 4453a00c660STakashi Iwai * we also allow the bias to be configured through a separate mixer 4463a00c660STakashi Iwai * control. */ 4473a00c660STakashi Iwai 4483a00c660STakashi Iwai #define update_mic_pin(codec, nid, val) \ 449401caff7STakashi Iwai snd_hda_codec_write_cache(codec, nid, 0, \ 4503a00c660STakashi Iwai AC_VERB_SET_PIN_WIDGET_CONTROL, val) 4513a00c660STakashi Iwai 4523a00c660STakashi Iwai static const struct hda_input_mux olpc_xo_dc_bias = { 4533a00c660STakashi Iwai .num_items = 3, 4543a00c660STakashi Iwai .items = { 4553a00c660STakashi Iwai { "Off", PIN_IN }, 4563a00c660STakashi Iwai { "50%", PIN_VREF50 }, 4573a00c660STakashi Iwai { "80%", PIN_VREF80 }, 4583a00c660STakashi Iwai }, 4593a00c660STakashi Iwai }; 4603a00c660STakashi Iwai 4613a00c660STakashi Iwai static void olpc_xo_update_mic_boost(struct hda_codec *codec) 4623a00c660STakashi Iwai { 4633a00c660STakashi Iwai struct conexant_spec *spec = codec->spec; 4643a00c660STakashi Iwai int ch, val; 4653a00c660STakashi Iwai 4663a00c660STakashi Iwai for (ch = 0; ch < 2; ch++) { 4673a00c660STakashi Iwai val = AC_AMP_SET_OUTPUT | 4683a00c660STakashi Iwai (ch ? AC_AMP_SET_RIGHT : AC_AMP_SET_LEFT); 4693a00c660STakashi Iwai if (!spec->dc_enable) 4703a00c660STakashi Iwai val |= snd_hda_codec_amp_read(codec, 0x17, ch, HDA_OUTPUT, 0); 4713a00c660STakashi Iwai snd_hda_codec_write(codec, 0x17, 0, 4723a00c660STakashi Iwai AC_VERB_SET_AMP_GAIN_MUTE, val); 4733a00c660STakashi Iwai } 4743a00c660STakashi Iwai } 4753a00c660STakashi Iwai 4763a00c660STakashi Iwai static void olpc_xo_update_mic_pins(struct hda_codec *codec) 4773a00c660STakashi Iwai { 4783a00c660STakashi Iwai struct conexant_spec *spec = codec->spec; 4793a00c660STakashi Iwai int cur_input, val; 4803a00c660STakashi Iwai struct nid_path *path; 4813a00c660STakashi Iwai 4823a00c660STakashi Iwai cur_input = spec->gen.input_paths[0][spec->gen.cur_mux[0]]; 4833a00c660STakashi Iwai 4843a00c660STakashi Iwai /* Set up mic pins for port-B, C and F dynamically as the recording 4853a00c660STakashi Iwai * LED is turned on/off by these pin controls 4863a00c660STakashi Iwai */ 4873a00c660STakashi Iwai if (!spec->dc_enable) { 4883a00c660STakashi Iwai /* disable DC bias path and pin for port F */ 4893a00c660STakashi Iwai update_mic_pin(codec, 0x1e, 0); 4903a00c660STakashi Iwai snd_hda_activate_path(codec, spec->dc_mode_path, false, false); 4913a00c660STakashi Iwai 4923a00c660STakashi Iwai /* update port B (ext mic) and C (int mic) */ 4933a00c660STakashi Iwai /* OLPC defers mic widget control until when capture is 4943a00c660STakashi Iwai * started because the microphone LED comes on as soon as 4953a00c660STakashi Iwai * these settings are put in place. if we did this before 4963a00c660STakashi Iwai * recording, it would give the false indication that 4973a00c660STakashi Iwai * recording is happening when it is not. 4983a00c660STakashi Iwai */ 4993a00c660STakashi Iwai update_mic_pin(codec, 0x1a, spec->recording ? 5003a00c660STakashi Iwai snd_hda_codec_get_pin_target(codec, 0x1a) : 0); 5013a00c660STakashi Iwai update_mic_pin(codec, 0x1b, spec->recording ? 5023a00c660STakashi Iwai snd_hda_codec_get_pin_target(codec, 0x1b) : 0); 5033a00c660STakashi Iwai /* enable normal mic path */ 5043a00c660STakashi Iwai path = snd_hda_get_path_from_idx(codec, cur_input); 5053a00c660STakashi Iwai if (path) 5063a00c660STakashi Iwai snd_hda_activate_path(codec, path, true, false); 5073a00c660STakashi Iwai } else { 5083a00c660STakashi Iwai /* disable normal mic path */ 5093a00c660STakashi Iwai path = snd_hda_get_path_from_idx(codec, cur_input); 5103a00c660STakashi Iwai if (path) 5113a00c660STakashi Iwai snd_hda_activate_path(codec, path, false, false); 5123a00c660STakashi Iwai 5133a00c660STakashi Iwai /* Even though port F is the DC input, the bias is controlled 5143a00c660STakashi Iwai * on port B. We also leave that port as an active input (but 5153a00c660STakashi Iwai * unselected) in DC mode just in case that is necessary to 5163a00c660STakashi Iwai * make the bias setting take effect. 5173a00c660STakashi Iwai */ 5183a00c660STakashi Iwai if (spec->recording) 5193a00c660STakashi Iwai val = olpc_xo_dc_bias.items[spec->dc_input_bias].index; 5203a00c660STakashi Iwai else 5213a00c660STakashi Iwai val = 0; 5223a00c660STakashi Iwai update_mic_pin(codec, 0x1a, val); 5233a00c660STakashi Iwai update_mic_pin(codec, 0x1b, 0); 5243a00c660STakashi Iwai /* enable DC bias path and pin */ 5253a00c660STakashi Iwai update_mic_pin(codec, 0x1e, spec->recording ? PIN_IN : 0); 5263a00c660STakashi Iwai snd_hda_activate_path(codec, spec->dc_mode_path, true, false); 5273a00c660STakashi Iwai } 5283a00c660STakashi Iwai } 5293a00c660STakashi Iwai 5303a00c660STakashi Iwai /* mic_autoswitch hook */ 5311a4f69d5STakashi Iwai static void olpc_xo_automic(struct hda_codec *codec, 5321a4f69d5STakashi Iwai struct hda_jack_callback *jack) 5333a00c660STakashi Iwai { 5343a00c660STakashi Iwai struct conexant_spec *spec = codec->spec; 5353a00c660STakashi Iwai 5363a00c660STakashi Iwai /* in DC mode, we don't handle automic */ 5373a00c660STakashi Iwai if (!spec->dc_enable) 5383a00c660STakashi Iwai snd_hda_gen_mic_autoswitch(codec, jack); 5393a00c660STakashi Iwai olpc_xo_update_mic_pins(codec); 5403a00c660STakashi Iwai if (spec->dc_enable) 5413a00c660STakashi Iwai olpc_xo_update_mic_boost(codec); 5423a00c660STakashi Iwai } 5433a00c660STakashi Iwai 5443a00c660STakashi Iwai /* pcm_capture hook */ 5453a00c660STakashi Iwai static void olpc_xo_capture_hook(struct hda_pcm_stream *hinfo, 5463a00c660STakashi Iwai struct hda_codec *codec, 5473a00c660STakashi Iwai struct snd_pcm_substream *substream, 5483a00c660STakashi Iwai int action) 5493a00c660STakashi Iwai { 5503a00c660STakashi Iwai struct conexant_spec *spec = codec->spec; 5513a00c660STakashi Iwai 5523a00c660STakashi Iwai /* toggle spec->recording flag and update mic pins accordingly 5533a00c660STakashi Iwai * for turning on/off LED 5543a00c660STakashi Iwai */ 5553a00c660STakashi Iwai switch (action) { 5563a00c660STakashi Iwai case HDA_GEN_PCM_ACT_PREPARE: 5573a00c660STakashi Iwai spec->recording = 1; 5583a00c660STakashi Iwai olpc_xo_update_mic_pins(codec); 5593a00c660STakashi Iwai break; 5603a00c660STakashi Iwai case HDA_GEN_PCM_ACT_CLEANUP: 5613a00c660STakashi Iwai spec->recording = 0; 5623a00c660STakashi Iwai olpc_xo_update_mic_pins(codec); 5633a00c660STakashi Iwai break; 5643a00c660STakashi Iwai } 5653a00c660STakashi Iwai } 5663a00c660STakashi Iwai 5673a00c660STakashi Iwai static int olpc_xo_dc_mode_get(struct snd_kcontrol *kcontrol, 5683a00c660STakashi Iwai struct snd_ctl_elem_value *ucontrol) 5693a00c660STakashi Iwai { 5703a00c660STakashi Iwai struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 5713a00c660STakashi Iwai struct conexant_spec *spec = codec->spec; 5723a00c660STakashi Iwai ucontrol->value.integer.value[0] = spec->dc_enable; 5733a00c660STakashi Iwai return 0; 5743a00c660STakashi Iwai } 5753a00c660STakashi Iwai 5763a00c660STakashi Iwai static int olpc_xo_dc_mode_put(struct snd_kcontrol *kcontrol, 5773a00c660STakashi Iwai struct snd_ctl_elem_value *ucontrol) 5783a00c660STakashi Iwai { 5793a00c660STakashi Iwai struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 5803a00c660STakashi Iwai struct conexant_spec *spec = codec->spec; 5813a00c660STakashi Iwai int dc_enable = !!ucontrol->value.integer.value[0]; 5823a00c660STakashi Iwai 5833a00c660STakashi Iwai if (dc_enable == spec->dc_enable) 5843a00c660STakashi Iwai return 0; 5853a00c660STakashi Iwai 5863a00c660STakashi Iwai spec->dc_enable = dc_enable; 5873a00c660STakashi Iwai olpc_xo_update_mic_pins(codec); 5883a00c660STakashi Iwai olpc_xo_update_mic_boost(codec); 5893a00c660STakashi Iwai return 1; 5903a00c660STakashi Iwai } 5913a00c660STakashi Iwai 5923a00c660STakashi Iwai static int olpc_xo_dc_bias_enum_get(struct snd_kcontrol *kcontrol, 5933a00c660STakashi Iwai struct snd_ctl_elem_value *ucontrol) 5943a00c660STakashi Iwai { 5953a00c660STakashi Iwai struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 5963a00c660STakashi Iwai struct conexant_spec *spec = codec->spec; 5973a00c660STakashi Iwai ucontrol->value.enumerated.item[0] = spec->dc_input_bias; 5983a00c660STakashi Iwai return 0; 5993a00c660STakashi Iwai } 6003a00c660STakashi Iwai 6013a00c660STakashi Iwai static int olpc_xo_dc_bias_enum_info(struct snd_kcontrol *kcontrol, 6023a00c660STakashi Iwai struct snd_ctl_elem_info *uinfo) 6033a00c660STakashi Iwai { 6043a00c660STakashi Iwai return snd_hda_input_mux_info(&olpc_xo_dc_bias, uinfo); 6053a00c660STakashi Iwai } 6063a00c660STakashi Iwai 6073a00c660STakashi Iwai static int olpc_xo_dc_bias_enum_put(struct snd_kcontrol *kcontrol, 6083a00c660STakashi Iwai struct snd_ctl_elem_value *ucontrol) 6093a00c660STakashi Iwai { 6103a00c660STakashi Iwai struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 6113a00c660STakashi Iwai struct conexant_spec *spec = codec->spec; 6123a00c660STakashi Iwai const struct hda_input_mux *imux = &olpc_xo_dc_bias; 6133a00c660STakashi Iwai unsigned int idx; 6143a00c660STakashi Iwai 6153a00c660STakashi Iwai idx = ucontrol->value.enumerated.item[0]; 6163a00c660STakashi Iwai if (idx >= imux->num_items) 6173a00c660STakashi Iwai idx = imux->num_items - 1; 6183a00c660STakashi Iwai if (spec->dc_input_bias == idx) 6193a00c660STakashi Iwai return 0; 6203a00c660STakashi Iwai 6213a00c660STakashi Iwai spec->dc_input_bias = idx; 6223a00c660STakashi Iwai if (spec->dc_enable) 6233a00c660STakashi Iwai olpc_xo_update_mic_pins(codec); 6243a00c660STakashi Iwai return 1; 6253a00c660STakashi Iwai } 6263a00c660STakashi Iwai 6273a00c660STakashi Iwai static const struct snd_kcontrol_new olpc_xo_mixers[] = { 6283a00c660STakashi Iwai { 6293a00c660STakashi Iwai .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 6303a00c660STakashi Iwai .name = "DC Mode Enable Switch", 6313a00c660STakashi Iwai .info = snd_ctl_boolean_mono_info, 6323a00c660STakashi Iwai .get = olpc_xo_dc_mode_get, 6333a00c660STakashi Iwai .put = olpc_xo_dc_mode_put, 6343a00c660STakashi Iwai }, 6353a00c660STakashi Iwai { 6363a00c660STakashi Iwai .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 6373a00c660STakashi Iwai .name = "DC Input Bias Enum", 6383a00c660STakashi Iwai .info = olpc_xo_dc_bias_enum_info, 6393a00c660STakashi Iwai .get = olpc_xo_dc_bias_enum_get, 6403a00c660STakashi Iwai .put = olpc_xo_dc_bias_enum_put, 6413a00c660STakashi Iwai }, 6423a00c660STakashi Iwai {} 6433a00c660STakashi Iwai }; 6443a00c660STakashi Iwai 6453a00c660STakashi Iwai /* overriding mic boost put callback; update mic boost volume only when 6463a00c660STakashi Iwai * DC mode is disabled 6473a00c660STakashi Iwai */ 6483a00c660STakashi Iwai static int olpc_xo_mic_boost_put(struct snd_kcontrol *kcontrol, 6493a00c660STakashi Iwai struct snd_ctl_elem_value *ucontrol) 6503a00c660STakashi Iwai { 6513a00c660STakashi Iwai struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 6523a00c660STakashi Iwai struct conexant_spec *spec = codec->spec; 6533a00c660STakashi Iwai int ret = snd_hda_mixer_amp_volume_put(kcontrol, ucontrol); 6543a00c660STakashi Iwai if (ret > 0 && spec->dc_enable) 6553a00c660STakashi Iwai olpc_xo_update_mic_boost(codec); 6563a00c660STakashi Iwai return ret; 6573a00c660STakashi Iwai } 6583a00c660STakashi Iwai 6593a00c660STakashi Iwai static void cxt_fixup_olpc_xo(struct hda_codec *codec, 6603a00c660STakashi Iwai const struct hda_fixup *fix, int action) 6613a00c660STakashi Iwai { 6623a00c660STakashi Iwai struct conexant_spec *spec = codec->spec; 663a9c2dfc8STakashi Iwai struct snd_kcontrol_new *kctl; 6643a00c660STakashi Iwai int i; 6653a00c660STakashi Iwai 6663a00c660STakashi Iwai if (action != HDA_FIXUP_ACT_PROBE) 6673a00c660STakashi Iwai return; 6683a00c660STakashi Iwai 6693a00c660STakashi Iwai spec->gen.mic_autoswitch_hook = olpc_xo_automic; 6703a00c660STakashi Iwai spec->gen.pcm_capture_hook = olpc_xo_capture_hook; 6713a00c660STakashi Iwai spec->dc_mode_path = snd_hda_add_new_path(codec, 0x1e, 0x14, 0); 6723a00c660STakashi Iwai 6733a00c660STakashi Iwai snd_hda_add_new_ctls(codec, olpc_xo_mixers); 6743a00c660STakashi Iwai 6753a00c660STakashi Iwai /* OLPC's microphone port is DC coupled for use with external sensors, 6763a00c660STakashi Iwai * therefore we use a 50% mic bias in order to center the input signal 6773a00c660STakashi Iwai * with the DC input range of the codec. 6783a00c660STakashi Iwai */ 6793a00c660STakashi Iwai snd_hda_codec_set_pin_target(codec, 0x1a, PIN_VREF50); 6803a00c660STakashi Iwai 6813a00c660STakashi Iwai /* override mic boost control */ 682a9c2dfc8STakashi Iwai snd_array_for_each(&spec->gen.kctls, i, kctl) { 6833a00c660STakashi Iwai if (!strcmp(kctl->name, "Mic Boost Volume")) { 6843a00c660STakashi Iwai kctl->put = olpc_xo_mic_boost_put; 6853a00c660STakashi Iwai break; 6863a00c660STakashi Iwai } 6873a00c660STakashi Iwai } 6883a00c660STakashi Iwai } 6893a00c660STakashi Iwai 6903542aed7STakashi Iwai static void cxt_fixup_mute_led_eapd(struct hda_codec *codec, 6913542aed7STakashi Iwai const struct hda_fixup *fix, int action) 6923542aed7STakashi Iwai { 6933542aed7STakashi Iwai struct conexant_spec *spec = codec->spec; 6943542aed7STakashi Iwai 6953542aed7STakashi Iwai if (action == HDA_FIXUP_ACT_PRE_PROBE) { 6963542aed7STakashi Iwai spec->mute_led_eapd = 0x1b; 697d15f7331SJiapeng Zhong spec->dynamic_eapd = true; 698929f718cSTakashi Iwai snd_hda_gen_add_mute_led_cdev(codec, cx_auto_vmaster_mute_led); 6993542aed7STakashi Iwai } 7003542aed7STakashi Iwai } 7013542aed7STakashi Iwai 702ad7725d3STakashi Iwai /* 703ad7725d3STakashi Iwai * Fix max input level on mixer widget to 0dB 704ad7725d3STakashi Iwai * (originally it has 0x2b steps with 0dB offset 0x14) 705ad7725d3STakashi Iwai */ 706ad7725d3STakashi Iwai static void cxt_fixup_cap_mix_amp(struct hda_codec *codec, 707ad7725d3STakashi Iwai const struct hda_fixup *fix, int action) 708ad7725d3STakashi Iwai { 709ad7725d3STakashi Iwai snd_hda_override_amp_caps(codec, 0x17, HDA_INPUT, 710ad7725d3STakashi Iwai (0x14 << AC_AMPCAP_OFFSET_SHIFT) | 711ad7725d3STakashi Iwai (0x14 << AC_AMPCAP_NUM_STEPS_SHIFT) | 712ad7725d3STakashi Iwai (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) | 713ad7725d3STakashi Iwai (1 << AC_AMPCAP_MUTE_SHIFT)); 714ad7725d3STakashi Iwai } 715e4c3bce2SDavid Henningsson 716ea30e7dfSTakashi Iwai /* 717ea30e7dfSTakashi Iwai * Fix max input level on mixer widget to 0dB 718ea30e7dfSTakashi Iwai * (originally it has 0x1e steps with 0 dB offset 0x17) 719ea30e7dfSTakashi Iwai */ 720ea30e7dfSTakashi Iwai static void cxt_fixup_cap_mix_amp_5047(struct hda_codec *codec, 721ea30e7dfSTakashi Iwai const struct hda_fixup *fix, int action) 722ea30e7dfSTakashi Iwai { 723ea30e7dfSTakashi Iwai snd_hda_override_amp_caps(codec, 0x10, HDA_INPUT, 724ea30e7dfSTakashi Iwai (0x17 << AC_AMPCAP_OFFSET_SHIFT) | 725ea30e7dfSTakashi Iwai (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) | 726ea30e7dfSTakashi Iwai (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) | 727ea30e7dfSTakashi Iwai (1 << AC_AMPCAP_MUTE_SHIFT)); 728ea30e7dfSTakashi Iwai } 729ea30e7dfSTakashi Iwai 730f73cd43aSTakashi Iwai static void cxt_fixup_hp_gate_mic_jack(struct hda_codec *codec, 731f73cd43aSTakashi Iwai const struct hda_fixup *fix, 732f73cd43aSTakashi Iwai int action) 733f73cd43aSTakashi Iwai { 734f73cd43aSTakashi Iwai /* the mic pin (0x19) doesn't give an unsolicited event; 735f73cd43aSTakashi Iwai * probe the mic pin together with the headphone pin (0x16) 736f73cd43aSTakashi Iwai */ 737f73cd43aSTakashi Iwai if (action == HDA_FIXUP_ACT_PROBE) 738f73cd43aSTakashi Iwai snd_hda_jack_set_gating_jack(codec, 0x19, 0x16); 739f73cd43aSTakashi Iwai } 740f73cd43aSTakashi Iwai 7415cd5b1bdSJerónimo Borque /* update LED status via GPIO */ 7425cd5b1bdSJerónimo Borque static void cxt_update_gpio_led(struct hda_codec *codec, unsigned int mask, 743f9ef724dSJeronimo Borque bool led_on) 7445cd5b1bdSJerónimo Borque { 7455cd5b1bdSJerónimo Borque struct conexant_spec *spec = codec->spec; 7465cd5b1bdSJerónimo Borque unsigned int oldval = spec->gpio_led; 7475cd5b1bdSJerónimo Borque 7485cd5b1bdSJerónimo Borque if (spec->mute_led_polarity) 749f9ef724dSJeronimo Borque led_on = !led_on; 7505cd5b1bdSJerónimo Borque 751f9ef724dSJeronimo Borque if (led_on) 7525cd5b1bdSJerónimo Borque spec->gpio_led |= mask; 753f9ef724dSJeronimo Borque else 754f9ef724dSJeronimo Borque spec->gpio_led &= ~mask; 755f9ef724dSJeronimo Borque codec_dbg(codec, "mask:%d enabled:%d gpio_led:%d\n", 756f9ef724dSJeronimo Borque mask, led_on, spec->gpio_led); 7575cd5b1bdSJerónimo Borque if (spec->gpio_led != oldval) 7585cd5b1bdSJerónimo Borque snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 7595cd5b1bdSJerónimo Borque spec->gpio_led); 7605cd5b1bdSJerónimo Borque } 7615cd5b1bdSJerónimo Borque 7625cd5b1bdSJerónimo Borque /* turn on/off mute LED via GPIO per vmaster hook */ 763929f718cSTakashi Iwai static int cxt_gpio_mute_update(struct led_classdev *led_cdev, 764929f718cSTakashi Iwai enum led_brightness brightness) 7655cd5b1bdSJerónimo Borque { 766929f718cSTakashi Iwai struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); 7675cd5b1bdSJerónimo Borque struct conexant_spec *spec = codec->spec; 768929f718cSTakashi Iwai 769929f718cSTakashi Iwai cxt_update_gpio_led(codec, spec->gpio_mute_led_mask, brightness); 770929f718cSTakashi Iwai return 0; 7715cd5b1bdSJerónimo Borque } 7725cd5b1bdSJerónimo Borque 7735cd5b1bdSJerónimo Borque /* turn on/off mic-mute LED via GPIO per capture hook */ 774e65a2cafSTakashi Iwai static int cxt_gpio_micmute_update(struct led_classdev *led_cdev, 775e65a2cafSTakashi Iwai enum led_brightness brightness) 7765cd5b1bdSJerónimo Borque { 777e65a2cafSTakashi Iwai struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); 7785cd5b1bdSJerónimo Borque struct conexant_spec *spec = codec->spec; 7795cd5b1bdSJerónimo Borque 780e65a2cafSTakashi Iwai cxt_update_gpio_led(codec, spec->gpio_mic_led_mask, brightness); 781e65a2cafSTakashi Iwai return 0; 7825cd5b1bdSJerónimo Borque } 7835cd5b1bdSJerónimo Borque 78456b26497STakashi Iwai static void cxt_setup_mute_led(struct hda_codec *codec, 78556b26497STakashi Iwai unsigned int mute, unsigned int mic_mute) 78656b26497STakashi Iwai { 78756b26497STakashi Iwai struct conexant_spec *spec = codec->spec; 78856b26497STakashi Iwai 78956b26497STakashi Iwai spec->gpio_led = 0; 79056b26497STakashi Iwai spec->mute_led_polarity = 0; 79156b26497STakashi Iwai if (mute) { 79256b26497STakashi Iwai snd_hda_gen_add_mute_led_cdev(codec, cxt_gpio_mute_update); 79356b26497STakashi Iwai spec->gpio_mute_led_mask = mute; 79456b26497STakashi Iwai } 79556b26497STakashi Iwai if (mic_mute) { 79656b26497STakashi Iwai snd_hda_gen_add_micmute_led_cdev(codec, cxt_gpio_micmute_update); 79756b26497STakashi Iwai spec->gpio_mic_led_mask = mic_mute; 79856b26497STakashi Iwai } 79956b26497STakashi Iwai } 8005cd5b1bdSJerónimo Borque 8015cd5b1bdSJerónimo Borque static void cxt_fixup_mute_led_gpio(struct hda_codec *codec, 8025cd5b1bdSJerónimo Borque const struct hda_fixup *fix, int action) 8035cd5b1bdSJerónimo Borque { 80456b26497STakashi Iwai if (action == HDA_FIXUP_ACT_PRE_PROBE) 80556b26497STakashi Iwai cxt_setup_mute_led(codec, 0x01, 0x02); 8065cd5b1bdSJerónimo Borque } 8075cd5b1bdSJerónimo Borque 80856b26497STakashi Iwai static void cxt_fixup_hp_zbook_mute_led(struct hda_codec *codec, 80956b26497STakashi Iwai const struct hda_fixup *fix, int action) 81056b26497STakashi Iwai { 81156b26497STakashi Iwai if (action == HDA_FIXUP_ACT_PRE_PROBE) 81256b26497STakashi Iwai cxt_setup_mute_led(codec, 0x10, 0x20); 81356b26497STakashi Iwai } 8145cd5b1bdSJerónimo Borque 815d70f3632STakashi Iwai /* ThinkPad X200 & co with cxt5051 */ 81623d30f28STakashi Iwai static const struct hda_pintbl cxt_pincfg_lenovo_x200[] = { 817e92d4b08STakashi Iwai { 0x16, 0x042140ff }, /* HP (seq# overridden) */ 818e92d4b08STakashi Iwai { 0x17, 0x21a11000 }, /* dock-mic */ 819e92d4b08STakashi Iwai { 0x19, 0x2121103f }, /* dock-HP */ 8203e93f5efSTakashi Iwai { 0x1c, 0x21440100 }, /* dock SPDIF out */ 821e92d4b08STakashi Iwai {} 822e92d4b08STakashi Iwai }; 823e92d4b08STakashi Iwai 824d70f3632STakashi Iwai /* ThinkPad 410/420/510/520, X201 & co with cxt5066 */ 82523d30f28STakashi Iwai static const struct hda_pintbl cxt_pincfg_lenovo_tp410[] = { 826d70f3632STakashi Iwai { 0x19, 0x042110ff }, /* HP (seq# overridden) */ 827d70f3632STakashi Iwai { 0x1a, 0x21a190f0 }, /* dock-mic */ 828d70f3632STakashi Iwai { 0x1c, 0x212140ff }, /* dock-HP */ 829d70f3632STakashi Iwai {} 830e92d4b08STakashi Iwai }; 831e92d4b08STakashi Iwai 832239fb862SHuacai Chen /* Lemote A1004/A1205 with cxt5066 */ 833239fb862SHuacai Chen static const struct hda_pintbl cxt_pincfg_lemote[] = { 834239fb862SHuacai Chen { 0x1a, 0x90a10020 }, /* Internal mic */ 835239fb862SHuacai Chen { 0x1b, 0x03a11020 }, /* External mic */ 836239fb862SHuacai Chen { 0x1d, 0x400101f0 }, /* Not used */ 837239fb862SHuacai Chen { 0x1e, 0x40a701f0 }, /* Not used */ 838239fb862SHuacai Chen { 0x20, 0x404501f0 }, /* Not used */ 839239fb862SHuacai Chen { 0x22, 0x404401f0 }, /* Not used */ 840239fb862SHuacai Chen { 0x23, 0x40a701f0 }, /* Not used */ 841239fb862SHuacai Chen {} 842239fb862SHuacai Chen }; 843239fb862SHuacai Chen 84423d30f28STakashi Iwai static const struct hda_fixup cxt_fixups[] = { 84523d30f28STakashi Iwai [CXT_PINCFG_LENOVO_X200] = { 84623d30f28STakashi Iwai .type = HDA_FIXUP_PINS, 84723d30f28STakashi Iwai .v.pins = cxt_pincfg_lenovo_x200, 84823d30f28STakashi Iwai }, 84923d30f28STakashi Iwai [CXT_PINCFG_LENOVO_TP410] = { 85023d30f28STakashi Iwai .type = HDA_FIXUP_PINS, 85123d30f28STakashi Iwai .v.pins = cxt_pincfg_lenovo_tp410, 85208cf680cSDavid Henningsson .chained = true, 85308cf680cSDavid Henningsson .chain_id = CXT_FIXUP_THINKPAD_ACPI, 85423d30f28STakashi Iwai }, 855239fb862SHuacai Chen [CXT_PINCFG_LEMOTE_A1004] = { 856239fb862SHuacai Chen .type = HDA_FIXUP_PINS, 857239fb862SHuacai Chen .chained = true, 858239fb862SHuacai Chen .chain_id = CXT_FIXUP_INC_MIC_BOOST, 859239fb862SHuacai Chen .v.pins = cxt_pincfg_lemote, 860239fb862SHuacai Chen }, 861239fb862SHuacai Chen [CXT_PINCFG_LEMOTE_A1205] = { 862239fb862SHuacai Chen .type = HDA_FIXUP_PINS, 863239fb862SHuacai Chen .v.pins = cxt_pincfg_lemote, 864239fb862SHuacai Chen }, 865ddb6ca75STakashi Iwai [CXT_PINCFG_COMPAQ_CQ60] = { 866ddb6ca75STakashi Iwai .type = HDA_FIXUP_PINS, 867ddb6ca75STakashi Iwai .v.pins = (const struct hda_pintbl[]) { 868ddb6ca75STakashi Iwai /* 0x17 was falsely set up as a mic, it should 0x1d */ 869ddb6ca75STakashi Iwai { 0x17, 0x400001f0 }, 870ddb6ca75STakashi Iwai { 0x1d, 0x97a70120 }, 871ddb6ca75STakashi Iwai { } 872ddb6ca75STakashi Iwai } 873ddb6ca75STakashi Iwai }, 87423d30f28STakashi Iwai [CXT_FIXUP_STEREO_DMIC] = { 87523d30f28STakashi Iwai .type = HDA_FIXUP_FUNC, 87623d30f28STakashi Iwai .v.func = cxt_fixup_stereo_dmic, 87723d30f28STakashi Iwai }, 878f83bb259SMeng Tang [CXT_PINCFG_LENOVO_NOTEBOOK] = { 879f83bb259SMeng Tang .type = HDA_FIXUP_PINS, 880f83bb259SMeng Tang .v.pins = (const struct hda_pintbl[]) { 881f83bb259SMeng Tang { 0x1a, 0x05d71030 }, 882f83bb259SMeng Tang { } 883f83bb259SMeng Tang }, 884f83bb259SMeng Tang .chain_id = CXT_FIXUP_STEREO_DMIC, 885f83bb259SMeng Tang }, 886239fb862SHuacai Chen [CXT_FIXUP_INC_MIC_BOOST] = { 887239fb862SHuacai Chen .type = HDA_FIXUP_FUNC, 888239fb862SHuacai Chen .v.func = cxt5066_increase_mic_boost, 889239fb862SHuacai Chen }, 890e4c3bce2SDavid Henningsson [CXT_FIXUP_HEADPHONE_MIC_PIN] = { 891e4c3bce2SDavid Henningsson .type = HDA_FIXUP_PINS, 892e4c3bce2SDavid Henningsson .chained = true, 893e4c3bce2SDavid Henningsson .chain_id = CXT_FIXUP_HEADPHONE_MIC, 894e4c3bce2SDavid Henningsson .v.pins = (const struct hda_pintbl[]) { 895e4c3bce2SDavid Henningsson { 0x18, 0x03a1913d }, /* use as headphone mic, without its own jack detect */ 896e4c3bce2SDavid Henningsson { } 897e4c3bce2SDavid Henningsson } 898e4c3bce2SDavid Henningsson }, 899e4c3bce2SDavid Henningsson [CXT_FIXUP_HEADPHONE_MIC] = { 900e4c3bce2SDavid Henningsson .type = HDA_FIXUP_FUNC, 901e4c3bce2SDavid Henningsson .v.func = cxt_fixup_headphone_mic, 902e4c3bce2SDavid Henningsson }, 9034a437044STakashi Iwai [CXT_FIXUP_GPIO1] = { 9044a437044STakashi Iwai .type = HDA_FIXUP_VERBS, 9054a437044STakashi Iwai .v.verbs = (const struct hda_verb[]) { 9064a437044STakashi Iwai { 0x01, AC_VERB_SET_GPIO_MASK, 0x01 }, 9074a437044STakashi Iwai { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01 }, 9084a437044STakashi Iwai { 0x01, AC_VERB_SET_GPIO_DATA, 0x01 }, 9094a437044STakashi Iwai { } 9104a437044STakashi Iwai }, 9114a437044STakashi Iwai }, 912ff50479aSTakashi Iwai [CXT_FIXUP_ASPIRE_DMIC] = { 913ff50479aSTakashi Iwai .type = HDA_FIXUP_FUNC, 914ff50479aSTakashi Iwai .v.func = cxt_fixup_stereo_dmic, 915ff50479aSTakashi Iwai .chained = true, 916ff50479aSTakashi Iwai .chain_id = CXT_FIXUP_GPIO1, 917ff50479aSTakashi Iwai }, 91808cf680cSDavid Henningsson [CXT_FIXUP_THINKPAD_ACPI] = { 91908cf680cSDavid Henningsson .type = HDA_FIXUP_FUNC, 920b317b032STakashi Iwai .v.func = hda_fixup_thinkpad_acpi, 92108cf680cSDavid Henningsson }, 9223a00c660STakashi Iwai [CXT_FIXUP_OLPC_XO] = { 9233a00c660STakashi Iwai .type = HDA_FIXUP_FUNC, 9243a00c660STakashi Iwai .v.func = cxt_fixup_olpc_xo, 9253a00c660STakashi Iwai }, 926ad7725d3STakashi Iwai [CXT_FIXUP_CAP_MIX_AMP] = { 927ad7725d3STakashi Iwai .type = HDA_FIXUP_FUNC, 928ad7725d3STakashi Iwai .v.func = cxt_fixup_cap_mix_amp, 929ad7725d3STakashi Iwai }, 9306dcbadefSTakashi Iwai [CXT_FIXUP_TOSHIBA_P105] = { 9316dcbadefSTakashi Iwai .type = HDA_FIXUP_PINS, 9326dcbadefSTakashi Iwai .v.pins = (const struct hda_pintbl[]) { 9336dcbadefSTakashi Iwai { 0x10, 0x961701f0 }, /* speaker/hp */ 9346dcbadefSTakashi Iwai { 0x12, 0x02a1901e }, /* ext mic */ 9356dcbadefSTakashi Iwai { 0x14, 0x95a70110 }, /* int mic */ 9366dcbadefSTakashi Iwai {} 9376dcbadefSTakashi Iwai }, 9386dcbadefSTakashi Iwai }, 939e5eac90dSTakashi Iwai [CXT_FIXUP_HP_530] = { 940e5eac90dSTakashi Iwai .type = HDA_FIXUP_PINS, 941e5eac90dSTakashi Iwai .v.pins = (const struct hda_pintbl[]) { 942e5eac90dSTakashi Iwai { 0x12, 0x90a60160 }, /* int mic */ 943e5eac90dSTakashi Iwai {} 944e5eac90dSTakashi Iwai }, 945e5eac90dSTakashi Iwai .chained = true, 946e5eac90dSTakashi Iwai .chain_id = CXT_FIXUP_CAP_MIX_AMP, 947e5eac90dSTakashi Iwai }, 948ea30e7dfSTakashi Iwai [CXT_FIXUP_CAP_MIX_AMP_5047] = { 949ea30e7dfSTakashi Iwai .type = HDA_FIXUP_FUNC, 950ea30e7dfSTakashi Iwai .v.func = cxt_fixup_cap_mix_amp_5047, 951ea30e7dfSTakashi Iwai }, 9523542aed7STakashi Iwai [CXT_FIXUP_MUTE_LED_EAPD] = { 9533542aed7STakashi Iwai .type = HDA_FIXUP_FUNC, 9543542aed7STakashi Iwai .v.func = cxt_fixup_mute_led_eapd, 9553542aed7STakashi Iwai }, 956cc3a47a2SJaroslav Kysela [CXT_FIXUP_HP_DOCK] = { 957cc3a47a2SJaroslav Kysela .type = HDA_FIXUP_PINS, 958cc3a47a2SJaroslav Kysela .v.pins = (const struct hda_pintbl[]) { 959cc3a47a2SJaroslav Kysela { 0x16, 0x21011020 }, /* line-out */ 960cc3a47a2SJaroslav Kysela { 0x18, 0x2181103f }, /* line-in */ 961cc3a47a2SJaroslav Kysela { } 962c3123d6aSFlorin Tudorache }, 963c3123d6aSFlorin Tudorache .chained = true, 964c3123d6aSFlorin Tudorache .chain_id = CXT_FIXUP_MUTE_LED_GPIO, 965cc3a47a2SJaroslav Kysela }, 9660eec8809STakashi Iwai [CXT_FIXUP_HP_SPECTRE] = { 9670eec8809STakashi Iwai .type = HDA_FIXUP_PINS, 9680eec8809STakashi Iwai .v.pins = (const struct hda_pintbl[]) { 9690eec8809STakashi Iwai /* enable NID 0x1d for the speaker on top */ 9700eec8809STakashi Iwai { 0x1d, 0x91170111 }, 9710eec8809STakashi Iwai { } 9720eec8809STakashi Iwai } 9730eec8809STakashi Iwai }, 974f73cd43aSTakashi Iwai [CXT_FIXUP_HP_GATE_MIC] = { 975f73cd43aSTakashi Iwai .type = HDA_FIXUP_FUNC, 976f73cd43aSTakashi Iwai .v.func = cxt_fixup_hp_gate_mic_jack, 977f73cd43aSTakashi Iwai }, 9785cd5b1bdSJerónimo Borque [CXT_FIXUP_MUTE_LED_GPIO] = { 9795cd5b1bdSJerónimo Borque .type = HDA_FIXUP_FUNC, 9805cd5b1bdSJerónimo Borque .v.func = cxt_fixup_mute_led_gpio, 9815cd5b1bdSJerónimo Borque }, 98256b26497STakashi Iwai [CXT_FIXUP_HP_ZBOOK_MUTE_LED] = { 98356b26497STakashi Iwai .type = HDA_FIXUP_FUNC, 98456b26497STakashi Iwai .v.func = cxt_fixup_hp_zbook_mute_led, 98556b26497STakashi Iwai }, 986322f74edSHui Wang [CXT_FIXUP_HEADSET_MIC] = { 987322f74edSHui Wang .type = HDA_FIXUP_FUNC, 988322f74edSHui Wang .v.func = cxt_fixup_headset_mic, 989322f74edSHui Wang }, 990322f74edSHui Wang [CXT_FIXUP_HP_MIC_NO_PRESENCE] = { 991322f74edSHui Wang .type = HDA_FIXUP_PINS, 992322f74edSHui Wang .v.pins = (const struct hda_pintbl[]) { 993322f74edSHui Wang { 0x1a, 0x02a1113c }, 994322f74edSHui Wang { } 995322f74edSHui Wang }, 996322f74edSHui Wang .chained = true, 997322f74edSHui Wang .chain_id = CXT_FIXUP_HEADSET_MIC, 998322f74edSHui Wang }, 999ad7725d3STakashi Iwai }; 1000ad7725d3STakashi Iwai 1001ad7725d3STakashi Iwai static const struct snd_pci_quirk cxt5045_fixups[] = { 1002e5eac90dSTakashi Iwai SND_PCI_QUIRK(0x103c, 0x30d5, "HP 530", CXT_FIXUP_HP_530), 10036dcbadefSTakashi Iwai SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba P105", CXT_FIXUP_TOSHIBA_P105), 1004ad7725d3STakashi Iwai /* HP, Packard Bell, Fujitsu-Siemens & Lenovo laptops have 1005ad7725d3STakashi Iwai * really bad sound over 0dB on NID 0x17. 1006ad7725d3STakashi Iwai */ 1007ad7725d3STakashi Iwai SND_PCI_QUIRK_VENDOR(0x103c, "HP", CXT_FIXUP_CAP_MIX_AMP), 1008ad7725d3STakashi Iwai SND_PCI_QUIRK_VENDOR(0x1631, "Packard Bell", CXT_FIXUP_CAP_MIX_AMP), 1009ad7725d3STakashi Iwai SND_PCI_QUIRK_VENDOR(0x1734, "Fujitsu", CXT_FIXUP_CAP_MIX_AMP), 1010ad7725d3STakashi Iwai SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", CXT_FIXUP_CAP_MIX_AMP), 1011ad7725d3STakashi Iwai {} 1012ad7725d3STakashi Iwai }; 1013ad7725d3STakashi Iwai 1014ad7725d3STakashi Iwai static const struct hda_model_fixup cxt5045_fixup_models[] = { 1015ad7725d3STakashi Iwai { .id = CXT_FIXUP_CAP_MIX_AMP, .name = "cap-mix-amp" }, 10166dcbadefSTakashi Iwai { .id = CXT_FIXUP_TOSHIBA_P105, .name = "toshiba-p105" }, 1017e5eac90dSTakashi Iwai { .id = CXT_FIXUP_HP_530, .name = "hp-530" }, 1018ad7725d3STakashi Iwai {} 1019e92d4b08STakashi Iwai }; 1020e92d4b08STakashi Iwai 1021ea30e7dfSTakashi Iwai static const struct snd_pci_quirk cxt5047_fixups[] = { 1022ea30e7dfSTakashi Iwai /* HP laptops have really bad sound over 0 dB on NID 0x10. 1023ea30e7dfSTakashi Iwai */ 1024ea30e7dfSTakashi Iwai SND_PCI_QUIRK_VENDOR(0x103c, "HP", CXT_FIXUP_CAP_MIX_AMP_5047), 1025ea30e7dfSTakashi Iwai {} 1026ea30e7dfSTakashi Iwai }; 1027ea30e7dfSTakashi Iwai 1028ea30e7dfSTakashi Iwai static const struct hda_model_fixup cxt5047_fixup_models[] = { 1029ea30e7dfSTakashi Iwai { .id = CXT_FIXUP_CAP_MIX_AMP_5047, .name = "cap-mix-amp" }, 1030ea30e7dfSTakashi Iwai {} 1031ea30e7dfSTakashi Iwai }; 1032ea30e7dfSTakashi Iwai 1033d70f3632STakashi Iwai static const struct snd_pci_quirk cxt5051_fixups[] = { 1034ddb6ca75STakashi Iwai SND_PCI_QUIRK(0x103c, 0x360b, "Compaq CQ60", CXT_PINCFG_COMPAQ_CQ60), 1035e92d4b08STakashi Iwai SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo X200", CXT_PINCFG_LENOVO_X200), 1036e92d4b08STakashi Iwai {} 1037e92d4b08STakashi Iwai }; 1038e92d4b08STakashi Iwai 1039a2dd933dSTakashi Iwai static const struct hda_model_fixup cxt5051_fixup_models[] = { 1040a2dd933dSTakashi Iwai { .id = CXT_PINCFG_LENOVO_X200, .name = "lenovo-x200" }, 1041a2dd933dSTakashi Iwai {} 1042a2dd933dSTakashi Iwai }; 1043a2dd933dSTakashi Iwai 1044d70f3632STakashi Iwai static const struct snd_pci_quirk cxt5066_fixups[] = { 104563a077e2STakashi Iwai SND_PCI_QUIRK(0x1025, 0x0543, "Acer Aspire One 522", CXT_FIXUP_STEREO_DMIC), 1046ff50479aSTakashi Iwai SND_PCI_QUIRK(0x1025, 0x054c, "Acer Aspire 3830TG", CXT_FIXUP_ASPIRE_DMIC), 1047522a7fa8SDavid Henningsson SND_PCI_QUIRK(0x1025, 0x054f, "Acer Aspire 4830T", CXT_FIXUP_ASPIRE_DMIC), 1048cc3a47a2SJaroslav Kysela SND_PCI_QUIRK(0x103c, 0x8079, "HP EliteBook 840 G3", CXT_FIXUP_HP_DOCK), 1049aea80817SDennis Wassenberg SND_PCI_QUIRK(0x103c, 0x807C, "HP EliteBook 820 G3", CXT_FIXUP_HP_DOCK), 1050099fd6caSDennis Wassenberg SND_PCI_QUIRK(0x103c, 0x80FD, "HP ProBook 640 G2", CXT_FIXUP_HP_DOCK), 10512e6a7312STakashi Iwai SND_PCI_QUIRK(0x103c, 0x8115, "HP Z1 Gen3", CXT_FIXUP_HP_GATE_MIC), 10522e6a7312STakashi Iwai SND_PCI_QUIRK(0x103c, 0x814f, "HP ZBook 15u G3", CXT_FIXUP_MUTE_LED_GPIO), 10532e6a7312STakashi Iwai SND_PCI_QUIRK(0x103c, 0x8174, "HP Spectre x360", CXT_FIXUP_HP_SPECTRE), 10542e6a7312STakashi Iwai SND_PCI_QUIRK(0x103c, 0x822e, "HP ProBook 440 G4", CXT_FIXUP_MUTE_LED_GPIO), 105540906ebeSMantas Mikulėnas SND_PCI_QUIRK(0x103c, 0x828c, "HP EliteBook 840 G4", CXT_FIXUP_HP_DOCK), 10562e6a7312STakashi Iwai SND_PCI_QUIRK(0x103c, 0x8299, "HP 800 G3 SFF", CXT_FIXUP_HP_MIC_NO_PRESENCE), 10572e6a7312STakashi Iwai SND_PCI_QUIRK(0x103c, 0x829a, "HP 800 G3 DM", CXT_FIXUP_HP_MIC_NO_PRESENCE), 1058d16d69bfSMeng Tang SND_PCI_QUIRK(0x103c, 0x82b4, "HP ProDesk 600 G3", CXT_FIXUP_HP_MIC_NO_PRESENCE), 10592e6a7312STakashi Iwai SND_PCI_QUIRK(0x103c, 0x836e, "HP ProBook 455 G5", CXT_FIXUP_MUTE_LED_GPIO), 10602e6a7312STakashi Iwai SND_PCI_QUIRK(0x103c, 0x837f, "HP ProBook 470 G5", CXT_FIXUP_MUTE_LED_GPIO), 10614cd3016cSJurica Vukadin SND_PCI_QUIRK(0x103c, 0x83b2, "HP EliteBook 840 G5", CXT_FIXUP_HP_DOCK), 10622861751fSDennis Wassenberg SND_PCI_QUIRK(0x103c, 0x83b3, "HP EliteBook 830 G5", CXT_FIXUP_HP_DOCK), 10637eef32c1SDennis Wassenberg SND_PCI_QUIRK(0x103c, 0x83d3, "HP ProBook 640 G4", CXT_FIXUP_HP_DOCK), 1064e190de69SKai-Heng Feng SND_PCI_QUIRK(0x103c, 0x8402, "HP ProBook 645 G4", CXT_FIXUP_MUTE_LED_GPIO), 106556b26497STakashi Iwai SND_PCI_QUIRK(0x103c, 0x8427, "HP ZBook Studio G5", CXT_FIXUP_HP_ZBOOK_MUTE_LED), 1066c6423ed2STakashi Iwai SND_PCI_QUIRK(0x103c, 0x844f, "HP ZBook Studio G5", CXT_FIXUP_HP_ZBOOK_MUTE_LED), 1067f16041dfSTakashi Iwai SND_PCI_QUIRK(0x103c, 0x8455, "HP Z2 G4", CXT_FIXUP_HP_MIC_NO_PRESENCE), 1068167897f4SJaroslav Kysela SND_PCI_QUIRK(0x103c, 0x8456, "HP Z2 G4 SFF", CXT_FIXUP_HP_MIC_NO_PRESENCE), 1069167897f4SJaroslav Kysela SND_PCI_QUIRK(0x103c, 0x8457, "HP Z2 G4 mini", CXT_FIXUP_HP_MIC_NO_PRESENCE), 1070167897f4SJaroslav Kysela SND_PCI_QUIRK(0x103c, 0x8458, "HP Z2 G4 mini premium", CXT_FIXUP_HP_MIC_NO_PRESENCE), 1071e4c3bce2SDavid Henningsson SND_PCI_QUIRK(0x1043, 0x138d, "Asus", CXT_FIXUP_HEADPHONE_MIC_PIN), 10723a00c660STakashi Iwai SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT_FIXUP_OLPC_XO), 1073d70f3632STakashi Iwai SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410), 1074d70f3632STakashi Iwai SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo T410", CXT_PINCFG_LENOVO_TP410), 1075d70f3632STakashi Iwai SND_PCI_QUIRK(0x17aa, 0x215f, "Lenovo T510", CXT_PINCFG_LENOVO_TP410), 1076d70f3632STakashi Iwai SND_PCI_QUIRK(0x17aa, 0x21ce, "Lenovo T420", CXT_PINCFG_LENOVO_TP410), 1077d70f3632STakashi Iwai SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520", CXT_PINCFG_LENOVO_TP410), 1078ef7d84caSPeter Große SND_PCI_QUIRK(0x17aa, 0x21d2, "Lenovo T420s", CXT_PINCFG_LENOVO_TP410), 1079a555bb8cSDavid Henningsson SND_PCI_QUIRK(0x17aa, 0x21da, "Lenovo X220", CXT_PINCFG_LENOVO_TP410), 108088d57606SDavid Henningsson SND_PCI_QUIRK(0x17aa, 0x21db, "Lenovo X220-tablet", CXT_PINCFG_LENOVO_TP410), 10813542aed7STakashi Iwai SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo IdeaPad Z560", CXT_FIXUP_MUTE_LED_EAPD), 1082e7bb6ad5SJeremy Cline SND_PCI_QUIRK(0x17aa, 0x3905, "Lenovo G50-30", CXT_FIXUP_STEREO_DMIC), 1083e8d65a8dSDavid Henningsson SND_PCI_QUIRK(0x17aa, 0x390b, "Lenovo G50-80", CXT_FIXUP_STEREO_DMIC), 108418dcd304SDavid Henningsson SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC), 1085b871cb97STakashi Iwai /* NOTE: we'd need to extend the quirk for 17aa:3977 as the same 1086b871cb97STakashi Iwai * PCI SSID is used on multiple Lenovo models 1087b871cb97STakashi Iwai */ 1088b871cb97STakashi Iwai SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMIC), 1089bbba6f9dSTakashi Iwai SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo G50-70", CXT_FIXUP_STEREO_DMIC), 1090b3c5dce8SDavid Henningsson SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC), 10912fd3f170SHui Wang SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", CXT_FIXUP_THINKPAD_ACPI), 1092239fb862SHuacai Chen SND_PCI_QUIRK(0x1c06, 0x2011, "Lemote A1004", CXT_PINCFG_LEMOTE_A1004), 1093239fb862SHuacai Chen SND_PCI_QUIRK(0x1c06, 0x2012, "Lemote A1205", CXT_PINCFG_LEMOTE_A1205), 1094f2e5731dSTakashi Iwai {} 1095f2e5731dSTakashi Iwai }; 1096f2e5731dSTakashi Iwai 1097a2dd933dSTakashi Iwai static const struct hda_model_fixup cxt5066_fixup_models[] = { 1098a2dd933dSTakashi Iwai { .id = CXT_FIXUP_STEREO_DMIC, .name = "stereo-dmic" }, 1099a2dd933dSTakashi Iwai { .id = CXT_FIXUP_GPIO1, .name = "gpio1" }, 1100a2dd933dSTakashi Iwai { .id = CXT_FIXUP_HEADPHONE_MIC_PIN, .name = "headphone-mic-pin" }, 1101a2dd933dSTakashi Iwai { .id = CXT_PINCFG_LENOVO_TP410, .name = "tp410" }, 1102a2dd933dSTakashi Iwai { .id = CXT_FIXUP_THINKPAD_ACPI, .name = "thinkpad" }, 1103a2dd933dSTakashi Iwai { .id = CXT_PINCFG_LEMOTE_A1004, .name = "lemote-a1004" }, 11048245b363SHuacai Chen { .id = CXT_PINCFG_LEMOTE_A1205, .name = "lemote-a1205" }, 11053a00c660STakashi Iwai { .id = CXT_FIXUP_OLPC_XO, .name = "olpc-xo" }, 11063542aed7STakashi Iwai { .id = CXT_FIXUP_MUTE_LED_EAPD, .name = "mute-led-eapd" }, 1107cc3a47a2SJaroslav Kysela { .id = CXT_FIXUP_HP_DOCK, .name = "hp-dock" }, 11085cd5b1bdSJerónimo Borque { .id = CXT_FIXUP_MUTE_LED_GPIO, .name = "mute-led-gpio" }, 110956b26497STakashi Iwai { .id = CXT_FIXUP_HP_ZBOOK_MUTE_LED, .name = "hp-zbook-mute-led" }, 111009b83d10STakashi Iwai { .id = CXT_FIXUP_HP_MIC_NO_PRESENCE, .name = "hp-mic-fix" }, 1111b871cb97STakashi Iwai { .id = CXT_PINCFG_LENOVO_NOTEBOOK, .name = "lenovo-20149" }, 1112a2dd933dSTakashi Iwai {} 1113a2dd933dSTakashi Iwai }; 1114a2dd933dSTakashi Iwai 11153868137eSTakashi Iwai /* add "fake" mute amp-caps to DACs on cx5051 so that mixer mute switches 11163868137eSTakashi Iwai * can be created (bko#42825) 11173868137eSTakashi Iwai */ 11183868137eSTakashi Iwai static void add_cx5051_fake_mutes(struct hda_codec *codec) 11193868137eSTakashi Iwai { 1120d89c6c0cSTakashi Iwai struct conexant_spec *spec = codec->spec; 1121caf3c043SMichał Mirosław static const hda_nid_t out_nids[] = { 11223868137eSTakashi Iwai 0x10, 0x11, 0 11233868137eSTakashi Iwai }; 1124caf3c043SMichał Mirosław const hda_nid_t *p; 11253868137eSTakashi Iwai 11263868137eSTakashi Iwai for (p = out_nids; *p; p++) 11273868137eSTakashi Iwai snd_hda_override_amp_caps(codec, *p, HDA_OUTPUT, 11283868137eSTakashi Iwai AC_AMPCAP_MIN_MUTE | 11293868137eSTakashi Iwai query_amp_caps(codec, *p, HDA_OUTPUT)); 1130d89c6c0cSTakashi Iwai spec->gen.dac_min_mute = true; 11313868137eSTakashi Iwai } 11323868137eSTakashi Iwai 1133f2e5731dSTakashi Iwai static int patch_conexant_auto(struct hda_codec *codec) 1134f2e5731dSTakashi Iwai { 1135f2e5731dSTakashi Iwai struct conexant_spec *spec; 1136f2e5731dSTakashi Iwai int err; 1137f2e5731dSTakashi Iwai 11387639a06cSTakashi Iwai codec_info(codec, "%s: BIOS auto-probing.\n", codec->core.chip_name); 11391f8458a2STakashi Iwai 1140f2e5731dSTakashi Iwai spec = kzalloc(sizeof(*spec), GFP_KERNEL); 1141f2e5731dSTakashi Iwai if (!spec) 1142f2e5731dSTakashi Iwai return -ENOMEM; 1143aed523f1STakashi Iwai snd_hda_gen_spec_init(&spec->gen); 1144f2e5731dSTakashi Iwai codec->spec = spec; 1145225068abSTakashi Iwai codec->patch_ops = cx_auto_patch_ops; 1146e92d4b08STakashi Iwai 1147*24d74841Sbo liu /* init cx8070/sn6140 flag and reset headset_present_flag */ 1148*24d74841Sbo liu switch (codec->core.vendor_id) { 1149*24d74841Sbo liu case 0x14f11f86: 1150*24d74841Sbo liu case 0x14f11f87: 1151*24d74841Sbo liu spec->is_cx8070_sn6140 = true; 1152*24d74841Sbo liu spec->headset_present_flag = CX_HEADSET_NOPRESENT; 1153*24d74841Sbo liu break; 1154*24d74841Sbo liu } 1155*24d74841Sbo liu 1156aed523f1STakashi Iwai cx_auto_parse_eapd(codec); 1157ff359b14STakashi Iwai spec->gen.own_eapd_ctl = 1; 1158e92d4b08STakashi Iwai 11597639a06cSTakashi Iwai switch (codec->core.vendor_id) { 11606b452142STakashi Iwai case 0x14f15045: 11614f32456eSMichael Karcher codec->single_adc_amp = 1; 116270540e24STakashi Iwai spec->gen.mixer_nid = 0x17; 116374f14b36STakashi Iwai spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO; 1164ad7725d3STakashi Iwai snd_hda_pick_fixup(codec, cxt5045_fixup_models, 1165ad7725d3STakashi Iwai cxt5045_fixups, cxt_fixups); 11666b452142STakashi Iwai break; 1167164a7adaSTakashi Iwai case 0x14f15047: 1168164a7adaSTakashi Iwai codec->pin_amp_workaround = 1; 1169164a7adaSTakashi Iwai spec->gen.mixer_nid = 0x19; 117074f14b36STakashi Iwai spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO; 1171ea30e7dfSTakashi Iwai snd_hda_pick_fixup(codec, cxt5047_fixup_models, 1172ea30e7dfSTakashi Iwai cxt5047_fixups, cxt_fixups); 1173164a7adaSTakashi Iwai break; 11743868137eSTakashi Iwai case 0x14f15051: 11753868137eSTakashi Iwai add_cx5051_fake_mutes(codec); 117651969d62SMichael Karcher codec->pin_amp_workaround = 1; 1177a2dd933dSTakashi Iwai snd_hda_pick_fixup(codec, cxt5051_fixup_models, 1178a2dd933dSTakashi Iwai cxt5051_fixups, cxt_fixups); 11793868137eSTakashi Iwai break; 1180d5ea7544Shuangwenhui case 0x14f15098: 1181d5ea7544Shuangwenhui codec->pin_amp_workaround = 1; 1182d5ea7544Shuangwenhui spec->gen.mixer_nid = 0x22; 1183d5ea7544Shuangwenhui spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO; 1184d5ea7544Shuangwenhui snd_hda_pick_fixup(codec, cxt5066_fixup_models, 1185d5ea7544Shuangwenhui cxt5066_fixups, cxt_fixups); 1186d5ea7544Shuangwenhui break; 1187b03d61d6SDavid Henningsson case 0x14f150f2: 1188b03d61d6SDavid Henningsson codec->power_save_node = 1; 1189c0dbbdadSGustavo A. R. Silva fallthrough; 119051969d62SMichael Karcher default: 119151969d62SMichael Karcher codec->pin_amp_workaround = 1; 1192a2dd933dSTakashi Iwai snd_hda_pick_fixup(codec, cxt5066_fixup_models, 1193a2dd933dSTakashi Iwai cxt5066_fixups, cxt_fixups); 119423d30f28STakashi Iwai break; 11956b452142STakashi Iwai } 11966b452142STakashi Iwai 1197929f718cSTakashi Iwai if (!spec->gen.vmaster_mute.hook && spec->dynamic_eapd) 1198929f718cSTakashi Iwai spec->gen.vmaster_mute.hook = cx_auto_vmaster_hook; 1199527c73baSTakashi Iwai 1200aed523f1STakashi Iwai snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); 1201aed523f1STakashi Iwai 1202e4c3bce2SDavid Henningsson err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL, 1203e4c3bce2SDavid Henningsson spec->parse_flags); 120422ce5f74STakashi Iwai if (err < 0) 1205aed523f1STakashi Iwai goto error; 1206aed523f1STakashi Iwai 12075faa0bc6STakashi Iwai err = cx_auto_parse_beep(codec); 1208aed523f1STakashi Iwai if (err < 0) 1209aed523f1STakashi Iwai goto error; 1210aed523f1STakashi Iwai 12115faa0bc6STakashi Iwai err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg); 121251e19ca5STakashi Iwai if (err < 0) 121351e19ca5STakashi Iwai goto error; 121451e19ca5STakashi Iwai 12154f2864a4STakashi Iwai /* Some laptops with Conexant chips show stalls in S3 resume, 12164f2864a4STakashi Iwai * which falls into the single-cmd mode. 12174f2864a4STakashi Iwai * Better to make reset, then. 12184f2864a4STakashi Iwai */ 1219d068ebc2STakashi Iwai if (!codec->bus->core.sync_write) { 12204e76a883STakashi Iwai codec_info(codec, 12214f2864a4STakashi Iwai "Enable sync_write for stable communication\n"); 1222d068ebc2STakashi Iwai codec->bus->core.sync_write = 1; 12234f2864a4STakashi Iwai codec->bus->allow_bus_reset = 1; 12244f2864a4STakashi Iwai } 12254f2864a4STakashi Iwai 1226e4c3bce2SDavid Henningsson snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); 1227e4c3bce2SDavid Henningsson 1228f2e5731dSTakashi Iwai return 0; 1229aed523f1STakashi Iwai 1230aed523f1STakashi Iwai error: 123108cf680cSDavid Henningsson cx_auto_free(codec); 1232aed523f1STakashi Iwai return err; 1233f2e5731dSTakashi Iwai } 1234f2e5731dSTakashi Iwai 1235f2e5731dSTakashi Iwai /* 1236461e2c78STakashi Iwai */ 1237461e2c78STakashi Iwai 1238b9a94a9cSTakashi Iwai static const struct hda_device_id snd_hda_id_conexant[] = { 12393f880949SHui Wang HDA_CODEC_ENTRY(0x14f11f86, "CX8070", patch_conexant_auto), 1240ca348e7fSbo liu HDA_CODEC_ENTRY(0x14f11f87, "SN6140", patch_conexant_auto), 1241bcdda2ecSTakashi Iwai HDA_CODEC_ENTRY(0x14f12008, "CX8200", patch_conexant_auto), 1242744a11abSbo liu HDA_CODEC_ENTRY(0x14f120d0, "CX11970", patch_conexant_auto), 124318d7e16cSBo Liu HDA_CODEC_ENTRY(0x14f120d1, "SN6180", patch_conexant_auto), 1244b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f15045, "CX20549 (Venice)", patch_conexant_auto), 1245b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f15047, "CX20551 (Waikiki)", patch_conexant_auto), 1246b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f15051, "CX20561 (Hermosa)", patch_conexant_auto), 1247b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f15066, "CX20582 (Pebble)", patch_conexant_auto), 1248b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f15067, "CX20583 (Pebble HSF)", patch_conexant_auto), 1249b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f15068, "CX20584", patch_conexant_auto), 1250b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f15069, "CX20585", patch_conexant_auto), 1251b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f1506c, "CX20588", patch_conexant_auto), 1252b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f1506e, "CX20590", patch_conexant_auto), 1253b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f15097, "CX20631", patch_conexant_auto), 1254b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f15098, "CX20632", patch_conexant_auto), 1255b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f150a1, "CX20641", patch_conexant_auto), 1256b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f150a2, "CX20642", patch_conexant_auto), 1257b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f150ab, "CX20651", patch_conexant_auto), 1258b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f150ac, "CX20652", patch_conexant_auto), 1259b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f150b8, "CX20664", patch_conexant_auto), 1260b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f150b9, "CX20665", patch_conexant_auto), 12613b7e2a7dSTakashi Iwai HDA_CODEC_ENTRY(0x14f150f1, "CX21722", patch_conexant_auto), 1262b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f150f2, "CX20722", patch_conexant_auto), 12633b7e2a7dSTakashi Iwai HDA_CODEC_ENTRY(0x14f150f3, "CX21724", patch_conexant_auto), 1264b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f150f4, "CX20724", patch_conexant_auto), 1265b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f1510f, "CX20751/2", patch_conexant_auto), 1266b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f15110, "CX20751/2", patch_conexant_auto), 1267b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f15111, "CX20753/4", patch_conexant_auto), 1268b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f15113, "CX20755", patch_conexant_auto), 1269b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f15114, "CX20756", patch_conexant_auto), 1270b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f15115, "CX20757", patch_conexant_auto), 1271b9a94a9cSTakashi Iwai HDA_CODEC_ENTRY(0x14f151d7, "CX20952", patch_conexant_auto), 1272c9b443d4STobin Davis {} /* terminator */ 1273c9b443d4STobin Davis }; 1274b9a94a9cSTakashi Iwai MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_conexant); 12751289e9e8STakashi Iwai 12761289e9e8STakashi Iwai MODULE_LICENSE("GPL"); 12771289e9e8STakashi Iwai MODULE_DESCRIPTION("Conexant HD-audio codec"); 12781289e9e8STakashi Iwai 1279d8a766a1STakashi Iwai static struct hda_codec_driver conexant_driver = { 1280b9a94a9cSTakashi Iwai .id = snd_hda_id_conexant, 12811289e9e8STakashi Iwai }; 12821289e9e8STakashi Iwai 1283d8a766a1STakashi Iwai module_hda_codec_driver(conexant_driver); 1284