diff options
| -rw-r--r-- | sound/pci/hda/patch_realtek.c | 89 |
1 files changed, 67 insertions, 22 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 7810d3dcad83..470fd74a0a1a 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
| @@ -1332,15 +1332,20 @@ do_sku: | |||
| 1332 | * when the external headphone out jack is plugged" | 1332 | * when the external headphone out jack is plugged" |
| 1333 | */ | 1333 | */ |
| 1334 | if (!spec->autocfg.hp_pins[0]) { | 1334 | if (!spec->autocfg.hp_pins[0]) { |
| 1335 | hda_nid_t nid; | ||
| 1335 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ | 1336 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 1336 | if (tmp == 0) | 1337 | if (tmp == 0) |
| 1337 | spec->autocfg.hp_pins[0] = porta; | 1338 | nid = porta; |
| 1338 | else if (tmp == 1) | 1339 | else if (tmp == 1) |
| 1339 | spec->autocfg.hp_pins[0] = porte; | 1340 | nid = porte; |
| 1340 | else if (tmp == 2) | 1341 | else if (tmp == 2) |
| 1341 | spec->autocfg.hp_pins[0] = portd; | 1342 | nid = portd; |
| 1342 | else | 1343 | else |
| 1343 | return 1; | 1344 | return 1; |
| 1345 | for (i = 0; i < spec->autocfg.line_outs; i++) | ||
| 1346 | if (spec->autocfg.line_out_pins[i] == nid) | ||
| 1347 | return 1; | ||
| 1348 | spec->autocfg.hp_pins[0] = nid; | ||
| 1344 | } | 1349 | } |
| 1345 | 1350 | ||
| 1346 | alc_init_auto_hp(codec); | 1351 | alc_init_auto_hp(codec); |
| @@ -1362,7 +1367,7 @@ static void alc_ssid_check(struct hda_codec *codec, | |||
| 1362 | } | 1367 | } |
| 1363 | 1368 | ||
| 1364 | /* | 1369 | /* |
| 1365 | * Fix-up pin default configurations | 1370 | * Fix-up pin default configurations and add default verbs |
| 1366 | */ | 1371 | */ |
| 1367 | 1372 | ||
| 1368 | struct alc_pincfg { | 1373 | struct alc_pincfg { |
| @@ -1370,9 +1375,14 @@ struct alc_pincfg { | |||
| 1370 | u32 val; | 1375 | u32 val; |
| 1371 | }; | 1376 | }; |
| 1372 | 1377 | ||
| 1373 | static void alc_fix_pincfg(struct hda_codec *codec, | 1378 | struct alc_fixup { |
| 1379 | const struct alc_pincfg *pins; | ||
| 1380 | const struct hda_verb *verbs; | ||
| 1381 | }; | ||
| 1382 | |||
| 1383 | static void alc_pick_fixup(struct hda_codec *codec, | ||
| 1374 | const struct snd_pci_quirk *quirk, | 1384 | const struct snd_pci_quirk *quirk, |
| 1375 | const struct alc_pincfg **pinfix) | 1385 | const struct alc_fixup *fix) |
| 1376 | { | 1386 | { |
| 1377 | const struct alc_pincfg *cfg; | 1387 | const struct alc_pincfg *cfg; |
| 1378 | 1388 | ||
| @@ -1380,9 +1390,14 @@ static void alc_fix_pincfg(struct hda_codec *codec, | |||
| 1380 | if (!quirk) | 1390 | if (!quirk) |
| 1381 | return; | 1391 | return; |
| 1382 | 1392 | ||
| 1383 | cfg = pinfix[quirk->value]; | 1393 | fix += quirk->value; |
| 1384 | for (; cfg->nid; cfg++) | 1394 | cfg = fix->pins; |
| 1385 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); | 1395 | if (cfg) { |
| 1396 | for (; cfg->nid; cfg++) | ||
| 1397 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); | ||
| 1398 | } | ||
| 1399 | if (fix->verbs) | ||
| 1400 | add_verb(codec->spec, fix->verbs); | ||
| 1386 | } | 1401 | } |
| 1387 | 1402 | ||
| 1388 | /* | 1403 | /* |
| @@ -9593,11 +9608,13 @@ static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { | |||
| 9593 | { } | 9608 | { } |
| 9594 | }; | 9609 | }; |
| 9595 | 9610 | ||
| 9596 | static const struct alc_pincfg *alc882_pin_fixes[] = { | 9611 | static const struct alc_fixup alc882_fixups[] = { |
| 9597 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, | 9612 | [PINFIX_ABIT_AW9D_MAX] = { |
| 9613 | .pins = alc882_abit_aw9d_pinfix | ||
| 9614 | }, | ||
| 9598 | }; | 9615 | }; |
| 9599 | 9616 | ||
| 9600 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { | 9617 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
| 9601 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), | 9618 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 9602 | {} | 9619 | {} |
| 9603 | }; | 9620 | }; |
| @@ -9869,7 +9886,7 @@ static int patch_alc882(struct hda_codec *codec) | |||
| 9869 | board_config = ALC882_AUTO; | 9886 | board_config = ALC882_AUTO; |
| 9870 | } | 9887 | } |
| 9871 | 9888 | ||
| 9872 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); | 9889 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups); |
| 9873 | 9890 | ||
| 9874 | if (board_config == ALC882_AUTO) { | 9891 | if (board_config == ALC882_AUTO) { |
| 9875 | /* automatic parse from the BIOS config */ | 9892 | /* automatic parse from the BIOS config */ |
| @@ -12842,12 +12859,15 @@ static int patch_alc268(struct hda_codec *codec) | |||
| 12842 | unsigned int wcap = get_wcaps(codec, 0x07); | 12859 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 12843 | int i; | 12860 | int i; |
| 12844 | 12861 | ||
| 12862 | spec->capsrc_nids = alc268_capsrc_nids; | ||
| 12845 | /* get type */ | 12863 | /* get type */ |
| 12846 | wcap = get_wcaps_type(wcap); | 12864 | wcap = get_wcaps_type(wcap); |
| 12847 | if (spec->auto_mic || | 12865 | if (spec->auto_mic || |
| 12848 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { | 12866 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
| 12849 | spec->adc_nids = alc268_adc_nids_alt; | 12867 | spec->adc_nids = alc268_adc_nids_alt; |
| 12850 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); | 12868 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
| 12869 | if (spec->auto_mic) | ||
| 12870 | fixup_automic_adc(codec); | ||
| 12851 | if (spec->auto_mic || spec->input_mux->num_items == 1) | 12871 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
| 12852 | add_mixer(spec, alc268_capture_nosrc_mixer); | 12872 | add_mixer(spec, alc268_capture_nosrc_mixer); |
| 12853 | else | 12873 | else |
| @@ -12857,7 +12877,6 @@ static int patch_alc268(struct hda_codec *codec) | |||
| 12857 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); | 12877 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
| 12858 | add_mixer(spec, alc268_capture_mixer); | 12878 | add_mixer(spec, alc268_capture_mixer); |
| 12859 | } | 12879 | } |
| 12860 | spec->capsrc_nids = alc268_capsrc_nids; | ||
| 12861 | /* set default input source */ | 12880 | /* set default input source */ |
| 12862 | for (i = 0; i < spec->num_adc_nids; i++) | 12881 | for (i = 0; i < spec->num_adc_nids; i++) |
| 12863 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], | 12882 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| @@ -14357,15 +14376,16 @@ static void alc861_auto_init_multi_out(struct hda_codec *codec) | |||
| 14357 | static void alc861_auto_init_hp_out(struct hda_codec *codec) | 14376 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 14358 | { | 14377 | { |
| 14359 | struct alc_spec *spec = codec->spec; | 14378 | struct alc_spec *spec = codec->spec; |
| 14360 | hda_nid_t pin; | ||
| 14361 | 14379 | ||
| 14362 | pin = spec->autocfg.hp_pins[0]; | 14380 | if (spec->autocfg.hp_outs) |
| 14363 | if (pin) | 14381 | alc861_auto_set_output_and_unmute(codec, |
| 14364 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, | 14382 | spec->autocfg.hp_pins[0], |
| 14383 | PIN_HP, | ||
| 14365 | spec->multiout.hp_nid); | 14384 | spec->multiout.hp_nid); |
| 14366 | pin = spec->autocfg.speaker_pins[0]; | 14385 | if (spec->autocfg.speaker_outs) |
| 14367 | if (pin) | 14386 | alc861_auto_set_output_and_unmute(codec, |
| 14368 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, | 14387 | spec->autocfg.speaker_pins[0], |
| 14388 | PIN_OUT, | ||
| 14369 | spec->multiout.dac_nids[0]); | 14389 | spec->multiout.dac_nids[0]); |
| 14370 | } | 14390 | } |
| 14371 | 14391 | ||
| @@ -15158,7 +15178,7 @@ static struct snd_pci_quirk alc861vd_cfg_tbl[] = { | |||
| 15158 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), | 15178 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 15159 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), | 15179 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
| 15160 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), | 15180 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
| 15161 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), | 15181 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ |
| 15162 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), | 15182 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), |
| 15163 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), | 15183 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
| 15164 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), | 15184 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
| @@ -15551,6 +15571,29 @@ static void alc861vd_auto_init(struct hda_codec *codec) | |||
| 15551 | alc_inithook(codec); | 15571 | alc_inithook(codec); |
| 15552 | } | 15572 | } |
| 15553 | 15573 | ||
| 15574 | enum { | ||
| 15575 | ALC660VD_FIX_ASUS_GPIO1 | ||
| 15576 | }; | ||
| 15577 | |||
| 15578 | /* reset GPIO1 */ | ||
| 15579 | static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = { | ||
| 15580 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, | ||
| 15581 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | ||
| 15582 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | ||
| 15583 | { } | ||
| 15584 | }; | ||
| 15585 | |||
| 15586 | static const struct alc_fixup alc861vd_fixups[] = { | ||
| 15587 | [ALC660VD_FIX_ASUS_GPIO1] = { | ||
| 15588 | .verbs = alc660vd_fix_asus_gpio1_verbs, | ||
| 15589 | }, | ||
| 15590 | }; | ||
| 15591 | |||
| 15592 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { | ||
| 15593 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), | ||
| 15594 | {} | ||
| 15595 | }; | ||
| 15596 | |||
| 15554 | static int patch_alc861vd(struct hda_codec *codec) | 15597 | static int patch_alc861vd(struct hda_codec *codec) |
| 15555 | { | 15598 | { |
| 15556 | struct alc_spec *spec; | 15599 | struct alc_spec *spec; |
| @@ -15572,6 +15615,8 @@ static int patch_alc861vd(struct hda_codec *codec) | |||
| 15572 | board_config = ALC861VD_AUTO; | 15615 | board_config = ALC861VD_AUTO; |
| 15573 | } | 15616 | } |
| 15574 | 15617 | ||
| 15618 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups); | ||
| 15619 | |||
| 15575 | if (board_config == ALC861VD_AUTO) { | 15620 | if (board_config == ALC861VD_AUTO) { |
| 15576 | /* automatic parse from the BIOS config */ | 15621 | /* automatic parse from the BIOS config */ |
| 15577 | err = alc861vd_parse_auto_config(codec); | 15622 | err = alc861vd_parse_auto_config(codec); |
