diff options
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 64 | ||||
-rw-r--r-- | sound/pci/hda/patch_via.c | 41 |
2 files changed, 80 insertions, 25 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 98cc465992f2..ba95039e8ca3 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -1459,22 +1459,31 @@ struct alc_fixup { | |||
1459 | 1459 | ||
1460 | static void alc_pick_fixup(struct hda_codec *codec, | 1460 | static void alc_pick_fixup(struct hda_codec *codec, |
1461 | const struct snd_pci_quirk *quirk, | 1461 | const struct snd_pci_quirk *quirk, |
1462 | const struct alc_fixup *fix) | 1462 | const struct alc_fixup *fix, |
1463 | int pre_init) | ||
1463 | { | 1464 | { |
1464 | const struct alc_pincfg *cfg; | 1465 | const struct alc_pincfg *cfg; |
1465 | 1466 | ||
1466 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); | 1467 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
1467 | if (!quirk) | 1468 | if (!quirk) |
1468 | return; | 1469 | return; |
1469 | |||
1470 | fix += quirk->value; | 1470 | fix += quirk->value; |
1471 | cfg = fix->pins; | 1471 | cfg = fix->pins; |
1472 | if (cfg) { | 1472 | if (pre_init && cfg) { |
1473 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
1474 | snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n", | ||
1475 | codec->chip_name, quirk->name); | ||
1476 | #endif | ||
1473 | for (; cfg->nid; cfg++) | 1477 | for (; cfg->nid; cfg++) |
1474 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); | 1478 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
1475 | } | 1479 | } |
1476 | if (fix->verbs) | 1480 | if (!pre_init && fix->verbs) { |
1481 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
1482 | snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n", | ||
1483 | codec->chip_name, quirk->name); | ||
1484 | #endif | ||
1477 | add_verb(codec->spec, fix->verbs); | 1485 | add_verb(codec->spec, fix->verbs); |
1486 | } | ||
1478 | } | 1487 | } |
1479 | 1488 | ||
1480 | static int alc_read_coef_idx(struct hda_codec *codec, | 1489 | static int alc_read_coef_idx(struct hda_codec *codec, |
@@ -10535,7 +10544,8 @@ static int patch_alc882(struct hda_codec *codec) | |||
10535 | board_config = ALC882_AUTO; | 10544 | board_config = ALC882_AUTO; |
10536 | } | 10545 | } |
10537 | 10546 | ||
10538 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups); | 10547 | if (board_config == ALC882_AUTO) |
10548 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1); | ||
10539 | 10549 | ||
10540 | if (board_config == ALC882_AUTO) { | 10550 | if (board_config == ALC882_AUTO) { |
10541 | /* automatic parse from the BIOS config */ | 10551 | /* automatic parse from the BIOS config */ |
@@ -10610,6 +10620,9 @@ static int patch_alc882(struct hda_codec *codec) | |||
10610 | if (spec->cdefine.enable_pcbeep) | 10620 | if (spec->cdefine.enable_pcbeep) |
10611 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | 10621 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
10612 | 10622 | ||
10623 | if (board_config == ALC882_AUTO) | ||
10624 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0); | ||
10625 | |||
10613 | spec->vmaster_nid = 0x0c; | 10626 | spec->vmaster_nid = 0x0c; |
10614 | 10627 | ||
10615 | codec->patch_ops = alc_patch_ops; | 10628 | codec->patch_ops = alc_patch_ops; |
@@ -14192,6 +14205,27 @@ static void alc269_auto_init(struct hda_codec *codec) | |||
14192 | alc_inithook(codec); | 14205 | alc_inithook(codec); |
14193 | } | 14206 | } |
14194 | 14207 | ||
14208 | enum { | ||
14209 | ALC269_FIXUP_SONY_VAIO, | ||
14210 | }; | ||
14211 | |||
14212 | const static struct hda_verb alc269_sony_vaio_fixup_verbs[] = { | ||
14213 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, | ||
14214 | {} | ||
14215 | }; | ||
14216 | |||
14217 | static const struct alc_fixup alc269_fixups[] = { | ||
14218 | [ALC269_FIXUP_SONY_VAIO] = { | ||
14219 | .verbs = alc269_sony_vaio_fixup_verbs | ||
14220 | }, | ||
14221 | }; | ||
14222 | |||
14223 | static struct snd_pci_quirk alc269_fixup_tbl[] = { | ||
14224 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), | ||
14225 | {} | ||
14226 | }; | ||
14227 | |||
14228 | |||
14195 | /* | 14229 | /* |
14196 | * configuration and preset | 14230 | * configuration and preset |
14197 | */ | 14231 | */ |
@@ -14251,7 +14285,7 @@ static struct snd_pci_quirk alc269_cfg_tbl[] = { | |||
14251 | ALC269_DMIC), | 14285 | ALC269_DMIC), |
14252 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), | 14286 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), |
14253 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), | 14287 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), |
14254 | SND_PCI_QUIRK(0x104d, 0x9071, "SONY XTB", ALC269_DMIC), | 14288 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), |
14255 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), | 14289 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
14256 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), | 14290 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), |
14257 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), | 14291 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
@@ -14405,6 +14439,9 @@ static int patch_alc269(struct hda_codec *codec) | |||
14405 | board_config = ALC269_AUTO; | 14439 | board_config = ALC269_AUTO; |
14406 | } | 14440 | } |
14407 | 14441 | ||
14442 | if (board_config == ALC269_AUTO) | ||
14443 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1); | ||
14444 | |||
14408 | if (board_config == ALC269_AUTO) { | 14445 | if (board_config == ALC269_AUTO) { |
14409 | /* automatic parse from the BIOS config */ | 14446 | /* automatic parse from the BIOS config */ |
14410 | err = alc269_parse_auto_config(codec); | 14447 | err = alc269_parse_auto_config(codec); |
@@ -14458,6 +14495,9 @@ static int patch_alc269(struct hda_codec *codec) | |||
14458 | if (spec->cdefine.enable_pcbeep) | 14495 | if (spec->cdefine.enable_pcbeep) |
14459 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); | 14496 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
14460 | 14497 | ||
14498 | if (board_config == ALC269_AUTO) | ||
14499 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0); | ||
14500 | |||
14461 | spec->vmaster_nid = 0x02; | 14501 | spec->vmaster_nid = 0x02; |
14462 | 14502 | ||
14463 | codec->patch_ops = alc_patch_ops; | 14503 | codec->patch_ops = alc_patch_ops; |
@@ -15548,7 +15588,8 @@ static int patch_alc861(struct hda_codec *codec) | |||
15548 | board_config = ALC861_AUTO; | 15588 | board_config = ALC861_AUTO; |
15549 | } | 15589 | } |
15550 | 15590 | ||
15551 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups); | 15591 | if (board_config == ALC861_AUTO) |
15592 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1); | ||
15552 | 15593 | ||
15553 | if (board_config == ALC861_AUTO) { | 15594 | if (board_config == ALC861_AUTO) { |
15554 | /* automatic parse from the BIOS config */ | 15595 | /* automatic parse from the BIOS config */ |
@@ -15585,6 +15626,9 @@ static int patch_alc861(struct hda_codec *codec) | |||
15585 | 15626 | ||
15586 | spec->vmaster_nid = 0x03; | 15627 | spec->vmaster_nid = 0x03; |
15587 | 15628 | ||
15629 | if (board_config == ALC861_AUTO) | ||
15630 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0); | ||
15631 | |||
15588 | codec->patch_ops = alc_patch_ops; | 15632 | codec->patch_ops = alc_patch_ops; |
15589 | if (board_config == ALC861_AUTO) { | 15633 | if (board_config == ALC861_AUTO) { |
15590 | spec->init_hook = alc861_auto_init; | 15634 | spec->init_hook = alc861_auto_init; |
@@ -16519,7 +16563,8 @@ static int patch_alc861vd(struct hda_codec *codec) | |||
16519 | board_config = ALC861VD_AUTO; | 16563 | board_config = ALC861VD_AUTO; |
16520 | } | 16564 | } |
16521 | 16565 | ||
16522 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups); | 16566 | if (board_config == ALC861VD_AUTO) |
16567 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1); | ||
16523 | 16568 | ||
16524 | if (board_config == ALC861VD_AUTO) { | 16569 | if (board_config == ALC861VD_AUTO) { |
16525 | /* automatic parse from the BIOS config */ | 16570 | /* automatic parse from the BIOS config */ |
@@ -16567,6 +16612,9 @@ static int patch_alc861vd(struct hda_codec *codec) | |||
16567 | 16612 | ||
16568 | spec->vmaster_nid = 0x02; | 16613 | spec->vmaster_nid = 0x02; |
16569 | 16614 | ||
16615 | if (board_config == ALC861VD_AUTO) | ||
16616 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0); | ||
16617 | |||
16570 | codec->patch_ops = alc_patch_ops; | 16618 | codec->patch_ops = alc_patch_ops; |
16571 | 16619 | ||
16572 | if (board_config == ALC861VD_AUTO) | 16620 | if (board_config == ALC861VD_AUTO) |
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 9ddc37300f6b..73453814e098 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c | |||
@@ -476,7 +476,7 @@ static struct snd_kcontrol_new *via_clone_control(struct via_spec *spec, | |||
476 | knew->name = kstrdup(tmpl->name, GFP_KERNEL); | 476 | knew->name = kstrdup(tmpl->name, GFP_KERNEL); |
477 | if (!knew->name) | 477 | if (!knew->name) |
478 | return NULL; | 478 | return NULL; |
479 | return 0; | 479 | return knew; |
480 | } | 480 | } |
481 | 481 | ||
482 | static void via_free_kctls(struct hda_codec *codec) | 482 | static void via_free_kctls(struct hda_codec *codec) |
@@ -1215,14 +1215,13 @@ static struct snd_kcontrol_new via_hp_mixer[2] = { | |||
1215 | }, | 1215 | }, |
1216 | }; | 1216 | }; |
1217 | 1217 | ||
1218 | static int via_hp_build(struct via_spec *spec) | 1218 | static int via_hp_build(struct hda_codec *codec) |
1219 | { | 1219 | { |
1220 | struct via_spec *spec = codec->spec; | ||
1220 | struct snd_kcontrol_new *knew; | 1221 | struct snd_kcontrol_new *knew; |
1221 | hda_nid_t nid; | 1222 | hda_nid_t nid; |
1222 | 1223 | int nums; | |
1223 | knew = via_clone_control(spec, &via_hp_mixer[0]); | 1224 | hda_nid_t conn[HDA_MAX_CONNECTIONS]; |
1224 | if (knew == NULL) | ||
1225 | return -ENOMEM; | ||
1226 | 1225 | ||
1227 | switch (spec->codec_type) { | 1226 | switch (spec->codec_type) { |
1228 | case VT1718S: | 1227 | case VT1718S: |
@@ -1239,6 +1238,14 @@ static int via_hp_build(struct via_spec *spec) | |||
1239 | break; | 1238 | break; |
1240 | } | 1239 | } |
1241 | 1240 | ||
1241 | nums = snd_hda_get_connections(codec, nid, conn, HDA_MAX_CONNECTIONS); | ||
1242 | if (nums <= 1) | ||
1243 | return 0; | ||
1244 | |||
1245 | knew = via_clone_control(spec, &via_hp_mixer[0]); | ||
1246 | if (knew == NULL) | ||
1247 | return -ENOMEM; | ||
1248 | |||
1242 | knew->subdevice = HDA_SUBDEV_NID_FLAG | nid; | 1249 | knew->subdevice = HDA_SUBDEV_NID_FLAG | nid; |
1243 | knew->private_value = nid; | 1250 | knew->private_value = nid; |
1244 | 1251 | ||
@@ -2561,7 +2568,7 @@ static int vt1708_parse_auto_config(struct hda_codec *codec) | |||
2561 | spec->input_mux = &spec->private_imux[0]; | 2568 | spec->input_mux = &spec->private_imux[0]; |
2562 | 2569 | ||
2563 | if (spec->hp_mux) | 2570 | if (spec->hp_mux) |
2564 | via_hp_build(spec); | 2571 | via_hp_build(codec); |
2565 | 2572 | ||
2566 | via_smart51_build(spec); | 2573 | via_smart51_build(spec); |
2567 | return 1; | 2574 | return 1; |
@@ -3087,7 +3094,7 @@ static int vt1709_parse_auto_config(struct hda_codec *codec) | |||
3087 | spec->input_mux = &spec->private_imux[0]; | 3094 | spec->input_mux = &spec->private_imux[0]; |
3088 | 3095 | ||
3089 | if (spec->hp_mux) | 3096 | if (spec->hp_mux) |
3090 | via_hp_build(spec); | 3097 | via_hp_build(codec); |
3091 | 3098 | ||
3092 | via_smart51_build(spec); | 3099 | via_smart51_build(spec); |
3093 | return 1; | 3100 | return 1; |
@@ -3654,7 +3661,7 @@ static int vt1708B_parse_auto_config(struct hda_codec *codec) | |||
3654 | spec->input_mux = &spec->private_imux[0]; | 3661 | spec->input_mux = &spec->private_imux[0]; |
3655 | 3662 | ||
3656 | if (spec->hp_mux) | 3663 | if (spec->hp_mux) |
3657 | via_hp_build(spec); | 3664 | via_hp_build(codec); |
3658 | 3665 | ||
3659 | via_smart51_build(spec); | 3666 | via_smart51_build(spec); |
3660 | return 1; | 3667 | return 1; |
@@ -4140,7 +4147,7 @@ static int vt1708S_parse_auto_config(struct hda_codec *codec) | |||
4140 | spec->input_mux = &spec->private_imux[0]; | 4147 | spec->input_mux = &spec->private_imux[0]; |
4141 | 4148 | ||
4142 | if (spec->hp_mux) | 4149 | if (spec->hp_mux) |
4143 | via_hp_build(spec); | 4150 | via_hp_build(codec); |
4144 | 4151 | ||
4145 | via_smart51_build(spec); | 4152 | via_smart51_build(spec); |
4146 | return 1; | 4153 | return 1; |
@@ -4510,7 +4517,7 @@ static int vt1702_parse_auto_config(struct hda_codec *codec) | |||
4510 | spec->input_mux = &spec->private_imux[0]; | 4517 | spec->input_mux = &spec->private_imux[0]; |
4511 | 4518 | ||
4512 | if (spec->hp_mux) | 4519 | if (spec->hp_mux) |
4513 | via_hp_build(spec); | 4520 | via_hp_build(codec); |
4514 | 4521 | ||
4515 | return 1; | 4522 | return 1; |
4516 | } | 4523 | } |
@@ -4930,7 +4937,7 @@ static int vt1718S_parse_auto_config(struct hda_codec *codec) | |||
4930 | spec->input_mux = &spec->private_imux[0]; | 4937 | spec->input_mux = &spec->private_imux[0]; |
4931 | 4938 | ||
4932 | if (spec->hp_mux) | 4939 | if (spec->hp_mux) |
4933 | via_hp_build(spec); | 4940 | via_hp_build(codec); |
4934 | 4941 | ||
4935 | via_smart51_build(spec); | 4942 | via_smart51_build(spec); |
4936 | 4943 | ||
@@ -5425,7 +5432,7 @@ static int vt1716S_parse_auto_config(struct hda_codec *codec) | |||
5425 | spec->input_mux = &spec->private_imux[0]; | 5432 | spec->input_mux = &spec->private_imux[0]; |
5426 | 5433 | ||
5427 | if (spec->hp_mux) | 5434 | if (spec->hp_mux) |
5428 | via_hp_build(spec); | 5435 | via_hp_build(codec); |
5429 | 5436 | ||
5430 | via_smart51_build(spec); | 5437 | via_smart51_build(spec); |
5431 | 5438 | ||
@@ -5781,7 +5788,7 @@ static int vt2002P_parse_auto_config(struct hda_codec *codec) | |||
5781 | spec->input_mux = &spec->private_imux[0]; | 5788 | spec->input_mux = &spec->private_imux[0]; |
5782 | 5789 | ||
5783 | if (spec->hp_mux) | 5790 | if (spec->hp_mux) |
5784 | via_hp_build(spec); | 5791 | via_hp_build(codec); |
5785 | 5792 | ||
5786 | return 1; | 5793 | return 1; |
5787 | } | 5794 | } |
@@ -6000,12 +6007,12 @@ static int vt1812_auto_create_multi_out_ctls(struct via_spec *spec, | |||
6000 | 6007 | ||
6001 | /* Line-Out: PortE */ | 6008 | /* Line-Out: PortE */ |
6002 | err = via_add_control(spec, VIA_CTL_WIDGET_VOL, | 6009 | err = via_add_control(spec, VIA_CTL_WIDGET_VOL, |
6003 | "Master Front Playback Volume", | 6010 | "Front Playback Volume", |
6004 | HDA_COMPOSE_AMP_VAL(0x8, 3, 0, HDA_OUTPUT)); | 6011 | HDA_COMPOSE_AMP_VAL(0x8, 3, 0, HDA_OUTPUT)); |
6005 | if (err < 0) | 6012 | if (err < 0) |
6006 | return err; | 6013 | return err; |
6007 | err = via_add_control(spec, VIA_CTL_WIDGET_BIND_PIN_MUTE, | 6014 | err = via_add_control(spec, VIA_CTL_WIDGET_BIND_PIN_MUTE, |
6008 | "Master Front Playback Switch", | 6015 | "Front Playback Switch", |
6009 | HDA_COMPOSE_AMP_VAL(0x28, 3, 0, HDA_OUTPUT)); | 6016 | HDA_COMPOSE_AMP_VAL(0x28, 3, 0, HDA_OUTPUT)); |
6010 | if (err < 0) | 6017 | if (err < 0) |
6011 | return err; | 6018 | return err; |
@@ -6130,7 +6137,7 @@ static int vt1812_parse_auto_config(struct hda_codec *codec) | |||
6130 | spec->input_mux = &spec->private_imux[0]; | 6137 | spec->input_mux = &spec->private_imux[0]; |
6131 | 6138 | ||
6132 | if (spec->hp_mux) | 6139 | if (spec->hp_mux) |
6133 | via_hp_build(spec); | 6140 | via_hp_build(codec); |
6134 | 6141 | ||
6135 | return 1; | 6142 | return 1; |
6136 | } | 6143 | } |