2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 2006 Stephane E. Potvin <sepotvin@videotron.ca>
5 * Copyright (c) 2006 Ariff Abdullah <ariff@FreeBSD.org>
6 * Copyright (c) 2008-2012 Alexander Motin <mav@FreeBSD.org>
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * Intel High Definition Audio (Audio function quirks) driver for FreeBSD.
35 #ifdef HAVE_KERNEL_OPTION_HEADERS
39 #include <dev/sound/pcm/sound.h>
41 #include <sys/ctype.h>
43 #include <dev/sound/pci/hda/hdac.h>
44 #include <dev/sound/pci/hda/hdaa.h>
45 #include <dev/sound/pci/hda/hda_reg.h>
47 SND_DECLARE_FILE("$FreeBSD$");
57 * XXX Force stereo quirk. Monoural recording / playback
58 * on few codecs (especially ALC880) seems broken or
59 * perhaps unsupported.
61 { HDA_MATCH_ALL, HDA_MATCH_ALL, HDA_MATCH_ALL,
62 HDAA_QUIRK_FORCESTEREO | HDAA_QUIRK_IVREF, 0,
64 { ACER_ALL_SUBVENDOR, HDA_MATCH_ALL, HDA_MATCH_ALL,
67 { ASUS_G2K_SUBVENDOR, HDA_CODEC_ALC660, HDA_MATCH_ALL,
70 { ASUS_M5200_SUBVENDOR, HDA_CODEC_ALC880, HDA_MATCH_ALL,
73 { ASUS_A7M_SUBVENDOR, HDA_CODEC_ALC880, HDA_MATCH_ALL,
76 { ASUS_A7T_SUBVENDOR, HDA_CODEC_ALC882, HDA_MATCH_ALL,
79 { ASUS_W2J_SUBVENDOR, HDA_CODEC_ALC882, HDA_MATCH_ALL,
82 { ASUS_U5F_SUBVENDOR, HDA_CODEC_AD1986A, HDA_MATCH_ALL,
83 HDAA_QUIRK_EAPDINV, 0,
85 { ASUS_A8X_SUBVENDOR, HDA_CODEC_AD1986A, HDA_MATCH_ALL,
86 HDAA_QUIRK_EAPDINV, 0,
88 { ASUS_F3JC_SUBVENDOR, HDA_CODEC_ALC861, HDA_MATCH_ALL,
91 { UNIWILL_9075_SUBVENDOR, HDA_CODEC_ALC861, HDA_MATCH_ALL,
94 /*{ ASUS_M2N_SUBVENDOR, HDA_CODEC_AD1988, HDA_MATCH_ALL,
95 HDAA_QUIRK_IVREF80, HDAA_QUIRK_IVREF50 | HDAA_QUIRK_IVREF100,
97 { MEDION_MD95257_SUBVENDOR, HDA_CODEC_ALC880, HDA_MATCH_ALL,
100 { LENOVO_3KN100_SUBVENDOR, HDA_CODEC_AD1986A, HDA_MATCH_ALL,
101 HDAA_QUIRK_EAPDINV | HDAA_QUIRK_SENSEINV, 0,
103 { SAMSUNG_Q1_SUBVENDOR, HDA_CODEC_AD1986A, HDA_MATCH_ALL,
104 HDAA_QUIRK_EAPDINV, 0,
106 { APPLE_MB3_SUBVENDOR, HDA_CODEC_ALC885, HDA_MATCH_ALL,
107 HDAA_QUIRK_OVREF50, 0,
109 { APPLE_INTEL_MAC, HDA_CODEC_STAC9221, HDA_MATCH_ALL,
111 HDAA_GPIO_SET(0) | HDAA_GPIO_SET(1) },
112 { APPLE_MACBOOKAIR31, HDA_CODEC_CS4206, HDA_MATCH_ALL,
114 HDAA_GPIO_SET(1) | HDAA_GPIO_SET(3) },
115 { APPLE_MACBOOKPRO55, HDA_CODEC_CS4206, HDA_MATCH_ALL,
117 HDAA_GPIO_SET(1) | HDAA_GPIO_SET(3) },
118 { APPLE_MACBOOKPRO71, HDA_CODEC_CS4206, HDA_MATCH_ALL,
120 HDAA_GPIO_SET(1) | HDAA_GPIO_SET(3) },
121 { HDA_INTEL_MACBOOKPRO92, HDA_CODEC_CS4206, HDA_MATCH_ALL,
123 HDAA_GPIO_SET(1) | HDAA_GPIO_SET(3) },
124 { DELL_D630_SUBVENDOR, HDA_CODEC_STAC9205X, HDA_MATCH_ALL,
127 { DELL_V1400_SUBVENDOR, HDA_CODEC_STAC9228X, HDA_MATCH_ALL,
130 { DELL_V1500_SUBVENDOR, HDA_CODEC_STAC9205X, HDA_MATCH_ALL,
133 { HDA_MATCH_ALL, HDA_CODEC_AD1988, HDA_MATCH_ALL,
134 HDAA_QUIRK_IVREF80, HDAA_QUIRK_IVREF50 | HDAA_QUIRK_IVREF100,
136 { HDA_MATCH_ALL, HDA_CODEC_AD1988B, HDA_MATCH_ALL,
137 HDAA_QUIRK_IVREF80, HDAA_QUIRK_IVREF50 | HDAA_QUIRK_IVREF100,
139 { HDA_MATCH_ALL, HDA_CODEC_CX20549, HDA_MATCH_ALL,
140 0, HDAA_QUIRK_FORCESTEREO,
142 /* Mac Pro 1,1 requires ovref for proper volume level. */
143 { 0x00000000, HDA_CODEC_ALC885, 0x106b0c00,
149 hdac_pin_patch(struct hdaa_widget *w)
151 const char *patch = NULL;
152 uint32_t config, orig, id, subid;
155 config = orig = w->wclass.pin.config;
156 id = hdaa_codec_id(w->devinfo);
157 subid = hdaa_card_id(w->devinfo);
159 /* XXX: Old patches require complete review.
160 * Now they may create more problem then solve due to
161 * incorrect associations.
163 if (id == HDA_CODEC_ALC880 && subid == LG_LW20_SUBVENDOR) {
166 config &= ~HDA_CONFIG_DEFAULTCONF_DEVICE_MASK;
167 config |= HDA_CONFIG_DEFAULTCONF_DEVICE_LINE_IN;
170 config &= ~HDA_CONFIG_DEFAULTCONF_DEVICE_MASK;
171 config |= HDA_CONFIG_DEFAULTCONF_DEVICE_HP_OUT;
176 } else if (id == HDA_CODEC_ALC880 &&
177 (subid == CLEVO_D900T_SUBVENDOR ||
178 subid == ASUS_M5200_SUBVENDOR)) {
184 config &= ~HDA_CONFIG_DEFAULTCONF_DEVICE_MASK;
185 config |= HDA_CONFIG_DEFAULTCONF_DEVICE_MIC_IN;
187 case 25: /* XXX MIC2 */
188 config &= ~HDA_CONFIG_DEFAULTCONF_DEVICE_MASK;
189 config |= HDA_CONFIG_DEFAULTCONF_DEVICE_MIC_IN;
192 config &= ~HDA_CONFIG_DEFAULTCONF_DEVICE_MASK;
193 config |= HDA_CONFIG_DEFAULTCONF_DEVICE_LINE_IN;
195 case 27: /* XXX LINE2 */
196 config &= ~HDA_CONFIG_DEFAULTCONF_DEVICE_MASK;
197 config |= HDA_CONFIG_DEFAULTCONF_DEVICE_LINE_IN;
200 config &= ~HDA_CONFIG_DEFAULTCONF_DEVICE_MASK;
201 config |= HDA_CONFIG_DEFAULTCONF_DEVICE_CD;
204 } else if (id == HDA_CODEC_ALC883 &&
205 (subid == MSI_MS034A_SUBVENDOR ||
206 HDA_DEV_MATCH(ACER_ALL_SUBVENDOR, subid))) {
209 config &= ~(HDA_CONFIG_DEFAULTCONF_DEVICE_MASK |
210 HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_MASK);
211 config |= (HDA_CONFIG_DEFAULTCONF_DEVICE_MIC_IN |
212 HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_FIXED);
215 config &= ~(HDA_CONFIG_DEFAULTCONF_DEVICE_MASK |
216 HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_MASK);
217 config |= (HDA_CONFIG_DEFAULTCONF_DEVICE_CD |
218 HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_FIXED);
221 } else if (id == HDA_CODEC_CX20549 && subid ==
222 HP_V3000_SUBVENDOR) {
225 config &= ~HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_MASK;
226 config |= HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_NONE;
229 config &= ~(HDA_CONFIG_DEFAULTCONF_DEVICE_MASK |
230 HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_MASK);
231 config |= (HDA_CONFIG_DEFAULTCONF_DEVICE_MIC_IN |
232 HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_FIXED);
235 config &= ~(HDA_CONFIG_DEFAULTCONF_DEVICE_MASK |
236 HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_MASK);
237 config |= (HDA_CONFIG_DEFAULTCONF_DEVICE_CD |
238 HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_FIXED);
241 } else if (id == HDA_CODEC_CX20551 && subid ==
242 HP_DV5000_SUBVENDOR) {
246 config &= ~HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_MASK;
247 config |= HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_NONE;
250 } else if (id == HDA_CODEC_ALC861 && subid ==
251 ASUS_W6F_SUBVENDOR) {
254 config &= ~(HDA_CONFIG_DEFAULTCONF_DEVICE_MASK |
255 HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_MASK);
256 config |= (HDA_CONFIG_DEFAULTCONF_DEVICE_LINE_OUT |
257 HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_FIXED);
264 config &= ~(HDA_CONFIG_DEFAULTCONF_DEVICE_MASK |
265 HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_MASK);
266 config |= (HDA_CONFIG_DEFAULTCONF_DEVICE_MIC_IN |
267 HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_FIXED);
270 config &= ~(HDA_CONFIG_DEFAULTCONF_DEVICE_MASK |
271 HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_MASK);
272 config |= (HDA_CONFIG_DEFAULTCONF_DEVICE_HP_OUT |
273 HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_JACK);
276 } else if (id == HDA_CODEC_ALC861 && subid ==
277 UNIWILL_9075_SUBVENDOR) {
280 config &= ~(HDA_CONFIG_DEFAULTCONF_DEVICE_MASK |
281 HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_MASK);
282 config |= (HDA_CONFIG_DEFAULTCONF_DEVICE_HP_OUT |
283 HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_JACK);
289 if (id == HDA_CODEC_AD1984A &&
290 subid == LENOVO_X300_SUBVENDOR) {
292 case 17: /* Headphones with redirection */
293 patch = "as=1 seq=15";
295 case 20: /* Two mics together */
296 patch = "as=2 seq=15";
299 } else if (id == HDA_CODEC_AD1986A &&
300 (subid == ASUS_M2NPVMX_SUBVENDOR ||
301 subid == ASUS_A8NVMCSM_SUBVENDOR ||
302 subid == ASUS_P5PL2_SUBVENDOR)) {
304 case 26: /* Headphones with redirection */
305 patch = "as=1 seq=15";
307 case 28: /* 5.1 out => 2.0 out + 1 input */
308 patch = "device=Line-in as=8 seq=1";
310 case 29: /* Can't use this as input, as the only available mic
311 * preamplifier is busy by front panel mic (nid 31).
312 * If you want to use this rear connector as mic input,
313 * you have to disable the front panel one. */
316 case 31: /* Lot of inputs configured with as=15 and unusable */
317 patch = "as=8 seq=3";
320 patch = "as=8 seq=4";
323 patch = "as=8 seq=5";
326 patch = "as=8 seq=6";
329 } else if (id == HDA_CODEC_ALC260 &&
330 HDA_DEV_MATCH(SONY_S5_SUBVENDOR, subid)) {
333 patch = "seq=15 device=Headphones";
336 } else if (id == HDA_CODEC_ALC268) {
337 if (subid == ACER_T5320_SUBVENDOR) {
339 case 20: /* Headphones Jack */
340 patch = "as=1 seq=15";
344 } else if (id == HDA_CODEC_CX20561 &&
345 subid == LENOVO_B450_SUBVENDOR) {
348 patch = "as=1 seq=15";
351 } else if (id == HDA_CODEC_CX20561 &&
352 subid == LENOVO_T400_SUBVENDOR) {
355 patch = "as=1 seq=15";
358 patch = "as=1 seq=0";
361 } else if (id == HDA_CODEC_CX20590 &&
362 (subid == LENOVO_X1_SUBVENDOR ||
363 subid == LENOVO_X220_SUBVENDOR ||
364 subid == LENOVO_T420_SUBVENDOR ||
365 subid == LENOVO_T520_SUBVENDOR ||
366 subid == LENOVO_G580_SUBVENDOR)) {
369 patch = "as=1 seq=15";
372 * Group onboard mic and headphone mic
373 * together. Fixes onboard mic.
376 patch = "as=2 seq=15";
382 } else if (id == HDA_CODEC_ALC269 &&
383 (subid == LENOVO_X1CRBN_SUBVENDOR ||
384 subid == LENOVO_T430_SUBVENDOR ||
385 subid == LENOVO_T430S_SUBVENDOR ||
386 subid == LENOVO_T530_SUBVENDOR)) {
389 patch = "as=1 seq=15";
392 } else if (id == HDA_CODEC_ALC269 &&
393 subid == ASUS_UX31A_SUBVENDOR) {
396 patch = "as=1 seq=15";
399 } else if (id == HDA_CODEC_ALC892 &&
400 subid == INTEL_DH87RL_SUBVENDOR) {
403 patch = "as=1 seq=15";
406 } else if (id == HDA_CODEC_ALC292 &&
407 subid == LENOVO_X120BS_SUBVENDOR) {
410 patch = "as=1 seq=15";
413 } else if (id == HDA_CODEC_ALC298 && subid == DELL_XPS9560_SUBVENDOR) {
425 config = hdaa_widget_pin_patch(config, patch);
428 device_printf(w->devinfo->dev,
429 "Patching pin config nid=%u 0x%08x -> 0x%08x\n",
432 w->wclass.pin.config = config;
436 hdaa_widget_patch(struct hdaa_widget *w)
438 struct hdaa_devinfo *devinfo = w->devinfo;
442 orig = w->param.widget_cap;
443 /* On some codecs beeper is an input pin, but it is not recordable
444 alone. Also most of BIOSes does not declare beeper pin.
445 Change beeper pin node type to beeper to help parser. */
446 switch (hdaa_codec_id(devinfo)) {
447 case HDA_CODEC_AD1882:
448 case HDA_CODEC_AD1883:
449 case HDA_CODEC_AD1984:
450 case HDA_CODEC_AD1984A:
451 case HDA_CODEC_AD1984B:
452 case HDA_CODEC_AD1987:
453 case HDA_CODEC_AD1988:
454 case HDA_CODEC_AD1988B:
455 case HDA_CODEC_AD1989B:
458 case HDA_CODEC_ALC260:
462 if (hda_get_vendor_id(devinfo->dev) == REALTEK_VENDORID &&
463 hdaa_codec_id(devinfo) != HDA_CODEC_ALC260)
465 if (w->nid == beeper) {
466 w->param.widget_cap &= ~HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_MASK;
467 w->param.widget_cap |= HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_BEEP_WIDGET <<
468 HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_SHIFT;
472 * Clear "digital" flag from digital mic input, as its signal then goes
473 * to "analog" mixer and this separation just limits functionaity.
475 if (hdaa_codec_id(devinfo) == HDA_CODEC_AD1984A &&
477 w->param.widget_cap &= ~HDA_PARAM_AUDIO_WIDGET_CAP_DIGITAL_MASK;
479 if (w->param.widget_cap != orig) {
480 device_printf(w->devinfo->dev,
481 "Patching widget caps nid=%u 0x%08x -> 0x%08x\n",
482 w->nid, orig, w->param.widget_cap);
486 if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX)
491 hdaa_patch(struct hdaa_devinfo *devinfo)
493 struct hdaa_widget *w;
494 uint32_t id, subid, subsystemid;
497 id = hdaa_codec_id(devinfo);
498 subid = hdaa_card_id(devinfo);
499 subsystemid = hda_get_subsystem_id(devinfo->dev);
504 for (i = 0; i < nitems(hdac_quirks); i++) {
505 if (!(HDA_DEV_MATCH(hdac_quirks[i].model, subid) &&
506 HDA_DEV_MATCH(hdac_quirks[i].id, id) &&
507 HDA_DEV_MATCH(hdac_quirks[i].subsystemid, subsystemid)))
509 devinfo->quirks |= hdac_quirks[i].set;
510 devinfo->quirks &= ~(hdac_quirks[i].unset);
511 devinfo->gpio = hdac_quirks[i].gpio;
514 /* Apply per-widget patch. */
515 for (i = devinfo->startnode; i < devinfo->endnode; i++) {
516 w = hdaa_widget_get(devinfo, i);
519 hdaa_widget_patch(w);
523 case HDA_CODEC_AD1983:
525 * This CODEC has several possible usages, but none
526 * fit the parser best. Help parser to choose better.
528 /* Disable direct unmixed playback to get pcm volume. */
529 w = hdaa_widget_get(devinfo, 5);
531 w->connsenable[0] = 0;
532 w = hdaa_widget_get(devinfo, 6);
534 w->connsenable[0] = 0;
535 w = hdaa_widget_get(devinfo, 11);
537 w->connsenable[0] = 0;
538 /* Disable mic and line selectors. */
539 w = hdaa_widget_get(devinfo, 12);
541 w->connsenable[1] = 0;
542 w = hdaa_widget_get(devinfo, 13);
544 w->connsenable[1] = 0;
545 /* Disable recording from mono playback mix. */
546 w = hdaa_widget_get(devinfo, 20);
548 w->connsenable[3] = 0;
550 case HDA_CODEC_AD1986A:
552 * This CODEC has overcomplicated input mixing.
553 * Make some cleaning there.
555 /* Disable input mono mixer. Not needed and not supported. */
556 w = hdaa_widget_get(devinfo, 43);
559 /* Disable any with any input mixing mesh. Use separately. */
560 w = hdaa_widget_get(devinfo, 39);
563 w = hdaa_widget_get(devinfo, 40);
566 w = hdaa_widget_get(devinfo, 41);
569 w = hdaa_widget_get(devinfo, 42);
572 /* Disable duplicate mixer node connector. */
573 w = hdaa_widget_get(devinfo, 15);
575 w->connsenable[3] = 0;
576 /* There is only one mic preamplifier, use it effectively. */
577 w = hdaa_widget_get(devinfo, 31);
579 if ((w->wclass.pin.config &
580 HDA_CONFIG_DEFAULTCONF_DEVICE_MASK) ==
581 HDA_CONFIG_DEFAULTCONF_DEVICE_MIC_IN) {
582 w = hdaa_widget_get(devinfo, 16);
584 w->connsenable[2] = 0;
586 w = hdaa_widget_get(devinfo, 15);
588 w->connsenable[0] = 0;
591 w = hdaa_widget_get(devinfo, 32);
593 if ((w->wclass.pin.config &
594 HDA_CONFIG_DEFAULTCONF_DEVICE_MASK) ==
595 HDA_CONFIG_DEFAULTCONF_DEVICE_MIC_IN) {
596 w = hdaa_widget_get(devinfo, 16);
598 w->connsenable[0] = 0;
600 w = hdaa_widget_get(devinfo, 15);
602 w->connsenable[1] = 0;
606 if (subid == ASUS_A8X_SUBVENDOR) {
608 * This is just plain ridiculous.. There
609 * are several A8 series that share the same
610 * pci id but works differently (EAPD).
612 w = hdaa_widget_get(devinfo, 26);
613 if (w != NULL && w->type ==
614 HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX &&
615 (w->wclass.pin.config &
616 HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_MASK) !=
617 HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_NONE)
622 case HDA_CODEC_AD1981HD:
624 * This CODEC has very unusual design with several
625 * points inappropriate for the present parser.
627 /* Disable recording from mono playback mix. */
628 w = hdaa_widget_get(devinfo, 21);
630 w->connsenable[3] = 0;
631 /* Disable rear to front mic mixer, use separately. */
632 w = hdaa_widget_get(devinfo, 31);
635 /* Disable direct playback, use mixer. */
636 w = hdaa_widget_get(devinfo, 5);
638 w->connsenable[0] = 0;
639 w = hdaa_widget_get(devinfo, 6);
641 w->connsenable[0] = 0;
642 w = hdaa_widget_get(devinfo, 9);
644 w->connsenable[0] = 0;
645 w = hdaa_widget_get(devinfo, 24);
647 w->connsenable[0] = 0;
649 case HDA_CODEC_ALC269:
651 * ASUS EeePC 1001px has strange variant of ALC269 CODEC,
652 * that mutes speaker if unused mixer at NID 15 is muted.
653 * Probably CODEC incorrectly reports internal connections.
654 * Hide that muter from the driver. There are several CODECs
655 * sharing this ID and I have not enough information about
656 * them to implement more universal solution.
658 if (subid == 0x84371043) {
659 w = hdaa_widget_get(devinfo, 15);
661 w->param.inamp_cap = 0;
664 case HDA_CODEC_CX20582:
665 case HDA_CODEC_CX20583:
666 case HDA_CODEC_CX20584:
667 case HDA_CODEC_CX20585:
668 case HDA_CODEC_CX20590:
670 * These codecs have extra connectivity on record side
671 * too reach for the present parser.
673 w = hdaa_widget_get(devinfo, 20);
675 w->connsenable[1] = 0;
676 w = hdaa_widget_get(devinfo, 21);
678 w->connsenable[1] = 0;
679 w = hdaa_widget_get(devinfo, 22);
681 w->connsenable[0] = 0;
683 case HDA_CODEC_VT1708S_0:
684 case HDA_CODEC_VT1708S_1:
685 case HDA_CODEC_VT1708S_2:
686 case HDA_CODEC_VT1708S_3:
687 case HDA_CODEC_VT1708S_4:
688 case HDA_CODEC_VT1708S_5:
689 case HDA_CODEC_VT1708S_6:
690 case HDA_CODEC_VT1708S_7:
692 * These codecs have hidden mic boost controls.
694 w = hdaa_widget_get(devinfo, 26);
697 (40 << HDA_PARAM_OUTPUT_AMP_CAP_STEPSIZE_SHIFT) |
698 (3 << HDA_PARAM_OUTPUT_AMP_CAP_NUMSTEPS_SHIFT) |
699 (0 << HDA_PARAM_OUTPUT_AMP_CAP_OFFSET_SHIFT);
700 w = hdaa_widget_get(devinfo, 30);
703 (40 << HDA_PARAM_OUTPUT_AMP_CAP_STEPSIZE_SHIFT) |
704 (3 << HDA_PARAM_OUTPUT_AMP_CAP_NUMSTEPS_SHIFT) |
705 (0 << HDA_PARAM_OUTPUT_AMP_CAP_OFFSET_SHIFT);
711 hdaa_read_coef(device_t dev, nid_t nid, uint16_t idx)
714 hda_command(dev, HDA_CMD_SET_COEFF_INDEX(0, nid, idx));
715 return (hda_command(dev, HDA_CMD_GET_PROCESSING_COEFF(0, nid)));
719 hdaa_write_coef(device_t dev, nid_t nid, uint16_t idx, uint16_t val)
722 hda_command(dev, HDA_CMD_SET_COEFF_INDEX(0, nid, idx));
723 return (hda_command(dev, HDA_CMD_SET_PROCESSING_COEFF(0, nid, val)));
727 hdaa_patch_direct(struct hdaa_devinfo *devinfo)
729 device_t dev = devinfo->dev;
730 uint32_t id, subid, val;
732 id = hdaa_codec_id(devinfo);
733 subid = hdaa_card_id(devinfo);
736 case HDA_CODEC_VT1708S_0:
737 case HDA_CODEC_VT1708S_1:
738 case HDA_CODEC_VT1708S_2:
739 case HDA_CODEC_VT1708S_3:
740 case HDA_CODEC_VT1708S_4:
741 case HDA_CODEC_VT1708S_5:
742 case HDA_CODEC_VT1708S_6:
743 case HDA_CODEC_VT1708S_7:
744 /* Enable Mic Boost Volume controls. */
745 hda_command(dev, HDA_CMD_12BIT(0, devinfo->nid,
748 case HDA_CODEC_VT1818S:
749 /* Don't bypass mixer. */
750 hda_command(dev, HDA_CMD_12BIT(0, devinfo->nid,
753 case HDA_CODEC_ALC1150:
754 if (subid == 0xd9781462) {
755 /* Too low volume on MSI H170 GAMING M3. */
756 hdaa_write_coef(dev, 0x20, 0x07, 0x7cb);
760 if (subid == APPLE_INTEL_MAC)
761 hda_command(dev, HDA_CMD_12BIT(0, devinfo->nid,
763 if (id == HDA_CODEC_ALC269) {
764 if (subid == 0x16e31043 || subid == 0x831a1043 ||
765 subid == 0x834a1043 || subid == 0x83981043 ||
766 subid == 0x83ce1043) {
768 * The ditital mics on some Asus laptops produce
769 * differential signals instead of expected stereo.
770 * That results in silence if downmix it to mono.
771 * To workaround, make codec to handle signal as mono.
773 val = hdaa_read_coef(dev, 0x20, 0x07);
774 hdaa_write_coef(dev, 0x20, 0x07, val|0x80);
776 if (subid == 0x15171043) {
777 /* Increase output amp on ASUS UX31A by +5dB. */
778 hdaa_write_coef(dev, 0x20, 0x12, 0x2800);