aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-01-13 08:22:32 -0500
committerTakashi Iwai <tiwai@suse.de>2011-01-13 09:34:30 -0500
commitb5bfbc670283d1ff21df4cd3f9f036cc47e34ce4 (patch)
treed4a102614abbe0ed778cf619f5794e9226694d6e
parent9fb1ef25f4d31f07cdaf7c6075b40bbcb00c1f92 (diff)
ALSA: hda - Reorganize fixup structure for Realtek
Instead of keeping various data types in a single record, put the type field and keep a single value in each entry, but allows chaining multiple fixup entries. This allows more flexible data management (see ALC275_FIXUP_SONY_HWEQ for example). Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/patch_realtek.c317
1 files changed, 193 insertions, 124 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 98b4b2e1b930..a06c9437cdeb 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,130 @@ 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 union {
1688 const struct hda_verb *verbs; 1695 unsigned int sku;
1689 void (*func)(struct hda_codec *codec, const struct alc_fixup *fix, 1696 const struct alc_pincfg *pins;
1690 int pre_init); 1697 const struct hda_verb *verbs;
1698 void (*func)(struct hda_codec *codec,
1699 const struct alc_fixup *fix,
1700 int action);
1701 } v;
1702 bool chained;
1703 int chain_id;
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};
1718
1719static void alc_apply_fixup(struct hda_codec *codec, int action)
1697{ 1720{
1698 const struct alc_pincfg *cfg; 1721 struct alc_spec *spec = codec->spec;
1699 struct alc_spec *spec; 1722 int id = spec->fixup_id;
1723 const char *modelname = spec->fixup_name;
1724 int depth = 0;
1700 1725
1701 cfg = fix->pins; 1726 if (!spec->fixup_list)
1702 if (pre_init && fix->sku) { 1727 return;
1703#ifdef CONFIG_SND_DEBUG_VERBOSE 1728
1704 snd_printdd(KERN_INFO "hda_codec: %s: Apply sku override for %s\n", 1729 while (id >= 0) {
1705 codec->chip_name, modelname); 1730 const struct alc_fixup *fix = spec->fixup_list + id;
1706#endif 1731 const struct alc_pincfg *cfg;
1707 spec = codec->spec; 1732
1708 spec->cdefine.sku_cfg = fix->sku; 1733 switch (fix->type) {
1709 spec->cdefine.fixup = 1; 1734 case ALC_FIXUP_SKU:
1710 } 1735 if (action != ALC_FIXUP_ACT_PRE_PROBE || !fix->v.sku)
1711 if (pre_init && cfg) { 1736 break;;
1712#ifdef CONFIG_SND_DEBUG_VERBOSE 1737 snd_printdd(KERN_INFO "hda_codec: %s: "
1713 snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n", 1738 "Apply sku override for %s\n",
1714 codec->chip_name, modelname); 1739 codec->chip_name, modelname);
1715#endif 1740 spec->cdefine.sku_cfg = fix->v.sku;
1716 for (; cfg->nid; cfg++) 1741 spec->cdefine.fixup = 1;
1717 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); 1742 break;
1718 } 1743 case ALC_FIXUP_PINS:
1719 if (!pre_init && fix->verbs) { 1744 cfg = fix->v.pins;
1720#ifdef CONFIG_SND_DEBUG_VERBOSE 1745 if (action != ALC_FIXUP_ACT_PRE_PROBE || !cfg)
1721 snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n", 1746 break;
1722 codec->chip_name, modelname); 1747 snd_printdd(KERN_INFO "hda_codec: %s: "
1723#endif 1748 "Apply pincfg for %s\n",
1724 add_verb(codec->spec, fix->verbs); 1749 codec->chip_name, modelname);
1725 } 1750 for (; cfg->nid; cfg++)
1726 if (fix->func) { 1751 snd_hda_codec_set_pincfg(codec, cfg->nid,
1727#ifdef CONFIG_SND_DEBUG_VERBOSE 1752 cfg->val);
1728 snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-func for %s\n", 1753 break;
1729 codec->chip_name, modelname); 1754 case ALC_FIXUP_VERBS:
1730#endif 1755 if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs)
1731 fix->func(codec, fix, pre_init); 1756 break;
1757 snd_printdd(KERN_INFO "hda_codec: %s: "
1758 "Apply fix-verbs for %s\n",
1759 codec->chip_name, modelname);
1760 add_verb(codec->spec, fix->v.verbs);
1761 break;
1762 case ALC_FIXUP_FUNC:
1763 if (!fix->v.func)
1764 break;
1765 snd_printdd(KERN_INFO "hda_codec: %s: "
1766 "Apply fix-func for %s\n",
1767 codec->chip_name, modelname);
1768 fix->v.func(codec, fix, action);
1769 break;
1770 default:
1771 snd_printk(KERN_ERR "hda_codec: %s: "
1772 "Invalid fixup type %d\n",
1773 codec->chip_name, fix->type);
1774 break;
1775 }
1776 if (!fix[id].chained)
1777 break;
1778 if (++depth > 10)
1779 break;
1780 id = fix[id].chain_id;
1732 } 1781 }
1733} 1782}
1734 1783
1735static void alc_pick_fixup(struct hda_codec *codec, 1784static void alc_pick_fixup(struct hda_codec *codec,
1736 const struct snd_pci_quirk *quirk, 1785 const struct alc_model_fixup *models,
1737 const struct alc_fixup *fix, 1786 const struct snd_pci_quirk *quirk,
1738 int pre_init) 1787 const struct alc_fixup *fixlist)
1739{ 1788{
1740 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); 1789 struct alc_spec *spec = codec->spec;
1741 if (quirk) { 1790 int id = -1;
1742 fix += quirk->value; 1791 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 1792
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) { 1793 if (codec->modelname && models) {
1758 while (models->name) { 1794 while (models->name) {
1759 if (!strcmp(codec->modelname, models->name)) { 1795 if (!strcmp(codec->modelname, models->name)) {
1760 fix += models->id; 1796 id = models->id;
1797 name = models->name;
1761 break; 1798 break;
1762 } 1799 }
1763 models++; 1800 models++;
1764 } 1801 }
1765 __alc_pick_fixup(codec, fix, codec->modelname, pre_init); 1802 }
1766 } else { 1803 if (id < 0) {
1767 alc_pick_fixup(codec, quirk, fix, pre_init); 1804 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1805 if (quirk) {
1806 id = quirk->value;
1807#ifdef CONFIG_SND_DEBUG_VERBOSE
1808 name = quirk->name;
1809#endif
1810 }
1811 }
1812
1813 spec->fixup_id = id;
1814 if (id >= 0) {
1815 spec->fixup_list = fixlist;
1816 spec->fixup_name = name;
1768 } 1817 }
1769} 1818}
1770 1819
@@ -7090,7 +7139,8 @@ enum {
7090 7139
7091static const struct alc_fixup alc260_fixups[] = { 7140static const struct alc_fixup alc260_fixups[] = {
7092 [PINFIX_HP_DC5750] = { 7141 [PINFIX_HP_DC5750] = {
7093 .pins = (const struct alc_pincfg[]) { 7142 .type = ALC_FIXUP_PINS,
7143 .v.pins = (const struct alc_pincfg[]) {
7094 { 0x11, 0x90130110 }, /* speaker */ 7144 { 0x11, 0x90130110 }, /* speaker */
7095 { } 7145 { }
7096 } 7146 }
@@ -7301,8 +7351,10 @@ static int patch_alc260(struct hda_codec *codec)
7301 board_config = ALC260_AUTO; 7351 board_config = ALC260_AUTO;
7302 } 7352 }
7303 7353
7304 if (board_config == ALC260_AUTO) 7354 if (board_config == ALC260_AUTO) {
7305 alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 1); 7355 alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups);
7356 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
7357 }
7306 7358
7307 if (board_config == ALC260_AUTO) { 7359 if (board_config == ALC260_AUTO) {
7308 /* automatic parse from the BIOS config */ 7360 /* automatic parse from the BIOS config */
@@ -7350,8 +7402,7 @@ static int patch_alc260(struct hda_codec *codec)
7350 set_capture_mixer(codec); 7402 set_capture_mixer(codec);
7351 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); 7403 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
7352 7404
7353 if (board_config == ALC260_AUTO) 7405 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
7354 alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 0);
7355 7406
7356 spec->vmaster_nid = 0x08; 7407 spec->vmaster_nid = 0x08;
7357 7408
@@ -10678,7 +10729,8 @@ enum {
10678 10729
10679static const struct alc_fixup alc882_fixups[] = { 10730static const struct alc_fixup alc882_fixups[] = {
10680 [PINFIX_ABIT_AW9D_MAX] = { 10731 [PINFIX_ABIT_AW9D_MAX] = {
10681 .pins = (const struct alc_pincfg[]) { 10732 .type = ALC_FIXUP_PINS,
10733 .v.pins = (const struct alc_pincfg[]) {
10682 { 0x15, 0x01080104 }, /* side */ 10734 { 0x15, 0x01080104 }, /* side */
10683 { 0x16, 0x01011012 }, /* rear */ 10735 { 0x16, 0x01011012 }, /* rear */
10684 { 0x17, 0x01016011 }, /* clfe */ 10736 { 0x17, 0x01016011 }, /* clfe */
@@ -10686,13 +10738,15 @@ static const struct alc_fixup alc882_fixups[] = {
10686 } 10738 }
10687 }, 10739 },
10688 [PINFIX_PB_M5210] = { 10740 [PINFIX_PB_M5210] = {
10689 .verbs = (const struct hda_verb[]) { 10741 .type = ALC_FIXUP_VERBS,
10742 .v.verbs = (const struct hda_verb[]) {
10690 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, 10743 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
10691 {} 10744 {}
10692 } 10745 }
10693 }, 10746 },
10694 [PINFIX_ACER_ASPIRE_7736] = { 10747 [PINFIX_ACER_ASPIRE_7736] = {
10695 .sku = ALC_FIXUP_SKU_IGNORE, 10748 .type = ALC_FIXUP_SKU,
10749 .v.sku = ALC_FIXUP_SKU_IGNORE,
10696 }, 10750 },
10697}; 10751};
10698 10752
@@ -10978,8 +11032,10 @@ static int patch_alc882(struct hda_codec *codec)
10978 board_config = ALC882_AUTO; 11032 board_config = ALC882_AUTO;
10979 } 11033 }
10980 11034
10981 if (board_config == ALC882_AUTO) 11035 if (board_config == ALC882_AUTO) {
10982 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1); 11036 alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups);
11037 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
11038 }
10983 11039
10984 alc_auto_parse_customize_define(codec); 11040 alc_auto_parse_customize_define(codec);
10985 11041
@@ -11055,8 +11111,7 @@ static int patch_alc882(struct hda_codec *codec)
11055 if (has_cdefine_beep(codec)) 11111 if (has_cdefine_beep(codec))
11056 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); 11112 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11057 11113
11058 if (board_config == ALC882_AUTO) 11114 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
11059 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0);
11060 11115
11061 spec->vmaster_nid = 0x0c; 11116 spec->vmaster_nid = 0x0c;
11062 11117
@@ -12446,7 +12501,8 @@ enum {
12446 12501
12447static const struct alc_fixup alc262_fixups[] = { 12502static const struct alc_fixup alc262_fixups[] = {
12448 [PINFIX_FSC_H270] = { 12503 [PINFIX_FSC_H270] = {
12449 .pins = (const struct alc_pincfg[]) { 12504 .type = ALC_FIXUP_PINS,
12505 .v.pins = (const struct alc_pincfg[]) {
12450 { 0x14, 0x99130110 }, /* speaker */ 12506 { 0x14, 0x99130110 }, /* speaker */
12451 { 0x15, 0x0221142f }, /* front HP */ 12507 { 0x15, 0x0221142f }, /* front HP */
12452 { 0x1b, 0x0121141f }, /* rear HP */ 12508 { 0x1b, 0x0121141f }, /* rear HP */
@@ -12883,8 +12939,10 @@ static int patch_alc262(struct hda_codec *codec)
12883 board_config = ALC262_AUTO; 12939 board_config = ALC262_AUTO;
12884 } 12940 }
12885 12941
12886 if (board_config == ALC262_AUTO) 12942 if (board_config == ALC262_AUTO) {
12887 alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 1); 12943 alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups);
12944 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
12945 }
12888 12946
12889 if (board_config == ALC262_AUTO) { 12947 if (board_config == ALC262_AUTO) {
12890 /* automatic parse from the BIOS config */ 12948 /* automatic parse from the BIOS config */
@@ -12954,8 +13012,7 @@ static int patch_alc262(struct hda_codec *codec)
12954 if (!spec->no_analog && has_cdefine_beep(codec)) 13012 if (!spec->no_analog && has_cdefine_beep(codec))
12955 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); 13013 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12956 13014
12957 if (board_config == ALC262_AUTO) 13015 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
12958 alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 0);
12959 13016
12960 spec->vmaster_nid = 0x0c; 13017 spec->vmaster_nid = 0x0c;
12961 13018
@@ -14810,11 +14867,11 @@ static int alc269_resume(struct hda_codec *codec)
14810#endif /* SND_HDA_NEEDS_RESUME */ 14867#endif /* SND_HDA_NEEDS_RESUME */
14811 14868
14812static void alc269_fixup_hweq(struct hda_codec *codec, 14869static void alc269_fixup_hweq(struct hda_codec *codec,
14813 const struct alc_fixup *fix, int pre_init) 14870 const struct alc_fixup *fix, int action)
14814{ 14871{
14815 int coef; 14872 int coef;
14816 14873
14817 if (pre_init) 14874 if (action != ALC_FIXUP_ACT_PROBE)
14818 return; 14875 return;
14819 coef = alc_read_coef_idx(codec, 0x1e); 14876 coef = alc_read_coef_idx(codec, 0x1e);
14820 alc_write_coef_idx(codec, 0x1e, coef | 0x80); 14877 alc_write_coef_idx(codec, 0x1e, coef | 0x80);
@@ -14832,22 +14889,26 @@ enum {
14832 14889
14833static const struct alc_fixup alc269_fixups[] = { 14890static const struct alc_fixup alc269_fixups[] = {
14834 [ALC269_FIXUP_SONY_VAIO] = { 14891 [ALC269_FIXUP_SONY_VAIO] = {
14835 .verbs = (const struct hda_verb[]) { 14892 .type = ALC_FIXUP_VERBS,
14893 .v.verbs = (const struct hda_verb[]) {
14836 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, 14894 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14837 {} 14895 {}
14838 } 14896 }
14839 }, 14897 },
14840 [ALC275_FIXUP_SONY_VAIO_GPIO2] = { 14898 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
14841 .verbs = (const struct hda_verb[]) { 14899 .type = ALC_FIXUP_VERBS,
14900 .v.verbs = (const struct hda_verb[]) {
14842 {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, 14901 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
14843 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, 14902 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
14844 {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, 14903 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
14845 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14846 { } 14904 { }
14847 } 14905 },
14906 .chained = true,
14907 .chain_id = ALC269_FIXUP_SONY_VAIO
14848 }, 14908 },
14849 [ALC269_FIXUP_DELL_M101Z] = { 14909 [ALC269_FIXUP_DELL_M101Z] = {
14850 .verbs = (const struct hda_verb[]) { 14910 .type = ALC_FIXUP_VERBS,
14911 .v.verbs = (const struct hda_verb[]) {
14851 /* Enables internal speaker */ 14912 /* Enables internal speaker */
14852 {0x20, AC_VERB_SET_COEF_INDEX, 13}, 14913 {0x20, AC_VERB_SET_COEF_INDEX, 13},
14853 {0x20, AC_VERB_SET_PROC_COEF, 0x4040}, 14914 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
@@ -14855,29 +14916,28 @@ static const struct alc_fixup alc269_fixups[] = {
14855 } 14916 }
14856 }, 14917 },
14857 [ALC269_FIXUP_SKU_IGNORE] = { 14918 [ALC269_FIXUP_SKU_IGNORE] = {
14858 .sku = ALC_FIXUP_SKU_IGNORE, 14919 .type = ALC_FIXUP_SKU,
14920 .v.sku = ALC_FIXUP_SKU_IGNORE,
14859 }, 14921 },
14860 [ALC269_FIXUP_ASUS_G73JW] = { 14922 [ALC269_FIXUP_ASUS_G73JW] = {
14861 .pins = (const struct alc_pincfg[]) { 14923 .type = ALC_FIXUP_PINS,
14924 .v.pins = (const struct alc_pincfg[]) {
14862 { 0x17, 0x99130111 }, /* subwoofer */ 14925 { 0x17, 0x99130111 }, /* subwoofer */
14863 { } 14926 { }
14864 } 14927 }
14865 }, 14928 },
14866 [ALC269_FIXUP_LENOVO_EAPD] = { 14929 [ALC269_FIXUP_LENOVO_EAPD] = {
14867 .verbs = (const struct hda_verb[]) { 14930 .type = ALC_FIXUP_VERBS,
14931 .v.verbs = (const struct hda_verb[]) {
14868 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, 14932 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
14869 {} 14933 {}
14870 } 14934 }
14871 }, 14935 },
14872 [ALC275_FIXUP_SONY_HWEQ] = { 14936 [ALC275_FIXUP_SONY_HWEQ] = {
14873 .func = alc269_fixup_hweq, 14937 .type = ALC_FIXUP_FUNC,
14874 .verbs = (const struct hda_verb[]) { 14938 .v.func = alc269_fixup_hweq,
14875 {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, 14939 .chained = true,
14876 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, 14940 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
14877 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
14878 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14879 { }
14880 }
14881 } 14941 }
14882}; 14942};
14883 14943
@@ -15174,8 +15234,10 @@ static int patch_alc269(struct hda_codec *codec)
15174 board_config = ALC269_AUTO; 15234 board_config = ALC269_AUTO;
15175 } 15235 }
15176 15236
15177 if (board_config == ALC269_AUTO) 15237 if (board_config == ALC269_AUTO) {
15178 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1); 15238 alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups);
15239 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
15240 }
15179 15241
15180 if (board_config == ALC269_AUTO) { 15242 if (board_config == ALC269_AUTO) {
15181 /* automatic parse from the BIOS config */ 15243 /* automatic parse from the BIOS config */
@@ -15236,8 +15298,7 @@ static int patch_alc269(struct hda_codec *codec)
15236 if (has_cdefine_beep(codec)) 15298 if (has_cdefine_beep(codec))
15237 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); 15299 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
15238 15300
15239 if (board_config == ALC269_AUTO) 15301 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
15240 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0);
15241 15302
15242 spec->vmaster_nid = 0x02; 15303 spec->vmaster_nid = 0x02;
15243 15304
@@ -16296,7 +16357,8 @@ enum {
16296 16357
16297static const struct alc_fixup alc861_fixups[] = { 16358static const struct alc_fixup alc861_fixups[] = {
16298 [PINFIX_FSC_AMILO_PI1505] = { 16359 [PINFIX_FSC_AMILO_PI1505] = {
16299 .pins = (const struct alc_pincfg[]) { 16360 .type = ALC_FIXUP_PINS,
16361 .v.pins = (const struct alc_pincfg[]) {
16300 { 0x0b, 0x0221101f }, /* HP */ 16362 { 0x0b, 0x0221101f }, /* HP */
16301 { 0x0f, 0x90170310 }, /* speaker */ 16363 { 0x0f, 0x90170310 }, /* speaker */
16302 { } 16364 { }
@@ -16331,8 +16393,10 @@ static int patch_alc861(struct hda_codec *codec)
16331 board_config = ALC861_AUTO; 16393 board_config = ALC861_AUTO;
16332 } 16394 }
16333 16395
16334 if (board_config == ALC861_AUTO) 16396 if (board_config == ALC861_AUTO) {
16335 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1); 16397 alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
16398 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
16399 }
16336 16400
16337 if (board_config == ALC861_AUTO) { 16401 if (board_config == ALC861_AUTO) {
16338 /* automatic parse from the BIOS config */ 16402 /* automatic parse from the BIOS config */
@@ -16369,8 +16433,7 @@ static int patch_alc861(struct hda_codec *codec)
16369 16433
16370 spec->vmaster_nid = 0x03; 16434 spec->vmaster_nid = 0x03;
16371 16435
16372 if (board_config == ALC861_AUTO) 16436 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
16373 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0);
16374 16437
16375 codec->patch_ops = alc_patch_ops; 16438 codec->patch_ops = alc_patch_ops;
16376 if (board_config == ALC861_AUTO) { 16439 if (board_config == ALC861_AUTO) {
@@ -17252,7 +17315,8 @@ enum {
17252/* reset GPIO1 */ 17315/* reset GPIO1 */
17253static const struct alc_fixup alc861vd_fixups[] = { 17316static const struct alc_fixup alc861vd_fixups[] = {
17254 [ALC660VD_FIX_ASUS_GPIO1] = { 17317 [ALC660VD_FIX_ASUS_GPIO1] = {
17255 .verbs = (const struct hda_verb[]) { 17318 .type = ALC_FIXUP_VERBS,
17319 .v.verbs = (const struct hda_verb[]) {
17256 {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, 17320 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
17257 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, 17321 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
17258 {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, 17322 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
@@ -17287,8 +17351,10 @@ static int patch_alc861vd(struct hda_codec *codec)
17287 board_config = ALC861VD_AUTO; 17351 board_config = ALC861VD_AUTO;
17288 } 17352 }
17289 17353
17290 if (board_config == ALC861VD_AUTO) 17354 if (board_config == ALC861VD_AUTO) {
17291 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1); 17355 alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
17356 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
17357 }
17292 17358
17293 if (board_config == ALC861VD_AUTO) { 17359 if (board_config == ALC861VD_AUTO) {
17294 /* automatic parse from the BIOS config */ 17360 /* automatic parse from the BIOS config */
@@ -17336,8 +17402,7 @@ static int patch_alc861vd(struct hda_codec *codec)
17336 17402
17337 spec->vmaster_nid = 0x02; 17403 spec->vmaster_nid = 0x02;
17338 17404
17339 if (board_config == ALC861VD_AUTO) 17405 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
17340 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0);
17341 17406
17342 codec->patch_ops = alc_patch_ops; 17407 codec->patch_ops = alc_patch_ops;
17343 17408
@@ -19368,9 +19433,9 @@ static void alc662_auto_init(struct hda_codec *codec)
19368} 19433}
19369 19434
19370static void alc272_fixup_mario(struct hda_codec *codec, 19435static void alc272_fixup_mario(struct hda_codec *codec,
19371 const struct alc_fixup *fix, int pre_init) 19436 const struct alc_fixup *fix, int action)
19372{ 19437{
19373 if (!pre_init) 19438 if (action != ALC_FIXUP_ACT_PROBE)
19374 return; 19439 return;
19375 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, 19440 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
19376 (0x3b << AC_AMPCAP_OFFSET_SHIFT) | 19441 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
@@ -19389,19 +19454,22 @@ enum {
19389 19454
19390static const struct alc_fixup alc662_fixups[] = { 19455static const struct alc_fixup alc662_fixups[] = {
19391 [ALC662_FIXUP_ASPIRE] = { 19456 [ALC662_FIXUP_ASPIRE] = {
19392 .pins = (const struct alc_pincfg[]) { 19457 .type = ALC_FIXUP_PINS,
19458 .v.pins = (const struct alc_pincfg[]) {
19393 { 0x15, 0x99130112 }, /* subwoofer */ 19459 { 0x15, 0x99130112 }, /* subwoofer */
19394 { } 19460 { }
19395 } 19461 }
19396 }, 19462 },
19397 [ALC662_FIXUP_IDEAPAD] = { 19463 [ALC662_FIXUP_IDEAPAD] = {
19398 .pins = (const struct alc_pincfg[]) { 19464 .type = ALC_FIXUP_PINS,
19465 .v.pins = (const struct alc_pincfg[]) {
19399 { 0x17, 0x99130112 }, /* subwoofer */ 19466 { 0x17, 0x99130112 }, /* subwoofer */
19400 { } 19467 { }
19401 } 19468 }
19402 }, 19469 },
19403 [ALC272_FIXUP_MARIO] = { 19470 [ALC272_FIXUP_MARIO] = {
19404 .func = alc272_fixup_mario, 19471 .type = ALC_FIXUP_FUNC,
19472 .v.func = alc272_fixup_mario,
19405 } 19473 }
19406}; 19474};
19407 19475
@@ -19455,7 +19523,9 @@ static int patch_alc662(struct hda_codec *codec)
19455 } 19523 }
19456 19524
19457 if (board_config == ALC662_AUTO) { 19525 if (board_config == ALC662_AUTO) {
19458 alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 1); 19526 alc_pick_fixup(codec, alc662_fixup_models,
19527 alc662_fixup_tbl, alc662_fixups);
19528 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
19459 /* automatic parse from the BIOS config */ 19529 /* automatic parse from the BIOS config */
19460 err = alc662_parse_auto_config(codec); 19530 err = alc662_parse_auto_config(codec);
19461 if (err < 0) { 19531 if (err < 0) {
@@ -19513,12 +19583,11 @@ static int patch_alc662(struct hda_codec *codec)
19513 } 19583 }
19514 spec->vmaster_nid = 0x02; 19584 spec->vmaster_nid = 0x02;
19515 19585
19586 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
19587
19516 codec->patch_ops = alc_patch_ops; 19588 codec->patch_ops = alc_patch_ops;
19517 if (board_config == ALC662_AUTO) { 19589 if (board_config == ALC662_AUTO)
19518 spec->init_hook = alc662_auto_init; 19590 spec->init_hook = alc662_auto_init;
19519 alc_pick_fixup_model(codec, alc662_fixup_models,
19520 alc662_fixup_tbl, alc662_fixups, 0);
19521 }
19522 19591
19523 alc_init_jacks(codec); 19592 alc_init_jacks(codec);
19524 19593