1 /* 2 * HD audio interface patch for Conexant HDA audio codec 3 * 4 * Copyright (c) 2006 Pototskiy Akex <alex.pototskiy@gmail.com> 5 * Takashi Iwai <tiwai@suse.de> 6 * Tobin Davis <tdavis@dsl-only.net> 7 * 8 * This driver is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 2 of the License, or 11 * (at your option) any later version. 12 * 13 * This driver is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 */ 22 23 #include <linux/init.h> 24 #include <linux/delay.h> 25 #include <linux/slab.h> 26 #include <linux/module.h> 27 #include <sound/core.h> 28 #include <sound/jack.h> 29 30 #include "hda_codec.h" 31 #include "hda_local.h" 32 #include "hda_auto_parser.h" 33 #include "hda_beep.h" 34 #include "hda_jack.h" 35 #include "hda_generic.h" 36 37 struct conexant_spec { 38 struct hda_gen_spec gen; 39 40 /* extra EAPD pins */ 41 unsigned int num_eapds; 42 hda_nid_t eapds[4]; 43 bool dynamic_eapd; 44 hda_nid_t mute_led_eapd; 45 46 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */ 47 48 /* OPLC XO specific */ 49 bool recording; 50 bool dc_enable; 51 unsigned int dc_input_bias; /* offset into olpc_xo_dc_bias */ 52 struct nid_path *dc_mode_path; 53 54 int mute_led_polarity; 55 unsigned int gpio_led; 56 unsigned int gpio_mute_led_mask; 57 unsigned int gpio_mic_led_mask; 58 59 }; 60 61 62 #ifdef CONFIG_SND_HDA_INPUT_BEEP 63 /* additional beep mixers; private_value will be overwritten */ 64 static const struct snd_kcontrol_new cxt_beep_mixer[] = { 65 HDA_CODEC_VOLUME_MONO("Beep Playback Volume", 0, 1, 0, HDA_OUTPUT), 66 HDA_CODEC_MUTE_BEEP_MONO("Beep Playback Switch", 0, 1, 0, HDA_OUTPUT), 67 }; 68 69 static int set_beep_amp(struct conexant_spec *spec, hda_nid_t nid, 70 int idx, int dir) 71 { 72 struct snd_kcontrol_new *knew; 73 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 1, idx, dir); 74 int i; 75 76 spec->gen.beep_nid = nid; 77 for (i = 0; i < ARRAY_SIZE(cxt_beep_mixer); i++) { 78 knew = snd_hda_gen_add_kctl(&spec->gen, NULL, 79 &cxt_beep_mixer[i]); 80 if (!knew) 81 return -ENOMEM; 82 knew->private_value = beep_amp; 83 } 84 return 0; 85 } 86 87 static int cx_auto_parse_beep(struct hda_codec *codec) 88 { 89 struct conexant_spec *spec = codec->spec; 90 hda_nid_t nid; 91 92 for_each_hda_codec_node(nid, codec) 93 if (get_wcaps_type(get_wcaps(codec, nid)) == AC_WID_BEEP) 94 return set_beep_amp(spec, nid, 0, HDA_OUTPUT); 95 return 0; 96 } 97 #else 98 #define cx_auto_parse_beep(codec) 0 99 #endif 100 101 /* 102 * Automatic parser for CX20641 & co 103 */ 104 105 /* parse EAPDs */ 106 static void cx_auto_parse_eapd(struct hda_codec *codec) 107 { 108 struct conexant_spec *spec = codec->spec; 109 hda_nid_t nid; 110 111 for_each_hda_codec_node(nid, codec) { 112 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) 113 continue; 114 if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)) 115 continue; 116 spec->eapds[spec->num_eapds++] = nid; 117 if (spec->num_eapds >= ARRAY_SIZE(spec->eapds)) 118 break; 119 } 120 121 /* NOTE: below is a wild guess; if we have more than two EAPDs, 122 * it's a new chip, where EAPDs are supposed to be associated to 123 * pins, and we can control EAPD per pin. 124 * OTOH, if only one or two EAPDs are found, it's an old chip, 125 * thus it might control over all pins. 126 */ 127 if (spec->num_eapds > 2) 128 spec->dynamic_eapd = 1; 129 } 130 131 static void cx_auto_turn_eapd(struct hda_codec *codec, int num_pins, 132 hda_nid_t *pins, bool on) 133 { 134 int i; 135 for (i = 0; i < num_pins; i++) { 136 if (snd_hda_query_pin_caps(codec, pins[i]) & AC_PINCAP_EAPD) 137 snd_hda_codec_write(codec, pins[i], 0, 138 AC_VERB_SET_EAPD_BTLENABLE, 139 on ? 0x02 : 0); 140 } 141 } 142 143 /* turn on/off EAPD according to Master switch */ 144 static void cx_auto_vmaster_hook(void *private_data, int enabled) 145 { 146 struct hda_codec *codec = private_data; 147 struct conexant_spec *spec = codec->spec; 148 149 cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, enabled); 150 } 151 152 /* turn on/off EAPD according to Master switch (inversely!) for mute LED */ 153 static void cx_auto_vmaster_hook_mute_led(void *private_data, int enabled) 154 { 155 struct hda_codec *codec = private_data; 156 struct conexant_spec *spec = codec->spec; 157 158 snd_hda_codec_write(codec, spec->mute_led_eapd, 0, 159 AC_VERB_SET_EAPD_BTLENABLE, 160 enabled ? 0x00 : 0x02); 161 } 162 163 static int cx_auto_init(struct hda_codec *codec) 164 { 165 struct conexant_spec *spec = codec->spec; 166 snd_hda_gen_init(codec); 167 if (!spec->dynamic_eapd) 168 cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, true); 169 170 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT); 171 172 return 0; 173 } 174 175 static void cx_auto_reboot_notify(struct hda_codec *codec) 176 { 177 struct conexant_spec *spec = codec->spec; 178 179 switch (codec->core.vendor_id) { 180 case 0x14f150f2: /* CX20722 */ 181 case 0x14f150f4: /* CX20724 */ 182 break; 183 default: 184 return; 185 } 186 187 /* Turn the CX20722 codec into D3 to avoid spurious noises 188 from the internal speaker during (and after) reboot */ 189 cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, false); 190 191 snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3); 192 snd_hda_codec_write(codec, codec->core.afg, 0, 193 AC_VERB_SET_POWER_STATE, AC_PWRST_D3); 194 } 195 196 static void cx_auto_free(struct hda_codec *codec) 197 { 198 cx_auto_reboot_notify(codec); 199 snd_hda_gen_free(codec); 200 } 201 202 static const struct hda_codec_ops cx_auto_patch_ops = { 203 .build_controls = snd_hda_gen_build_controls, 204 .build_pcms = snd_hda_gen_build_pcms, 205 .init = cx_auto_init, 206 .reboot_notify = cx_auto_reboot_notify, 207 .free = cx_auto_free, 208 .unsol_event = snd_hda_jack_unsol_event, 209 #ifdef CONFIG_PM 210 .check_power_status = snd_hda_gen_check_power_status, 211 #endif 212 }; 213 214 /* 215 * pin fix-up 216 */ 217 enum { 218 CXT_PINCFG_LENOVO_X200, 219 CXT_PINCFG_LENOVO_TP410, 220 CXT_PINCFG_LEMOTE_A1004, 221 CXT_PINCFG_LEMOTE_A1205, 222 CXT_PINCFG_COMPAQ_CQ60, 223 CXT_FIXUP_STEREO_DMIC, 224 CXT_FIXUP_INC_MIC_BOOST, 225 CXT_FIXUP_HEADPHONE_MIC_PIN, 226 CXT_FIXUP_HEADPHONE_MIC, 227 CXT_FIXUP_GPIO1, 228 CXT_FIXUP_ASPIRE_DMIC, 229 CXT_FIXUP_THINKPAD_ACPI, 230 CXT_FIXUP_OLPC_XO, 231 CXT_FIXUP_CAP_MIX_AMP, 232 CXT_FIXUP_TOSHIBA_P105, 233 CXT_FIXUP_HP_530, 234 CXT_FIXUP_CAP_MIX_AMP_5047, 235 CXT_FIXUP_MUTE_LED_EAPD, 236 CXT_FIXUP_HP_DOCK, 237 CXT_FIXUP_HP_SPECTRE, 238 CXT_FIXUP_HP_GATE_MIC, 239 CXT_FIXUP_MUTE_LED_GPIO, 240 CXT_FIXUP_HEADSET_MIC, 241 CXT_FIXUP_HP_MIC_NO_PRESENCE, 242 }; 243 244 /* for hda_fixup_thinkpad_acpi() */ 245 #include "thinkpad_helper.c" 246 247 static void cxt_fixup_stereo_dmic(struct hda_codec *codec, 248 const struct hda_fixup *fix, int action) 249 { 250 struct conexant_spec *spec = codec->spec; 251 spec->gen.inv_dmic_split = 1; 252 } 253 254 static void cxt5066_increase_mic_boost(struct hda_codec *codec, 255 const struct hda_fixup *fix, int action) 256 { 257 if (action != HDA_FIXUP_ACT_PRE_PROBE) 258 return; 259 260 snd_hda_override_amp_caps(codec, 0x17, HDA_OUTPUT, 261 (0x3 << AC_AMPCAP_OFFSET_SHIFT) | 262 (0x4 << AC_AMPCAP_NUM_STEPS_SHIFT) | 263 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) | 264 (0 << AC_AMPCAP_MUTE_SHIFT)); 265 } 266 267 static void cxt_update_headset_mode(struct hda_codec *codec) 268 { 269 /* The verbs used in this function were tested on a Conexant CX20751/2 codec. */ 270 int i; 271 bool mic_mode = false; 272 struct conexant_spec *spec = codec->spec; 273 struct auto_pin_cfg *cfg = &spec->gen.autocfg; 274 275 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]]; 276 277 for (i = 0; i < cfg->num_inputs; i++) 278 if (cfg->inputs[i].pin == mux_pin) { 279 mic_mode = !!cfg->inputs[i].is_headphone_mic; 280 break; 281 } 282 283 if (mic_mode) { 284 snd_hda_codec_write_cache(codec, 0x1c, 0, 0x410, 0x7c); /* enable merged mode for analog int-mic */ 285 spec->gen.hp_jack_present = false; 286 } else { 287 snd_hda_codec_write_cache(codec, 0x1c, 0, 0x410, 0x54); /* disable merged mode for analog int-mic */ 288 spec->gen.hp_jack_present = snd_hda_jack_detect(codec, spec->gen.autocfg.hp_pins[0]); 289 } 290 291 snd_hda_gen_update_outputs(codec); 292 } 293 294 static void cxt_update_headset_mode_hook(struct hda_codec *codec, 295 struct snd_kcontrol *kcontrol, 296 struct snd_ctl_elem_value *ucontrol) 297 { 298 cxt_update_headset_mode(codec); 299 } 300 301 static void cxt_fixup_headphone_mic(struct hda_codec *codec, 302 const struct hda_fixup *fix, int action) 303 { 304 struct conexant_spec *spec = codec->spec; 305 306 switch (action) { 307 case HDA_FIXUP_ACT_PRE_PROBE: 308 spec->parse_flags |= HDA_PINCFG_HEADPHONE_MIC; 309 snd_hdac_regmap_add_vendor_verb(&codec->core, 0x410); 310 break; 311 case HDA_FIXUP_ACT_PROBE: 312 WARN_ON(spec->gen.cap_sync_hook); 313 spec->gen.cap_sync_hook = cxt_update_headset_mode_hook; 314 spec->gen.automute_hook = cxt_update_headset_mode; 315 break; 316 case HDA_FIXUP_ACT_INIT: 317 cxt_update_headset_mode(codec); 318 break; 319 } 320 } 321 322 static void cxt_fixup_headset_mic(struct hda_codec *codec, 323 const struct hda_fixup *fix, int action) 324 { 325 struct conexant_spec *spec = codec->spec; 326 327 switch (action) { 328 case HDA_FIXUP_ACT_PRE_PROBE: 329 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; 330 break; 331 } 332 } 333 334 /* OPLC XO 1.5 fixup */ 335 336 /* OLPC XO-1.5 supports DC input mode (e.g. for use with analog sensors) 337 * through the microphone jack. 338 * When the user enables this through a mixer switch, both internal and 339 * external microphones are disabled. Gain is fixed at 0dB. In this mode, 340 * we also allow the bias to be configured through a separate mixer 341 * control. */ 342 343 #define update_mic_pin(codec, nid, val) \ 344 snd_hda_codec_write_cache(codec, nid, 0, \ 345 AC_VERB_SET_PIN_WIDGET_CONTROL, val) 346 347 static const struct hda_input_mux olpc_xo_dc_bias = { 348 .num_items = 3, 349 .items = { 350 { "Off", PIN_IN }, 351 { "50%", PIN_VREF50 }, 352 { "80%", PIN_VREF80 }, 353 }, 354 }; 355 356 static void olpc_xo_update_mic_boost(struct hda_codec *codec) 357 { 358 struct conexant_spec *spec = codec->spec; 359 int ch, val; 360 361 for (ch = 0; ch < 2; ch++) { 362 val = AC_AMP_SET_OUTPUT | 363 (ch ? AC_AMP_SET_RIGHT : AC_AMP_SET_LEFT); 364 if (!spec->dc_enable) 365 val |= snd_hda_codec_amp_read(codec, 0x17, ch, HDA_OUTPUT, 0); 366 snd_hda_codec_write(codec, 0x17, 0, 367 AC_VERB_SET_AMP_GAIN_MUTE, val); 368 } 369 } 370 371 static void olpc_xo_update_mic_pins(struct hda_codec *codec) 372 { 373 struct conexant_spec *spec = codec->spec; 374 int cur_input, val; 375 struct nid_path *path; 376 377 cur_input = spec->gen.input_paths[0][spec->gen.cur_mux[0]]; 378 379 /* Set up mic pins for port-B, C and F dynamically as the recording 380 * LED is turned on/off by these pin controls 381 */ 382 if (!spec->dc_enable) { 383 /* disable DC bias path and pin for port F */ 384 update_mic_pin(codec, 0x1e, 0); 385 snd_hda_activate_path(codec, spec->dc_mode_path, false, false); 386 387 /* update port B (ext mic) and C (int mic) */ 388 /* OLPC defers mic widget control until when capture is 389 * started because the microphone LED comes on as soon as 390 * these settings are put in place. if we did this before 391 * recording, it would give the false indication that 392 * recording is happening when it is not. 393 */ 394 update_mic_pin(codec, 0x1a, spec->recording ? 395 snd_hda_codec_get_pin_target(codec, 0x1a) : 0); 396 update_mic_pin(codec, 0x1b, spec->recording ? 397 snd_hda_codec_get_pin_target(codec, 0x1b) : 0); 398 /* enable normal mic path */ 399 path = snd_hda_get_path_from_idx(codec, cur_input); 400 if (path) 401 snd_hda_activate_path(codec, path, true, false); 402 } else { 403 /* disable normal mic path */ 404 path = snd_hda_get_path_from_idx(codec, cur_input); 405 if (path) 406 snd_hda_activate_path(codec, path, false, false); 407 408 /* Even though port F is the DC input, the bias is controlled 409 * on port B. We also leave that port as an active input (but 410 * unselected) in DC mode just in case that is necessary to 411 * make the bias setting take effect. 412 */ 413 if (spec->recording) 414 val = olpc_xo_dc_bias.items[spec->dc_input_bias].index; 415 else 416 val = 0; 417 update_mic_pin(codec, 0x1a, val); 418 update_mic_pin(codec, 0x1b, 0); 419 /* enable DC bias path and pin */ 420 update_mic_pin(codec, 0x1e, spec->recording ? PIN_IN : 0); 421 snd_hda_activate_path(codec, spec->dc_mode_path, true, false); 422 } 423 } 424 425 /* mic_autoswitch hook */ 426 static void olpc_xo_automic(struct hda_codec *codec, 427 struct hda_jack_callback *jack) 428 { 429 struct conexant_spec *spec = codec->spec; 430 431 /* in DC mode, we don't handle automic */ 432 if (!spec->dc_enable) 433 snd_hda_gen_mic_autoswitch(codec, jack); 434 olpc_xo_update_mic_pins(codec); 435 if (spec->dc_enable) 436 olpc_xo_update_mic_boost(codec); 437 } 438 439 /* pcm_capture hook */ 440 static void olpc_xo_capture_hook(struct hda_pcm_stream *hinfo, 441 struct hda_codec *codec, 442 struct snd_pcm_substream *substream, 443 int action) 444 { 445 struct conexant_spec *spec = codec->spec; 446 447 /* toggle spec->recording flag and update mic pins accordingly 448 * for turning on/off LED 449 */ 450 switch (action) { 451 case HDA_GEN_PCM_ACT_PREPARE: 452 spec->recording = 1; 453 olpc_xo_update_mic_pins(codec); 454 break; 455 case HDA_GEN_PCM_ACT_CLEANUP: 456 spec->recording = 0; 457 olpc_xo_update_mic_pins(codec); 458 break; 459 } 460 } 461 462 static int olpc_xo_dc_mode_get(struct snd_kcontrol *kcontrol, 463 struct snd_ctl_elem_value *ucontrol) 464 { 465 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 466 struct conexant_spec *spec = codec->spec; 467 ucontrol->value.integer.value[0] = spec->dc_enable; 468 return 0; 469 } 470 471 static int olpc_xo_dc_mode_put(struct snd_kcontrol *kcontrol, 472 struct snd_ctl_elem_value *ucontrol) 473 { 474 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 475 struct conexant_spec *spec = codec->spec; 476 int dc_enable = !!ucontrol->value.integer.value[0]; 477 478 if (dc_enable == spec->dc_enable) 479 return 0; 480 481 spec->dc_enable = dc_enable; 482 olpc_xo_update_mic_pins(codec); 483 olpc_xo_update_mic_boost(codec); 484 return 1; 485 } 486 487 static int olpc_xo_dc_bias_enum_get(struct snd_kcontrol *kcontrol, 488 struct snd_ctl_elem_value *ucontrol) 489 { 490 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 491 struct conexant_spec *spec = codec->spec; 492 ucontrol->value.enumerated.item[0] = spec->dc_input_bias; 493 return 0; 494 } 495 496 static int olpc_xo_dc_bias_enum_info(struct snd_kcontrol *kcontrol, 497 struct snd_ctl_elem_info *uinfo) 498 { 499 return snd_hda_input_mux_info(&olpc_xo_dc_bias, uinfo); 500 } 501 502 static int olpc_xo_dc_bias_enum_put(struct snd_kcontrol *kcontrol, 503 struct snd_ctl_elem_value *ucontrol) 504 { 505 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 506 struct conexant_spec *spec = codec->spec; 507 const struct hda_input_mux *imux = &olpc_xo_dc_bias; 508 unsigned int idx; 509 510 idx = ucontrol->value.enumerated.item[0]; 511 if (idx >= imux->num_items) 512 idx = imux->num_items - 1; 513 if (spec->dc_input_bias == idx) 514 return 0; 515 516 spec->dc_input_bias = idx; 517 if (spec->dc_enable) 518 olpc_xo_update_mic_pins(codec); 519 return 1; 520 } 521 522 static const struct snd_kcontrol_new olpc_xo_mixers[] = { 523 { 524 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 525 .name = "DC Mode Enable Switch", 526 .info = snd_ctl_boolean_mono_info, 527 .get = olpc_xo_dc_mode_get, 528 .put = olpc_xo_dc_mode_put, 529 }, 530 { 531 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 532 .name = "DC Input Bias Enum", 533 .info = olpc_xo_dc_bias_enum_info, 534 .get = olpc_xo_dc_bias_enum_get, 535 .put = olpc_xo_dc_bias_enum_put, 536 }, 537 {} 538 }; 539 540 /* overriding mic boost put callback; update mic boost volume only when 541 * DC mode is disabled 542 */ 543 static int olpc_xo_mic_boost_put(struct snd_kcontrol *kcontrol, 544 struct snd_ctl_elem_value *ucontrol) 545 { 546 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 547 struct conexant_spec *spec = codec->spec; 548 int ret = snd_hda_mixer_amp_volume_put(kcontrol, ucontrol); 549 if (ret > 0 && spec->dc_enable) 550 olpc_xo_update_mic_boost(codec); 551 return ret; 552 } 553 554 static void cxt_fixup_olpc_xo(struct hda_codec *codec, 555 const struct hda_fixup *fix, int action) 556 { 557 struct conexant_spec *spec = codec->spec; 558 struct snd_kcontrol_new *kctl; 559 int i; 560 561 if (action != HDA_FIXUP_ACT_PROBE) 562 return; 563 564 spec->gen.mic_autoswitch_hook = olpc_xo_automic; 565 spec->gen.pcm_capture_hook = olpc_xo_capture_hook; 566 spec->dc_mode_path = snd_hda_add_new_path(codec, 0x1e, 0x14, 0); 567 568 snd_hda_add_new_ctls(codec, olpc_xo_mixers); 569 570 /* OLPC's microphone port is DC coupled for use with external sensors, 571 * therefore we use a 50% mic bias in order to center the input signal 572 * with the DC input range of the codec. 573 */ 574 snd_hda_codec_set_pin_target(codec, 0x1a, PIN_VREF50); 575 576 /* override mic boost control */ 577 snd_array_for_each(&spec->gen.kctls, i, kctl) { 578 if (!strcmp(kctl->name, "Mic Boost Volume")) { 579 kctl->put = olpc_xo_mic_boost_put; 580 break; 581 } 582 } 583 } 584 585 static void cxt_fixup_mute_led_eapd(struct hda_codec *codec, 586 const struct hda_fixup *fix, int action) 587 { 588 struct conexant_spec *spec = codec->spec; 589 590 if (action == HDA_FIXUP_ACT_PRE_PROBE) { 591 spec->mute_led_eapd = 0x1b; 592 spec->dynamic_eapd = 1; 593 spec->gen.vmaster_mute.hook = cx_auto_vmaster_hook_mute_led; 594 } 595 } 596 597 /* 598 * Fix max input level on mixer widget to 0dB 599 * (originally it has 0x2b steps with 0dB offset 0x14) 600 */ 601 static void cxt_fixup_cap_mix_amp(struct hda_codec *codec, 602 const struct hda_fixup *fix, int action) 603 { 604 snd_hda_override_amp_caps(codec, 0x17, HDA_INPUT, 605 (0x14 << AC_AMPCAP_OFFSET_SHIFT) | 606 (0x14 << AC_AMPCAP_NUM_STEPS_SHIFT) | 607 (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) | 608 (1 << AC_AMPCAP_MUTE_SHIFT)); 609 } 610 611 /* 612 * Fix max input level on mixer widget to 0dB 613 * (originally it has 0x1e steps with 0 dB offset 0x17) 614 */ 615 static void cxt_fixup_cap_mix_amp_5047(struct hda_codec *codec, 616 const struct hda_fixup *fix, int action) 617 { 618 snd_hda_override_amp_caps(codec, 0x10, HDA_INPUT, 619 (0x17 << AC_AMPCAP_OFFSET_SHIFT) | 620 (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) | 621 (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) | 622 (1 << AC_AMPCAP_MUTE_SHIFT)); 623 } 624 625 static void cxt_fixup_hp_gate_mic_jack(struct hda_codec *codec, 626 const struct hda_fixup *fix, 627 int action) 628 { 629 /* the mic pin (0x19) doesn't give an unsolicited event; 630 * probe the mic pin together with the headphone pin (0x16) 631 */ 632 if (action == HDA_FIXUP_ACT_PROBE) 633 snd_hda_jack_set_gating_jack(codec, 0x19, 0x16); 634 } 635 636 /* update LED status via GPIO */ 637 static void cxt_update_gpio_led(struct hda_codec *codec, unsigned int mask, 638 bool enabled) 639 { 640 struct conexant_spec *spec = codec->spec; 641 unsigned int oldval = spec->gpio_led; 642 643 if (spec->mute_led_polarity) 644 enabled = !enabled; 645 646 if (enabled) 647 spec->gpio_led &= ~mask; 648 else 649 spec->gpio_led |= mask; 650 if (spec->gpio_led != oldval) 651 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 652 spec->gpio_led); 653 } 654 655 /* turn on/off mute LED via GPIO per vmaster hook */ 656 static void cxt_fixup_gpio_mute_hook(void *private_data, int enabled) 657 { 658 struct hda_codec *codec = private_data; 659 struct conexant_spec *spec = codec->spec; 660 661 cxt_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled); 662 } 663 664 /* turn on/off mic-mute LED via GPIO per capture hook */ 665 static void cxt_gpio_micmute_update(struct hda_codec *codec) 666 { 667 struct conexant_spec *spec = codec->spec; 668 669 cxt_update_gpio_led(codec, spec->gpio_mic_led_mask, 670 spec->gen.micmute_led.led_value); 671 } 672 673 674 static void cxt_fixup_mute_led_gpio(struct hda_codec *codec, 675 const struct hda_fixup *fix, int action) 676 { 677 struct conexant_spec *spec = codec->spec; 678 static const struct hda_verb gpio_init[] = { 679 { 0x01, AC_VERB_SET_GPIO_MASK, 0x03 }, 680 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03 }, 681 {} 682 }; 683 codec_info(codec, "action: %d gpio_led: %d\n", action, spec->gpio_led); 684 685 if (action == HDA_FIXUP_ACT_PRE_PROBE) { 686 spec->gen.vmaster_mute.hook = cxt_fixup_gpio_mute_hook; 687 spec->gpio_led = 0; 688 spec->mute_led_polarity = 0; 689 spec->gpio_mute_led_mask = 0x01; 690 spec->gpio_mic_led_mask = 0x02; 691 snd_hda_gen_add_micmute_led(codec, cxt_gpio_micmute_update); 692 } 693 snd_hda_add_verbs(codec, gpio_init); 694 if (spec->gpio_led) 695 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 696 spec->gpio_led); 697 } 698 699 700 /* ThinkPad X200 & co with cxt5051 */ 701 static const struct hda_pintbl cxt_pincfg_lenovo_x200[] = { 702 { 0x16, 0x042140ff }, /* HP (seq# overridden) */ 703 { 0x17, 0x21a11000 }, /* dock-mic */ 704 { 0x19, 0x2121103f }, /* dock-HP */ 705 { 0x1c, 0x21440100 }, /* dock SPDIF out */ 706 {} 707 }; 708 709 /* ThinkPad 410/420/510/520, X201 & co with cxt5066 */ 710 static const struct hda_pintbl cxt_pincfg_lenovo_tp410[] = { 711 { 0x19, 0x042110ff }, /* HP (seq# overridden) */ 712 { 0x1a, 0x21a190f0 }, /* dock-mic */ 713 { 0x1c, 0x212140ff }, /* dock-HP */ 714 {} 715 }; 716 717 /* Lemote A1004/A1205 with cxt5066 */ 718 static const struct hda_pintbl cxt_pincfg_lemote[] = { 719 { 0x1a, 0x90a10020 }, /* Internal mic */ 720 { 0x1b, 0x03a11020 }, /* External mic */ 721 { 0x1d, 0x400101f0 }, /* Not used */ 722 { 0x1e, 0x40a701f0 }, /* Not used */ 723 { 0x20, 0x404501f0 }, /* Not used */ 724 { 0x22, 0x404401f0 }, /* Not used */ 725 { 0x23, 0x40a701f0 }, /* Not used */ 726 {} 727 }; 728 729 static const struct hda_fixup cxt_fixups[] = { 730 [CXT_PINCFG_LENOVO_X200] = { 731 .type = HDA_FIXUP_PINS, 732 .v.pins = cxt_pincfg_lenovo_x200, 733 }, 734 [CXT_PINCFG_LENOVO_TP410] = { 735 .type = HDA_FIXUP_PINS, 736 .v.pins = cxt_pincfg_lenovo_tp410, 737 .chained = true, 738 .chain_id = CXT_FIXUP_THINKPAD_ACPI, 739 }, 740 [CXT_PINCFG_LEMOTE_A1004] = { 741 .type = HDA_FIXUP_PINS, 742 .chained = true, 743 .chain_id = CXT_FIXUP_INC_MIC_BOOST, 744 .v.pins = cxt_pincfg_lemote, 745 }, 746 [CXT_PINCFG_LEMOTE_A1205] = { 747 .type = HDA_FIXUP_PINS, 748 .v.pins = cxt_pincfg_lemote, 749 }, 750 [CXT_PINCFG_COMPAQ_CQ60] = { 751 .type = HDA_FIXUP_PINS, 752 .v.pins = (const struct hda_pintbl[]) { 753 /* 0x17 was falsely set up as a mic, it should 0x1d */ 754 { 0x17, 0x400001f0 }, 755 { 0x1d, 0x97a70120 }, 756 { } 757 } 758 }, 759 [CXT_FIXUP_STEREO_DMIC] = { 760 .type = HDA_FIXUP_FUNC, 761 .v.func = cxt_fixup_stereo_dmic, 762 }, 763 [CXT_FIXUP_INC_MIC_BOOST] = { 764 .type = HDA_FIXUP_FUNC, 765 .v.func = cxt5066_increase_mic_boost, 766 }, 767 [CXT_FIXUP_HEADPHONE_MIC_PIN] = { 768 .type = HDA_FIXUP_PINS, 769 .chained = true, 770 .chain_id = CXT_FIXUP_HEADPHONE_MIC, 771 .v.pins = (const struct hda_pintbl[]) { 772 { 0x18, 0x03a1913d }, /* use as headphone mic, without its own jack detect */ 773 { } 774 } 775 }, 776 [CXT_FIXUP_HEADPHONE_MIC] = { 777 .type = HDA_FIXUP_FUNC, 778 .v.func = cxt_fixup_headphone_mic, 779 }, 780 [CXT_FIXUP_GPIO1] = { 781 .type = HDA_FIXUP_VERBS, 782 .v.verbs = (const struct hda_verb[]) { 783 { 0x01, AC_VERB_SET_GPIO_MASK, 0x01 }, 784 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01 }, 785 { 0x01, AC_VERB_SET_GPIO_DATA, 0x01 }, 786 { } 787 }, 788 }, 789 [CXT_FIXUP_ASPIRE_DMIC] = { 790 .type = HDA_FIXUP_FUNC, 791 .v.func = cxt_fixup_stereo_dmic, 792 .chained = true, 793 .chain_id = CXT_FIXUP_GPIO1, 794 }, 795 [CXT_FIXUP_THINKPAD_ACPI] = { 796 .type = HDA_FIXUP_FUNC, 797 .v.func = hda_fixup_thinkpad_acpi, 798 }, 799 [CXT_FIXUP_OLPC_XO] = { 800 .type = HDA_FIXUP_FUNC, 801 .v.func = cxt_fixup_olpc_xo, 802 }, 803 [CXT_FIXUP_CAP_MIX_AMP] = { 804 .type = HDA_FIXUP_FUNC, 805 .v.func = cxt_fixup_cap_mix_amp, 806 }, 807 [CXT_FIXUP_TOSHIBA_P105] = { 808 .type = HDA_FIXUP_PINS, 809 .v.pins = (const struct hda_pintbl[]) { 810 { 0x10, 0x961701f0 }, /* speaker/hp */ 811 { 0x12, 0x02a1901e }, /* ext mic */ 812 { 0x14, 0x95a70110 }, /* int mic */ 813 {} 814 }, 815 }, 816 [CXT_FIXUP_HP_530] = { 817 .type = HDA_FIXUP_PINS, 818 .v.pins = (const struct hda_pintbl[]) { 819 { 0x12, 0x90a60160 }, /* int mic */ 820 {} 821 }, 822 .chained = true, 823 .chain_id = CXT_FIXUP_CAP_MIX_AMP, 824 }, 825 [CXT_FIXUP_CAP_MIX_AMP_5047] = { 826 .type = HDA_FIXUP_FUNC, 827 .v.func = cxt_fixup_cap_mix_amp_5047, 828 }, 829 [CXT_FIXUP_MUTE_LED_EAPD] = { 830 .type = HDA_FIXUP_FUNC, 831 .v.func = cxt_fixup_mute_led_eapd, 832 }, 833 [CXT_FIXUP_HP_DOCK] = { 834 .type = HDA_FIXUP_PINS, 835 .v.pins = (const struct hda_pintbl[]) { 836 { 0x16, 0x21011020 }, /* line-out */ 837 { 0x18, 0x2181103f }, /* line-in */ 838 { } 839 }, 840 .chained = true, 841 .chain_id = CXT_FIXUP_MUTE_LED_GPIO, 842 }, 843 [CXT_FIXUP_HP_SPECTRE] = { 844 .type = HDA_FIXUP_PINS, 845 .v.pins = (const struct hda_pintbl[]) { 846 /* enable NID 0x1d for the speaker on top */ 847 { 0x1d, 0x91170111 }, 848 { } 849 } 850 }, 851 [CXT_FIXUP_HP_GATE_MIC] = { 852 .type = HDA_FIXUP_FUNC, 853 .v.func = cxt_fixup_hp_gate_mic_jack, 854 }, 855 [CXT_FIXUP_MUTE_LED_GPIO] = { 856 .type = HDA_FIXUP_FUNC, 857 .v.func = cxt_fixup_mute_led_gpio, 858 }, 859 [CXT_FIXUP_HEADSET_MIC] = { 860 .type = HDA_FIXUP_FUNC, 861 .v.func = cxt_fixup_headset_mic, 862 }, 863 [CXT_FIXUP_HP_MIC_NO_PRESENCE] = { 864 .type = HDA_FIXUP_PINS, 865 .v.pins = (const struct hda_pintbl[]) { 866 { 0x1a, 0x02a1113c }, 867 { } 868 }, 869 .chained = true, 870 .chain_id = CXT_FIXUP_HEADSET_MIC, 871 }, 872 }; 873 874 static const struct snd_pci_quirk cxt5045_fixups[] = { 875 SND_PCI_QUIRK(0x103c, 0x30d5, "HP 530", CXT_FIXUP_HP_530), 876 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba P105", CXT_FIXUP_TOSHIBA_P105), 877 /* HP, Packard Bell, Fujitsu-Siemens & Lenovo laptops have 878 * really bad sound over 0dB on NID 0x17. 879 */ 880 SND_PCI_QUIRK_VENDOR(0x103c, "HP", CXT_FIXUP_CAP_MIX_AMP), 881 SND_PCI_QUIRK_VENDOR(0x1631, "Packard Bell", CXT_FIXUP_CAP_MIX_AMP), 882 SND_PCI_QUIRK_VENDOR(0x1734, "Fujitsu", CXT_FIXUP_CAP_MIX_AMP), 883 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", CXT_FIXUP_CAP_MIX_AMP), 884 {} 885 }; 886 887 static const struct hda_model_fixup cxt5045_fixup_models[] = { 888 { .id = CXT_FIXUP_CAP_MIX_AMP, .name = "cap-mix-amp" }, 889 { .id = CXT_FIXUP_TOSHIBA_P105, .name = "toshiba-p105" }, 890 { .id = CXT_FIXUP_HP_530, .name = "hp-530" }, 891 {} 892 }; 893 894 static const struct snd_pci_quirk cxt5047_fixups[] = { 895 /* HP laptops have really bad sound over 0 dB on NID 0x10. 896 */ 897 SND_PCI_QUIRK_VENDOR(0x103c, "HP", CXT_FIXUP_CAP_MIX_AMP_5047), 898 {} 899 }; 900 901 static const struct hda_model_fixup cxt5047_fixup_models[] = { 902 { .id = CXT_FIXUP_CAP_MIX_AMP_5047, .name = "cap-mix-amp" }, 903 {} 904 }; 905 906 static const struct snd_pci_quirk cxt5051_fixups[] = { 907 SND_PCI_QUIRK(0x103c, 0x360b, "Compaq CQ60", CXT_PINCFG_COMPAQ_CQ60), 908 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo X200", CXT_PINCFG_LENOVO_X200), 909 {} 910 }; 911 912 static const struct hda_model_fixup cxt5051_fixup_models[] = { 913 { .id = CXT_PINCFG_LENOVO_X200, .name = "lenovo-x200" }, 914 {} 915 }; 916 917 static const struct snd_pci_quirk cxt5066_fixups[] = { 918 SND_PCI_QUIRK(0x1025, 0x0543, "Acer Aspire One 522", CXT_FIXUP_STEREO_DMIC), 919 SND_PCI_QUIRK(0x1025, 0x054c, "Acer Aspire 3830TG", CXT_FIXUP_ASPIRE_DMIC), 920 SND_PCI_QUIRK(0x1025, 0x054f, "Acer Aspire 4830T", CXT_FIXUP_ASPIRE_DMIC), 921 SND_PCI_QUIRK(0x103c, 0x8079, "HP EliteBook 840 G3", CXT_FIXUP_HP_DOCK), 922 SND_PCI_QUIRK(0x103c, 0x807C, "HP EliteBook 820 G3", CXT_FIXUP_HP_DOCK), 923 SND_PCI_QUIRK(0x103c, 0x80FD, "HP ProBook 640 G2", CXT_FIXUP_HP_DOCK), 924 SND_PCI_QUIRK(0x103c, 0x83b3, "HP EliteBook 830 G5", CXT_FIXUP_HP_DOCK), 925 SND_PCI_QUIRK(0x103c, 0x83d3, "HP ProBook 640 G4", CXT_FIXUP_HP_DOCK), 926 SND_PCI_QUIRK(0x103c, 0x8174, "HP Spectre x360", CXT_FIXUP_HP_SPECTRE), 927 SND_PCI_QUIRK(0x103c, 0x8115, "HP Z1 Gen3", CXT_FIXUP_HP_GATE_MIC), 928 SND_PCI_QUIRK(0x103c, 0x814f, "HP ZBook 15u G3", CXT_FIXUP_MUTE_LED_GPIO), 929 SND_PCI_QUIRK(0x103c, 0x822e, "HP ProBook 440 G4", CXT_FIXUP_MUTE_LED_GPIO), 930 SND_PCI_QUIRK(0x103c, 0x836e, "HP ProBook 455 G5", CXT_FIXUP_MUTE_LED_GPIO), 931 SND_PCI_QUIRK(0x103c, 0x8299, "HP 800 G3 SFF", CXT_FIXUP_HP_MIC_NO_PRESENCE), 932 SND_PCI_QUIRK(0x103c, 0x829a, "HP 800 G3 DM", CXT_FIXUP_HP_MIC_NO_PRESENCE), 933 SND_PCI_QUIRK(0x103c, 0x8455, "HP Z2 G4", CXT_FIXUP_HP_MIC_NO_PRESENCE), 934 SND_PCI_QUIRK(0x1043, 0x138d, "Asus", CXT_FIXUP_HEADPHONE_MIC_PIN), 935 SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT_FIXUP_OLPC_XO), 936 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410), 937 SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo T410", CXT_PINCFG_LENOVO_TP410), 938 SND_PCI_QUIRK(0x17aa, 0x215f, "Lenovo T510", CXT_PINCFG_LENOVO_TP410), 939 SND_PCI_QUIRK(0x17aa, 0x21ce, "Lenovo T420", CXT_PINCFG_LENOVO_TP410), 940 SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520", CXT_PINCFG_LENOVO_TP410), 941 SND_PCI_QUIRK(0x17aa, 0x21da, "Lenovo X220", CXT_PINCFG_LENOVO_TP410), 942 SND_PCI_QUIRK(0x17aa, 0x21db, "Lenovo X220-tablet", CXT_PINCFG_LENOVO_TP410), 943 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo IdeaPad Z560", CXT_FIXUP_MUTE_LED_EAPD), 944 SND_PCI_QUIRK(0x17aa, 0x390b, "Lenovo G50-80", CXT_FIXUP_STEREO_DMIC), 945 SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC), 946 SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMIC), 947 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo G50-70", CXT_FIXUP_STEREO_DMIC), 948 SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC), 949 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", CXT_FIXUP_THINKPAD_ACPI), 950 SND_PCI_QUIRK(0x1c06, 0x2011, "Lemote A1004", CXT_PINCFG_LEMOTE_A1004), 951 SND_PCI_QUIRK(0x1c06, 0x2012, "Lemote A1205", CXT_PINCFG_LEMOTE_A1205), 952 {} 953 }; 954 955 static const struct hda_model_fixup cxt5066_fixup_models[] = { 956 { .id = CXT_FIXUP_STEREO_DMIC, .name = "stereo-dmic" }, 957 { .id = CXT_FIXUP_GPIO1, .name = "gpio1" }, 958 { .id = CXT_FIXUP_HEADPHONE_MIC_PIN, .name = "headphone-mic-pin" }, 959 { .id = CXT_PINCFG_LENOVO_TP410, .name = "tp410" }, 960 { .id = CXT_FIXUP_THINKPAD_ACPI, .name = "thinkpad" }, 961 { .id = CXT_PINCFG_LEMOTE_A1004, .name = "lemote-a1004" }, 962 { .id = CXT_PINCFG_LEMOTE_A1205, .name = "lemote-a1205" }, 963 { .id = CXT_FIXUP_OLPC_XO, .name = "olpc-xo" }, 964 { .id = CXT_FIXUP_MUTE_LED_EAPD, .name = "mute-led-eapd" }, 965 { .id = CXT_FIXUP_HP_DOCK, .name = "hp-dock" }, 966 { .id = CXT_FIXUP_MUTE_LED_GPIO, .name = "mute-led-gpio" }, 967 { .id = CXT_FIXUP_HP_MIC_NO_PRESENCE, .name = "hp-mic-fix" }, 968 {} 969 }; 970 971 /* add "fake" mute amp-caps to DACs on cx5051 so that mixer mute switches 972 * can be created (bko#42825) 973 */ 974 static void add_cx5051_fake_mutes(struct hda_codec *codec) 975 { 976 struct conexant_spec *spec = codec->spec; 977 static hda_nid_t out_nids[] = { 978 0x10, 0x11, 0 979 }; 980 hda_nid_t *p; 981 982 for (p = out_nids; *p; p++) 983 snd_hda_override_amp_caps(codec, *p, HDA_OUTPUT, 984 AC_AMPCAP_MIN_MUTE | 985 query_amp_caps(codec, *p, HDA_OUTPUT)); 986 spec->gen.dac_min_mute = true; 987 } 988 989 static int patch_conexant_auto(struct hda_codec *codec) 990 { 991 struct conexant_spec *spec; 992 int err; 993 994 codec_info(codec, "%s: BIOS auto-probing.\n", codec->core.chip_name); 995 996 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 997 if (!spec) 998 return -ENOMEM; 999 snd_hda_gen_spec_init(&spec->gen); 1000 codec->spec = spec; 1001 codec->patch_ops = cx_auto_patch_ops; 1002 1003 cx_auto_parse_eapd(codec); 1004 spec->gen.own_eapd_ctl = 1; 1005 if (spec->dynamic_eapd) 1006 spec->gen.vmaster_mute.hook = cx_auto_vmaster_hook; 1007 1008 switch (codec->core.vendor_id) { 1009 case 0x14f15045: 1010 codec->single_adc_amp = 1; 1011 spec->gen.mixer_nid = 0x17; 1012 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO; 1013 snd_hda_pick_fixup(codec, cxt5045_fixup_models, 1014 cxt5045_fixups, cxt_fixups); 1015 break; 1016 case 0x14f15047: 1017 codec->pin_amp_workaround = 1; 1018 spec->gen.mixer_nid = 0x19; 1019 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO; 1020 snd_hda_pick_fixup(codec, cxt5047_fixup_models, 1021 cxt5047_fixups, cxt_fixups); 1022 break; 1023 case 0x14f15051: 1024 add_cx5051_fake_mutes(codec); 1025 codec->pin_amp_workaround = 1; 1026 snd_hda_pick_fixup(codec, cxt5051_fixup_models, 1027 cxt5051_fixups, cxt_fixups); 1028 break; 1029 case 0x14f150f2: 1030 codec->power_save_node = 1; 1031 /* Fall through */ 1032 default: 1033 codec->pin_amp_workaround = 1; 1034 snd_hda_pick_fixup(codec, cxt5066_fixup_models, 1035 cxt5066_fixups, cxt_fixups); 1036 break; 1037 } 1038 1039 /* Show mute-led control only on HP laptops 1040 * This is a sort of white-list: on HP laptops, EAPD corresponds 1041 * only to the mute-LED without actualy amp function. Meanwhile, 1042 * others may use EAPD really as an amp switch, so it might be 1043 * not good to expose it blindly. 1044 */ 1045 switch (codec->core.subsystem_id >> 16) { 1046 case 0x103c: 1047 spec->gen.vmaster_mute_enum = 1; 1048 break; 1049 } 1050 1051 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); 1052 1053 err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL, 1054 spec->parse_flags); 1055 if (err < 0) 1056 goto error; 1057 1058 err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg); 1059 if (err < 0) 1060 goto error; 1061 1062 err = cx_auto_parse_beep(codec); 1063 if (err < 0) 1064 goto error; 1065 1066 /* Some laptops with Conexant chips show stalls in S3 resume, 1067 * which falls into the single-cmd mode. 1068 * Better to make reset, then. 1069 */ 1070 if (!codec->bus->core.sync_write) { 1071 codec_info(codec, 1072 "Enable sync_write for stable communication\n"); 1073 codec->bus->core.sync_write = 1; 1074 codec->bus->allow_bus_reset = 1; 1075 } 1076 1077 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); 1078 1079 return 0; 1080 1081 error: 1082 cx_auto_free(codec); 1083 return err; 1084 } 1085 1086 /* 1087 */ 1088 1089 static const struct hda_device_id snd_hda_id_conexant[] = { 1090 HDA_CODEC_ENTRY(0x14f12008, "CX8200", patch_conexant_auto), 1091 HDA_CODEC_ENTRY(0x14f15045, "CX20549 (Venice)", patch_conexant_auto), 1092 HDA_CODEC_ENTRY(0x14f15047, "CX20551 (Waikiki)", patch_conexant_auto), 1093 HDA_CODEC_ENTRY(0x14f15051, "CX20561 (Hermosa)", patch_conexant_auto), 1094 HDA_CODEC_ENTRY(0x14f15066, "CX20582 (Pebble)", patch_conexant_auto), 1095 HDA_CODEC_ENTRY(0x14f15067, "CX20583 (Pebble HSF)", patch_conexant_auto), 1096 HDA_CODEC_ENTRY(0x14f15068, "CX20584", patch_conexant_auto), 1097 HDA_CODEC_ENTRY(0x14f15069, "CX20585", patch_conexant_auto), 1098 HDA_CODEC_ENTRY(0x14f1506c, "CX20588", patch_conexant_auto), 1099 HDA_CODEC_ENTRY(0x14f1506e, "CX20590", patch_conexant_auto), 1100 HDA_CODEC_ENTRY(0x14f15097, "CX20631", patch_conexant_auto), 1101 HDA_CODEC_ENTRY(0x14f15098, "CX20632", patch_conexant_auto), 1102 HDA_CODEC_ENTRY(0x14f150a1, "CX20641", patch_conexant_auto), 1103 HDA_CODEC_ENTRY(0x14f150a2, "CX20642", patch_conexant_auto), 1104 HDA_CODEC_ENTRY(0x14f150ab, "CX20651", patch_conexant_auto), 1105 HDA_CODEC_ENTRY(0x14f150ac, "CX20652", patch_conexant_auto), 1106 HDA_CODEC_ENTRY(0x14f150b8, "CX20664", patch_conexant_auto), 1107 HDA_CODEC_ENTRY(0x14f150b9, "CX20665", patch_conexant_auto), 1108 HDA_CODEC_ENTRY(0x14f150f1, "CX21722", patch_conexant_auto), 1109 HDA_CODEC_ENTRY(0x14f150f2, "CX20722", patch_conexant_auto), 1110 HDA_CODEC_ENTRY(0x14f150f3, "CX21724", patch_conexant_auto), 1111 HDA_CODEC_ENTRY(0x14f150f4, "CX20724", patch_conexant_auto), 1112 HDA_CODEC_ENTRY(0x14f1510f, "CX20751/2", patch_conexant_auto), 1113 HDA_CODEC_ENTRY(0x14f15110, "CX20751/2", patch_conexant_auto), 1114 HDA_CODEC_ENTRY(0x14f15111, "CX20753/4", patch_conexant_auto), 1115 HDA_CODEC_ENTRY(0x14f15113, "CX20755", patch_conexant_auto), 1116 HDA_CODEC_ENTRY(0x14f15114, "CX20756", patch_conexant_auto), 1117 HDA_CODEC_ENTRY(0x14f15115, "CX20757", patch_conexant_auto), 1118 HDA_CODEC_ENTRY(0x14f151d7, "CX20952", patch_conexant_auto), 1119 {} /* terminator */ 1120 }; 1121 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_conexant); 1122 1123 MODULE_LICENSE("GPL"); 1124 MODULE_DESCRIPTION("Conexant HD-audio codec"); 1125 1126 static struct hda_codec_driver conexant_driver = { 1127 .id = snd_hda_id_conexant, 1128 }; 1129 1130 module_hda_codec_driver(conexant_driver); 1131