aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_realtek.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r--sound/pci/hda/patch_realtek.c367
1 files changed, 220 insertions, 147 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 51c08edd7563..269dbff70b92 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -303,6 +303,8 @@ struct alc_customize_define {
303 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */ 303 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
304}; 304};
305 305
306struct alc_fixup;
307
306struct alc_spec { 308struct alc_spec {
307 /* codec parameterization */ 309 /* codec parameterization */
308 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ 310 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
@@ -404,6 +406,11 @@ struct alc_spec {
404 /* for PLL fix */ 406 /* for PLL fix */
405 hda_nid_t pll_nid; 407 hda_nid_t pll_nid;
406 unsigned int pll_coef_idx, pll_coef_bit; 408 unsigned int pll_coef_idx, pll_coef_bit;
409
410 /* fix-up list */
411 int fixup_id;
412 const struct alc_fixup *fixup_list;
413 const char *fixup_name;
407}; 414};
408 415
409/* 416/*
@@ -1683,88 +1690,131 @@ struct alc_model_fixup {
1683}; 1690};
1684 1691
1685struct alc_fixup { 1692struct alc_fixup {
1686 unsigned int sku; 1693 int type;
1687 const struct alc_pincfg *pins; 1694 bool chained;
1688 const struct hda_verb *verbs; 1695 int chain_id;
1689 void (*func)(struct hda_codec *codec, const struct alc_fixup *fix, 1696 union {
1690 int pre_init); 1697 unsigned int sku;
1698 const struct alc_pincfg *pins;
1699 const struct hda_verb *verbs;
1700 void (*func)(struct hda_codec *codec,
1701 const struct alc_fixup *fix,
1702 int action);
1703 } v;
1691}; 1704};
1692 1705
1693static void __alc_pick_fixup(struct hda_codec *codec, 1706enum {
1694 const struct alc_fixup *fix, 1707 ALC_FIXUP_INVALID,
1695 const char *modelname, 1708 ALC_FIXUP_SKU,
1696 int pre_init) 1709 ALC_FIXUP_PINS,
1710 ALC_FIXUP_VERBS,
1711 ALC_FIXUP_FUNC,
1712};
1713
1714enum {
1715 ALC_FIXUP_ACT_PRE_PROBE,
1716 ALC_FIXUP_ACT_PROBE,
1717 ALC_FIXUP_ACT_INIT,
1718};
1719
1720static void alc_apply_fixup(struct hda_codec *codec, int action)
1697{ 1721{
1698 const struct alc_pincfg *cfg; 1722 struct alc_spec *spec = codec->spec;
1699 struct alc_spec *spec; 1723 int id = spec->fixup_id;
1724 const char *modelname = spec->fixup_name;
1725 int depth = 0;
1700 1726
1701 cfg = fix->pins; 1727 if (!spec->fixup_list)
1702 if (pre_init && fix->sku) { 1728 return;
1703#ifdef CONFIG_SND_DEBUG_VERBOSE 1729
1704 snd_printdd(KERN_INFO "hda_codec: %s: Apply sku override for %s\n", 1730 while (id >= 0) {
1705 codec->chip_name, modelname); 1731 const struct alc_fixup *fix = spec->fixup_list + id;
1706#endif 1732 const struct alc_pincfg *cfg;
1707 spec = codec->spec; 1733
1708 spec->cdefine.sku_cfg = fix->sku; 1734 switch (fix->type) {
1709 spec->cdefine.fixup = 1; 1735 case ALC_FIXUP_SKU:
1710 } 1736 if (action != ALC_FIXUP_ACT_PRE_PROBE || !fix->v.sku)
1711 if (pre_init && cfg) { 1737 break;;
1712#ifdef CONFIG_SND_DEBUG_VERBOSE 1738 snd_printdd(KERN_INFO "hda_codec: %s: "
1713 snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n", 1739 "Apply sku override for %s\n",
1714 codec->chip_name, modelname); 1740 codec->chip_name, modelname);
1715#endif 1741 spec->cdefine.sku_cfg = fix->v.sku;
1716 for (; cfg->nid; cfg++) 1742 spec->cdefine.fixup = 1;
1717 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); 1743 break;
1718 } 1744 case ALC_FIXUP_PINS:
1719 if (!pre_init && fix->verbs) { 1745 cfg = fix->v.pins;
1720#ifdef CONFIG_SND_DEBUG_VERBOSE 1746 if (action != ALC_FIXUP_ACT_PRE_PROBE || !cfg)
1721 snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n", 1747 break;
1722 codec->chip_name, modelname); 1748 snd_printdd(KERN_INFO "hda_codec: %s: "
1723#endif 1749 "Apply pincfg for %s\n",
1724 add_verb(codec->spec, fix->verbs); 1750 codec->chip_name, modelname);
1725 } 1751 for (; cfg->nid; cfg++)
1726 if (fix->func) { 1752 snd_hda_codec_set_pincfg(codec, cfg->nid,
1727#ifdef CONFIG_SND_DEBUG_VERBOSE 1753 cfg->val);
1728 snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-func for %s\n", 1754 break;
1729 codec->chip_name, modelname); 1755 case ALC_FIXUP_VERBS:
1730#endif 1756 if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs)
1731 fix->func(codec, fix, pre_init); 1757 break;
1758 snd_printdd(KERN_INFO "hda_codec: %s: "
1759 "Apply fix-verbs for %s\n",
1760 codec->chip_name, modelname);
1761 add_verb(codec->spec, fix->v.verbs);
1762 break;
1763 case ALC_FIXUP_FUNC:
1764 if (!fix->v.func)
1765 break;
1766 snd_printdd(KERN_INFO "hda_codec: %s: "
1767 "Apply fix-func for %s\n",
1768 codec->chip_name, modelname);
1769 fix->v.func(codec, fix, action);
1770 break;
1771 default:
1772 snd_printk(KERN_ERR "hda_codec: %s: "
1773 "Invalid fixup type %d\n",
1774 codec->chip_name, fix->type);
1775 break;
1776 }
1777 if (!fix[id].chained)
1778 break;
1779 if (++depth > 10)
1780 break;
1781 id = fix[id].chain_id;
1732 } 1782 }
1733} 1783}
1734 1784
1735static void alc_pick_fixup(struct hda_codec *codec, 1785static void alc_pick_fixup(struct hda_codec *codec,
1736 const struct snd_pci_quirk *quirk, 1786 const struct alc_model_fixup *models,
1737 const struct alc_fixup *fix, 1787 const struct snd_pci_quirk *quirk,
1738 int pre_init) 1788 const struct alc_fixup *fixlist)
1739{ 1789{
1740 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); 1790 struct alc_spec *spec = codec->spec;
1741 if (quirk) { 1791 int id = -1;
1742 fix += quirk->value; 1792 const char *name = NULL;
1743#ifdef CONFIG_SND_DEBUG_VERBOSE
1744 __alc_pick_fixup(codec, fix, quirk->name, pre_init);
1745#else
1746 __alc_pick_fixup(codec, fix, NULL, pre_init);
1747#endif
1748 }
1749}
1750 1793
1751static void alc_pick_fixup_model(struct hda_codec *codec,
1752 const struct alc_model_fixup *models,
1753 const struct snd_pci_quirk *quirk,
1754 const struct alc_fixup *fix,
1755 int pre_init)
1756{
1757 if (codec->modelname && models) { 1794 if (codec->modelname && models) {
1758 while (models->name) { 1795 while (models->name) {
1759 if (!strcmp(codec->modelname, models->name)) { 1796 if (!strcmp(codec->modelname, models->name)) {
1760 fix += models->id; 1797 id = models->id;
1798 name = models->name;
1761 break; 1799 break;
1762 } 1800 }
1763 models++; 1801 models++;
1764 } 1802 }
1765 __alc_pick_fixup(codec, fix, codec->modelname, pre_init); 1803 }
1766 } else { 1804 if (id < 0) {
1767 alc_pick_fixup(codec, quirk, fix, pre_init); 1805 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1806 if (quirk) {
1807 id = quirk->value;
1808#ifdef CONFIG_SND_DEBUG_VERBOSE
1809 name = quirk->name;
1810#endif
1811 }
1812 }
1813
1814 spec->fixup_id = id;
1815 if (id >= 0) {
1816 spec->fixup_list = fixlist;
1817 spec->fixup_name = name;
1768 } 1818 }
1769} 1819}
1770 1820
@@ -2866,7 +2916,7 @@ static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2866/* 2916/*
2867 * slave controls for virtual master 2917 * slave controls for virtual master
2868 */ 2918 */
2869static const char *alc_slave_vols[] = { 2919static const char * const alc_slave_vols[] = {
2870 "Front Playback Volume", 2920 "Front Playback Volume",
2871 "Surround Playback Volume", 2921 "Surround Playback Volume",
2872 "Center Playback Volume", 2922 "Center Playback Volume",
@@ -2880,7 +2930,7 @@ static const char *alc_slave_vols[] = {
2880 NULL, 2930 NULL,
2881}; 2931};
2882 2932
2883static const char *alc_slave_sws[] = { 2933static const char * const alc_slave_sws[] = {
2884 "Front Playback Switch", 2934 "Front Playback Switch",
2885 "Surround Playback Switch", 2935 "Surround Playback Switch",
2886 "Center Playback Switch", 2936 "Center Playback Switch",
@@ -3861,6 +3911,8 @@ static int alc_init(struct hda_codec *codec)
3861 if (spec->init_hook) 3911 if (spec->init_hook)
3862 spec->init_hook(codec); 3912 spec->init_hook(codec);
3863 3913
3914 alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT);
3915
3864 hda_call_check_power_status(codec, 0x01); 3916 hda_call_check_power_status(codec, 0x01);
3865 return 0; 3917 return 0;
3866} 3918}
@@ -4559,7 +4611,7 @@ static struct hda_verb alc880_test_init_verbs[] = {
4559/* 4611/*
4560 */ 4612 */
4561 4613
4562static const char *alc880_models[ALC880_MODEL_LAST] = { 4614static const char * const alc880_models[ALC880_MODEL_LAST] = {
4563 [ALC880_3ST] = "3stack", 4615 [ALC880_3ST] = "3stack",
4564 [ALC880_TCL_S700] = "tcl", 4616 [ALC880_TCL_S700] = "tcl",
4565 [ALC880_3ST_DIG] = "3stack-digout", 4617 [ALC880_3ST_DIG] = "3stack-digout",
@@ -5092,7 +5144,7 @@ static const char *alc_get_line_out_pfx(const struct auto_pin_cfg *cfg,
5092static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, 5144static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
5093 const struct auto_pin_cfg *cfg) 5145 const struct auto_pin_cfg *cfg)
5094{ 5146{
5095 static const char *chname[4] = { 5147 static const char * const chname[4] = {
5096 "Front", "Surround", NULL /*CLFE*/, "Side" 5148 "Front", "Surround", NULL /*CLFE*/, "Side"
5097 }; 5149 };
5098 const char *pfx = alc_get_line_out_pfx(cfg, false); 5150 const char *pfx = alc_get_line_out_pfx(cfg, false);
@@ -7090,7 +7142,8 @@ enum {
7090 7142
7091static const struct alc_fixup alc260_fixups[] = { 7143static const struct alc_fixup alc260_fixups[] = {
7092 [PINFIX_HP_DC5750] = { 7144 [PINFIX_HP_DC5750] = {
7093 .pins = (const struct alc_pincfg[]) { 7145 .type = ALC_FIXUP_PINS,
7146 .v.pins = (const struct alc_pincfg[]) {
7094 { 0x11, 0x90130110 }, /* speaker */ 7147 { 0x11, 0x90130110 }, /* speaker */
7095 { } 7148 { }
7096 } 7149 }
@@ -7105,7 +7158,7 @@ static struct snd_pci_quirk alc260_fixup_tbl[] = {
7105/* 7158/*
7106 * ALC260 configurations 7159 * ALC260 configurations
7107 */ 7160 */
7108static const char *alc260_models[ALC260_MODEL_LAST] = { 7161static const char * const alc260_models[ALC260_MODEL_LAST] = {
7109 [ALC260_BASIC] = "basic", 7162 [ALC260_BASIC] = "basic",
7110 [ALC260_HP] = "hp", 7163 [ALC260_HP] = "hp",
7111 [ALC260_HP_3013] = "hp-3013", 7164 [ALC260_HP_3013] = "hp-3013",
@@ -7301,8 +7354,10 @@ static int patch_alc260(struct hda_codec *codec)
7301 board_config = ALC260_AUTO; 7354 board_config = ALC260_AUTO;
7302 } 7355 }
7303 7356
7304 if (board_config == ALC260_AUTO) 7357 if (board_config == ALC260_AUTO) {
7305 alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 1); 7358 alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups);
7359 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
7360 }
7306 7361
7307 if (board_config == ALC260_AUTO) { 7362 if (board_config == ALC260_AUTO) {
7308 /* automatic parse from the BIOS config */ 7363 /* automatic parse from the BIOS config */
@@ -7350,8 +7405,7 @@ static int patch_alc260(struct hda_codec *codec)
7350 set_capture_mixer(codec); 7405 set_capture_mixer(codec);
7351 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); 7406 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
7352 7407
7353 if (board_config == ALC260_AUTO) 7408 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
7354 alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 0);
7355 7409
7356 spec->vmaster_nid = 0x08; 7410 spec->vmaster_nid = 0x08;
7357 7411
@@ -9727,7 +9781,7 @@ static hda_nid_t alc1200_slave_dig_outs[] = {
9727/* 9781/*
9728 * configuration and preset 9782 * configuration and preset
9729 */ 9783 */
9730static const char *alc882_models[ALC882_MODEL_LAST] = { 9784static const char * const alc882_models[ALC882_MODEL_LAST] = {
9731 [ALC882_3ST_DIG] = "3stack-dig", 9785 [ALC882_3ST_DIG] = "3stack-dig",
9732 [ALC882_6ST_DIG] = "6stack-dig", 9786 [ALC882_6ST_DIG] = "6stack-dig",
9733 [ALC882_ARIMA] = "arima", 9787 [ALC882_ARIMA] = "arima",
@@ -10678,7 +10732,8 @@ enum {
10678 10732
10679static const struct alc_fixup alc882_fixups[] = { 10733static const struct alc_fixup alc882_fixups[] = {
10680 [PINFIX_ABIT_AW9D_MAX] = { 10734 [PINFIX_ABIT_AW9D_MAX] = {
10681 .pins = (const struct alc_pincfg[]) { 10735 .type = ALC_FIXUP_PINS,
10736 .v.pins = (const struct alc_pincfg[]) {
10682 { 0x15, 0x01080104 }, /* side */ 10737 { 0x15, 0x01080104 }, /* side */
10683 { 0x16, 0x01011012 }, /* rear */ 10738 { 0x16, 0x01011012 }, /* rear */
10684 { 0x17, 0x01016011 }, /* clfe */ 10739 { 0x17, 0x01016011 }, /* clfe */
@@ -10686,13 +10741,15 @@ static const struct alc_fixup alc882_fixups[] = {
10686 } 10741 }
10687 }, 10742 },
10688 [PINFIX_PB_M5210] = { 10743 [PINFIX_PB_M5210] = {
10689 .verbs = (const struct hda_verb[]) { 10744 .type = ALC_FIXUP_VERBS,
10745 .v.verbs = (const struct hda_verb[]) {
10690 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, 10746 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
10691 {} 10747 {}
10692 } 10748 }
10693 }, 10749 },
10694 [PINFIX_ACER_ASPIRE_7736] = { 10750 [PINFIX_ACER_ASPIRE_7736] = {
10695 .sku = ALC_FIXUP_SKU_IGNORE, 10751 .type = ALC_FIXUP_SKU,
10752 .v.sku = ALC_FIXUP_SKU_IGNORE,
10696 }, 10753 },
10697}; 10754};
10698 10755
@@ -10984,8 +11041,10 @@ static int patch_alc882(struct hda_codec *codec)
10984 board_config = ALC882_AUTO; 11041 board_config = ALC882_AUTO;
10985 } 11042 }
10986 11043
10987 if (board_config == ALC882_AUTO) 11044 if (board_config == ALC882_AUTO) {
10988 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1); 11045 alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups);
11046 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
11047 }
10989 11048
10990 alc_auto_parse_customize_define(codec); 11049 alc_auto_parse_customize_define(codec);
10991 11050
@@ -11061,8 +11120,7 @@ static int patch_alc882(struct hda_codec *codec)
11061 if (has_cdefine_beep(codec)) 11120 if (has_cdefine_beep(codec))
11062 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); 11121 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11063 11122
11064 if (board_config == ALC882_AUTO) 11123 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
11065 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0);
11066 11124
11067 spec->vmaster_nid = 0x0c; 11125 spec->vmaster_nid = 0x0c;
11068 11126
@@ -12452,19 +12510,14 @@ enum {
12452 12510
12453static const struct alc_fixup alc262_fixups[] = { 12511static const struct alc_fixup alc262_fixups[] = {
12454 [PINFIX_FSC_H270] = { 12512 [PINFIX_FSC_H270] = {
12455 .pins = (const struct alc_pincfg[]) { 12513 .type = ALC_FIXUP_PINS,
12514 .v.pins = (const struct alc_pincfg[]) {
12456 { 0x14, 0x99130110 }, /* speaker */ 12515 { 0x14, 0x99130110 }, /* speaker */
12457 { 0x15, 0x0221142f }, /* front HP */ 12516 { 0x15, 0x0221142f }, /* front HP */
12458 { 0x1b, 0x0121141f }, /* rear HP */ 12517 { 0x1b, 0x0121141f }, /* rear HP */
12459 { } 12518 { }
12460 } 12519 }
12461 }, 12520 },
12462 [PINFIX_PB_M5210] = {
12463 .verbs = (const struct hda_verb[]) {
12464 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
12465 {}
12466 }
12467 },
12468}; 12521};
12469 12522
12470static struct snd_pci_quirk alc262_fixup_tbl[] = { 12523static struct snd_pci_quirk alc262_fixup_tbl[] = {
@@ -12554,7 +12607,7 @@ static void alc262_auto_init(struct hda_codec *codec)
12554/* 12607/*
12555 * configuration and preset 12608 * configuration and preset
12556 */ 12609 */
12557static const char *alc262_models[ALC262_MODEL_LAST] = { 12610static const char * const alc262_models[ALC262_MODEL_LAST] = {
12558 [ALC262_BASIC] = "basic", 12611 [ALC262_BASIC] = "basic",
12559 [ALC262_HIPPO] = "hippo", 12612 [ALC262_HIPPO] = "hippo",
12560 [ALC262_HIPPO_1] = "hippo_1", 12613 [ALC262_HIPPO_1] = "hippo_1",
@@ -12895,8 +12948,10 @@ static int patch_alc262(struct hda_codec *codec)
12895 board_config = ALC262_AUTO; 12948 board_config = ALC262_AUTO;
12896 } 12949 }
12897 12950
12898 if (board_config == ALC262_AUTO) 12951 if (board_config == ALC262_AUTO) {
12899 alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 1); 12952 alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups);
12953 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
12954 }
12900 12955
12901 if (board_config == ALC262_AUTO) { 12956 if (board_config == ALC262_AUTO) {
12902 /* automatic parse from the BIOS config */ 12957 /* automatic parse from the BIOS config */
@@ -12966,8 +13021,7 @@ static int patch_alc262(struct hda_codec *codec)
12966 if (!spec->no_analog && has_cdefine_beep(codec)) 13021 if (!spec->no_analog && has_cdefine_beep(codec))
12967 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); 13022 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12968 13023
12969 if (board_config == ALC262_AUTO) 13024 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
12970 alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 0);
12971 13025
12972 spec->vmaster_nid = 0x0c; 13026 spec->vmaster_nid = 0x0c;
12973 13027
@@ -13741,7 +13795,7 @@ static void alc268_auto_init(struct hda_codec *codec)
13741/* 13795/*
13742 * configuration and preset 13796 * configuration and preset
13743 */ 13797 */
13744static const char *alc268_models[ALC268_MODEL_LAST] = { 13798static const char * const alc268_models[ALC268_MODEL_LAST] = {
13745 [ALC267_QUANTA_IL1] = "quanta-il1", 13799 [ALC267_QUANTA_IL1] = "quanta-il1",
13746 [ALC268_3ST] = "3stack", 13800 [ALC268_3ST] = "3stack",
13747 [ALC268_TOSHIBA] = "toshiba", 13801 [ALC268_TOSHIBA] = "toshiba",
@@ -14822,17 +14876,19 @@ static int alc269_resume(struct hda_codec *codec)
14822#endif /* SND_HDA_NEEDS_RESUME */ 14876#endif /* SND_HDA_NEEDS_RESUME */
14823 14877
14824static void alc269_fixup_hweq(struct hda_codec *codec, 14878static void alc269_fixup_hweq(struct hda_codec *codec,
14825 const struct alc_fixup *fix, int pre_init) 14879 const struct alc_fixup *fix, int action)
14826{ 14880{
14827 int coef; 14881 int coef;
14828 14882
14883 if (action != ALC_FIXUP_ACT_INIT)
14884 return;
14829 coef = alc_read_coef_idx(codec, 0x1e); 14885 coef = alc_read_coef_idx(codec, 0x1e);
14830 alc_write_coef_idx(codec, 0x1e, coef | 0x80); 14886 alc_write_coef_idx(codec, 0x1e, coef | 0x80);
14831} 14887}
14832 14888
14833enum { 14889enum {
14834 ALC269_FIXUP_SONY_VAIO, 14890 ALC269_FIXUP_SONY_VAIO,
14835 ALC275_FIX_SONY_VAIO_GPIO2, 14891 ALC275_FIXUP_SONY_VAIO_GPIO2,
14836 ALC269_FIXUP_DELL_M101Z, 14892 ALC269_FIXUP_DELL_M101Z,
14837 ALC269_FIXUP_SKU_IGNORE, 14893 ALC269_FIXUP_SKU_IGNORE,
14838 ALC269_FIXUP_ASUS_G73JW, 14894 ALC269_FIXUP_ASUS_G73JW,
@@ -14842,22 +14898,26 @@ enum {
14842 14898
14843static const struct alc_fixup alc269_fixups[] = { 14899static const struct alc_fixup alc269_fixups[] = {
14844 [ALC269_FIXUP_SONY_VAIO] = { 14900 [ALC269_FIXUP_SONY_VAIO] = {
14845 .verbs = (const struct hda_verb[]) { 14901 .type = ALC_FIXUP_VERBS,
14902 .v.verbs = (const struct hda_verb[]) {
14846 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, 14903 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14847 {} 14904 {}
14848 } 14905 }
14849 }, 14906 },
14850 [ALC275_FIX_SONY_VAIO_GPIO2] = { 14907 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
14851 .verbs = (const struct hda_verb[]) { 14908 .type = ALC_FIXUP_VERBS,
14909 .v.verbs = (const struct hda_verb[]) {
14852 {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, 14910 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
14853 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, 14911 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
14854 {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, 14912 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
14855 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14856 { } 14913 { }
14857 } 14914 },
14915 .chained = true,
14916 .chain_id = ALC269_FIXUP_SONY_VAIO
14858 }, 14917 },
14859 [ALC269_FIXUP_DELL_M101Z] = { 14918 [ALC269_FIXUP_DELL_M101Z] = {
14860 .verbs = (const struct hda_verb[]) { 14919 .type = ALC_FIXUP_VERBS,
14920 .v.verbs = (const struct hda_verb[]) {
14861 /* Enables internal speaker */ 14921 /* Enables internal speaker */
14862 {0x20, AC_VERB_SET_COEF_INDEX, 13}, 14922 {0x20, AC_VERB_SET_COEF_INDEX, 13},
14863 {0x20, AC_VERB_SET_PROC_COEF, 0x4040}, 14923 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
@@ -14865,34 +14925,33 @@ static const struct alc_fixup alc269_fixups[] = {
14865 } 14925 }
14866 }, 14926 },
14867 [ALC269_FIXUP_SKU_IGNORE] = { 14927 [ALC269_FIXUP_SKU_IGNORE] = {
14868 .sku = ALC_FIXUP_SKU_IGNORE, 14928 .type = ALC_FIXUP_SKU,
14929 .v.sku = ALC_FIXUP_SKU_IGNORE,
14869 }, 14930 },
14870 [ALC269_FIXUP_ASUS_G73JW] = { 14931 [ALC269_FIXUP_ASUS_G73JW] = {
14871 .pins = (const struct alc_pincfg[]) { 14932 .type = ALC_FIXUP_PINS,
14933 .v.pins = (const struct alc_pincfg[]) {
14872 { 0x17, 0x99130111 }, /* subwoofer */ 14934 { 0x17, 0x99130111 }, /* subwoofer */
14873 { } 14935 { }
14874 } 14936 }
14875 }, 14937 },
14876 [ALC269_FIXUP_LENOVO_EAPD] = { 14938 [ALC269_FIXUP_LENOVO_EAPD] = {
14877 .verbs = (const struct hda_verb[]) { 14939 .type = ALC_FIXUP_VERBS,
14940 .v.verbs = (const struct hda_verb[]) {
14878 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, 14941 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
14879 {} 14942 {}
14880 } 14943 }
14881 }, 14944 },
14882 [ALC275_FIXUP_SONY_HWEQ] = { 14945 [ALC275_FIXUP_SONY_HWEQ] = {
14883 .func = alc269_fixup_hweq, 14946 .type = ALC_FIXUP_FUNC,
14884 .verbs = (const struct hda_verb[]) { 14947 .v.func = alc269_fixup_hweq,
14885 {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, 14948 .chained = true,
14886 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, 14949 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
14887 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
14888 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14889 { }
14890 }
14891 } 14950 }
14892}; 14951};
14893 14952
14894static struct snd_pci_quirk alc269_fixup_tbl[] = { 14953static struct snd_pci_quirk alc269_fixup_tbl[] = {
14895 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIX_SONY_VAIO_GPIO2), 14954 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
14896 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), 14955 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
14897 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), 14956 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
14898 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), 14957 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
@@ -14908,7 +14967,7 @@ static struct snd_pci_quirk alc269_fixup_tbl[] = {
14908/* 14967/*
14909 * configuration and preset 14968 * configuration and preset
14910 */ 14969 */
14911static const char *alc269_models[ALC269_MODEL_LAST] = { 14970static const char * const alc269_models[ALC269_MODEL_LAST] = {
14912 [ALC269_BASIC] = "basic", 14971 [ALC269_BASIC] = "basic",
14913 [ALC269_QUANTA_FL1] = "quanta", 14972 [ALC269_QUANTA_FL1] = "quanta",
14914 [ALC269_AMIC] = "laptop-amic", 14973 [ALC269_AMIC] = "laptop-amic",
@@ -15184,8 +15243,10 @@ static int patch_alc269(struct hda_codec *codec)
15184 board_config = ALC269_AUTO; 15243 board_config = ALC269_AUTO;
15185 } 15244 }
15186 15245
15187 if (board_config == ALC269_AUTO) 15246 if (board_config == ALC269_AUTO) {
15188 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1); 15247 alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups);
15248 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
15249 }
15189 15250
15190 if (board_config == ALC269_AUTO) { 15251 if (board_config == ALC269_AUTO) {
15191 /* automatic parse from the BIOS config */ 15252 /* automatic parse from the BIOS config */
@@ -15246,8 +15307,7 @@ static int patch_alc269(struct hda_codec *codec)
15246 if (has_cdefine_beep(codec)) 15307 if (has_cdefine_beep(codec))
15247 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); 15308 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
15248 15309
15249 if (board_config == ALC269_AUTO) 15310 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
15250 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0);
15251 15311
15252 spec->vmaster_nid = 0x02; 15312 spec->vmaster_nid = 0x02;
15253 15313
@@ -15950,7 +16010,7 @@ static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
15950 const struct auto_pin_cfg *cfg) 16010 const struct auto_pin_cfg *cfg)
15951{ 16011{
15952 struct alc_spec *spec = codec->spec; 16012 struct alc_spec *spec = codec->spec;
15953 static const char *chname[4] = { 16013 static const char * const chname[4] = {
15954 "Front", "Surround", NULL /*CLFE*/, "Side" 16014 "Front", "Surround", NULL /*CLFE*/, "Side"
15955 }; 16015 };
15956 const char *pfx = alc_get_line_out_pfx(cfg, true); 16016 const char *pfx = alc_get_line_out_pfx(cfg, true);
@@ -16156,7 +16216,7 @@ static struct hda_amp_list alc861_loopbacks[] = {
16156/* 16216/*
16157 * configuration and preset 16217 * configuration and preset
16158 */ 16218 */
16159static const char *alc861_models[ALC861_MODEL_LAST] = { 16219static const char * const alc861_models[ALC861_MODEL_LAST] = {
16160 [ALC861_3ST] = "3stack", 16220 [ALC861_3ST] = "3stack",
16161 [ALC660_3ST] = "3stack-660", 16221 [ALC660_3ST] = "3stack-660",
16162 [ALC861_3ST_DIG] = "3stack-dig", 16222 [ALC861_3ST_DIG] = "3stack-dig",
@@ -16306,7 +16366,8 @@ enum {
16306 16366
16307static const struct alc_fixup alc861_fixups[] = { 16367static const struct alc_fixup alc861_fixups[] = {
16308 [PINFIX_FSC_AMILO_PI1505] = { 16368 [PINFIX_FSC_AMILO_PI1505] = {
16309 .pins = (const struct alc_pincfg[]) { 16369 .type = ALC_FIXUP_PINS,
16370 .v.pins = (const struct alc_pincfg[]) {
16310 { 0x0b, 0x0221101f }, /* HP */ 16371 { 0x0b, 0x0221101f }, /* HP */
16311 { 0x0f, 0x90170310 }, /* speaker */ 16372 { 0x0f, 0x90170310 }, /* speaker */
16312 { } 16373 { }
@@ -16341,8 +16402,10 @@ static int patch_alc861(struct hda_codec *codec)
16341 board_config = ALC861_AUTO; 16402 board_config = ALC861_AUTO;
16342 } 16403 }
16343 16404
16344 if (board_config == ALC861_AUTO) 16405 if (board_config == ALC861_AUTO) {
16345 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1); 16406 alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
16407 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
16408 }
16346 16409
16347 if (board_config == ALC861_AUTO) { 16410 if (board_config == ALC861_AUTO) {
16348 /* automatic parse from the BIOS config */ 16411 /* automatic parse from the BIOS config */
@@ -16379,8 +16442,7 @@ static int patch_alc861(struct hda_codec *codec)
16379 16442
16380 spec->vmaster_nid = 0x03; 16443 spec->vmaster_nid = 0x03;
16381 16444
16382 if (board_config == ALC861_AUTO) 16445 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
16383 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0);
16384 16446
16385 codec->patch_ops = alc_patch_ops; 16447 codec->patch_ops = alc_patch_ops;
16386 if (board_config == ALC861_AUTO) { 16448 if (board_config == ALC861_AUTO) {
@@ -16857,7 +16919,7 @@ static void alc861vd_dallas_setup(struct hda_codec *codec)
16857/* 16919/*
16858 * configuration and preset 16920 * configuration and preset
16859 */ 16921 */
16860static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { 16922static const char * const alc861vd_models[ALC861VD_MODEL_LAST] = {
16861 [ALC660VD_3ST] = "3stack-660", 16923 [ALC660VD_3ST] = "3stack-660",
16862 [ALC660VD_3ST_DIG] = "3stack-660-digout", 16924 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16863 [ALC660VD_ASUS_V1S] = "asus-v1s", 16925 [ALC660VD_ASUS_V1S] = "asus-v1s",
@@ -17077,7 +17139,9 @@ static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
17077static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, 17139static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
17078 const struct auto_pin_cfg *cfg) 17140 const struct auto_pin_cfg *cfg)
17079{ 17141{
17080 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; 17142 static const char * const chname[4] = {
17143 "Front", "Surround", "CLFE", "Side"
17144 };
17081 const char *pfx = alc_get_line_out_pfx(cfg, true); 17145 const char *pfx = alc_get_line_out_pfx(cfg, true);
17082 hda_nid_t nid_v, nid_s; 17146 hda_nid_t nid_v, nid_s;
17083 int i, err; 17147 int i, err;
@@ -17262,7 +17326,8 @@ enum {
17262/* reset GPIO1 */ 17326/* reset GPIO1 */
17263static const struct alc_fixup alc861vd_fixups[] = { 17327static const struct alc_fixup alc861vd_fixups[] = {
17264 [ALC660VD_FIX_ASUS_GPIO1] = { 17328 [ALC660VD_FIX_ASUS_GPIO1] = {
17265 .verbs = (const struct hda_verb[]) { 17329 .type = ALC_FIXUP_VERBS,
17330 .v.verbs = (const struct hda_verb[]) {
17266 {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, 17331 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
17267 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, 17332 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
17268 {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, 17333 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
@@ -17297,8 +17362,10 @@ static int patch_alc861vd(struct hda_codec *codec)
17297 board_config = ALC861VD_AUTO; 17362 board_config = ALC861VD_AUTO;
17298 } 17363 }
17299 17364
17300 if (board_config == ALC861VD_AUTO) 17365 if (board_config == ALC861VD_AUTO) {
17301 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1); 17366 alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
17367 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
17368 }
17302 17369
17303 if (board_config == ALC861VD_AUTO) { 17370 if (board_config == ALC861VD_AUTO) {
17304 /* automatic parse from the BIOS config */ 17371 /* automatic parse from the BIOS config */
@@ -17346,8 +17413,7 @@ static int patch_alc861vd(struct hda_codec *codec)
17346 17413
17347 spec->vmaster_nid = 0x02; 17414 spec->vmaster_nid = 0x02;
17348 17415
17349 if (board_config == ALC861VD_AUTO) 17416 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
17350 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0);
17351 17417
17352 codec->patch_ops = alc_patch_ops; 17418 codec->patch_ops = alc_patch_ops;
17353 17419
@@ -18630,7 +18696,7 @@ static struct snd_kcontrol_new alc272_nc10_mixer[] = {
18630/* 18696/*
18631 * configuration and preset 18697 * configuration and preset
18632 */ 18698 */
18633static const char *alc662_models[ALC662_MODEL_LAST] = { 18699static const char * const alc662_models[ALC662_MODEL_LAST] = {
18634 [ALC662_3ST_2ch_DIG] = "3stack-dig", 18700 [ALC662_3ST_2ch_DIG] = "3stack-dig",
18635 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", 18701 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
18636 [ALC662_3ST_6ch] = "3stack-6ch", 18702 [ALC662_3ST_6ch] = "3stack-6ch",
@@ -19145,7 +19211,7 @@ static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
19145 const struct auto_pin_cfg *cfg) 19211 const struct auto_pin_cfg *cfg)
19146{ 19212{
19147 struct alc_spec *spec = codec->spec; 19213 struct alc_spec *spec = codec->spec;
19148 static const char *chname[4] = { 19214 static const char * const chname[4] = {
19149 "Front", "Surround", NULL /*CLFE*/, "Side" 19215 "Front", "Surround", NULL /*CLFE*/, "Side"
19150 }; 19216 };
19151 const char *pfx = alc_get_line_out_pfx(cfg, true); 19217 const char *pfx = alc_get_line_out_pfx(cfg, true);
@@ -19378,7 +19444,10 @@ static void alc662_auto_init(struct hda_codec *codec)
19378} 19444}
19379 19445
19380static void alc272_fixup_mario(struct hda_codec *codec, 19446static void alc272_fixup_mario(struct hda_codec *codec,
19381 const struct alc_fixup *fix, int pre_init) { 19447 const struct alc_fixup *fix, int action)
19448{
19449 if (action != ALC_FIXUP_ACT_PROBE)
19450 return;
19382 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, 19451 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
19383 (0x3b << AC_AMPCAP_OFFSET_SHIFT) | 19452 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
19384 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) | 19453 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
@@ -19396,19 +19465,22 @@ enum {
19396 19465
19397static const struct alc_fixup alc662_fixups[] = { 19466static const struct alc_fixup alc662_fixups[] = {
19398 [ALC662_FIXUP_ASPIRE] = { 19467 [ALC662_FIXUP_ASPIRE] = {
19399 .pins = (const struct alc_pincfg[]) { 19468 .type = ALC_FIXUP_PINS,
19469 .v.pins = (const struct alc_pincfg[]) {
19400 { 0x15, 0x99130112 }, /* subwoofer */ 19470 { 0x15, 0x99130112 }, /* subwoofer */
19401 { } 19471 { }
19402 } 19472 }
19403 }, 19473 },
19404 [ALC662_FIXUP_IDEAPAD] = { 19474 [ALC662_FIXUP_IDEAPAD] = {
19405 .pins = (const struct alc_pincfg[]) { 19475 .type = ALC_FIXUP_PINS,
19476 .v.pins = (const struct alc_pincfg[]) {
19406 { 0x17, 0x99130112 }, /* subwoofer */ 19477 { 0x17, 0x99130112 }, /* subwoofer */
19407 { } 19478 { }
19408 } 19479 }
19409 }, 19480 },
19410 [ALC272_FIXUP_MARIO] = { 19481 [ALC272_FIXUP_MARIO] = {
19411 .func = alc272_fixup_mario, 19482 .type = ALC_FIXUP_FUNC,
19483 .v.func = alc272_fixup_mario,
19412 } 19484 }
19413}; 19485};
19414 19486
@@ -19462,7 +19534,9 @@ static int patch_alc662(struct hda_codec *codec)
19462 } 19534 }
19463 19535
19464 if (board_config == ALC662_AUTO) { 19536 if (board_config == ALC662_AUTO) {
19465 alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 1); 19537 alc_pick_fixup(codec, alc662_fixup_models,
19538 alc662_fixup_tbl, alc662_fixups);
19539 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
19466 /* automatic parse from the BIOS config */ 19540 /* automatic parse from the BIOS config */
19467 err = alc662_parse_auto_config(codec); 19541 err = alc662_parse_auto_config(codec);
19468 if (err < 0) { 19542 if (err < 0) {
@@ -19520,12 +19594,11 @@ static int patch_alc662(struct hda_codec *codec)
19520 } 19594 }
19521 spec->vmaster_nid = 0x02; 19595 spec->vmaster_nid = 0x02;
19522 19596
19597 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
19598
19523 codec->patch_ops = alc_patch_ops; 19599 codec->patch_ops = alc_patch_ops;
19524 if (board_config == ALC662_AUTO) { 19600 if (board_config == ALC662_AUTO)
19525 spec->init_hook = alc662_auto_init; 19601 spec->init_hook = alc662_auto_init;
19526 alc_pick_fixup_model(codec, alc662_fixup_models,
19527 alc662_fixup_tbl, alc662_fixups, 0);
19528 }
19529 19602
19530 alc_init_jacks(codec); 19603 alc_init_jacks(codec);
19531 19604
@@ -19913,7 +19986,7 @@ static void alc680_auto_init(struct hda_codec *codec)
19913/* 19986/*
19914 * configuration and preset 19987 * configuration and preset
19915 */ 19988 */
19916static const char *alc680_models[ALC680_MODEL_LAST] = { 19989static const char * const alc680_models[ALC680_MODEL_LAST] = {
19917 [ALC680_BASE] = "base", 19990 [ALC680_BASE] = "base",
19918 [ALC680_AUTO] = "auto", 19991 [ALC680_AUTO] = "auto",
19919}; 19992};