aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_sigmatel.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-01-14 11:30:04 -0500
committerTakashi Iwai <tiwai@suse.de>2013-01-15 05:09:24 -0500
commit55e30141d8be9f21f35e5c4999f7043e07347511 (patch)
tree8c164ba470b1df61718d66929270fa106ab3e898 /sound/pci/hda/patch_sigmatel.c
parent0f6fcb73c02759085dbf5cf5a0afb5f0e9f832e5 (diff)
ALSA: hda - Use standard fixup table for IDT92HD73xx
This one is rather a simple conversion. The fixups for Dell machines are implemented by fixup functions in the end. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_sigmatel.c')
-rw-r--r--sound/pci/hda/patch_sigmatel.c331
1 files changed, 218 insertions, 113 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 4a2594a7f02c..3cb44c1b395a 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -79,7 +79,6 @@ enum {
79}; 79};
80 80
81enum { 81enum {
82 STAC_92HD73XX_AUTO,
83 STAC_92HD73XX_NO_JD, /* no jack-detection */ 82 STAC_92HD73XX_NO_JD, /* no jack-detection */
84 STAC_92HD73XX_REF, 83 STAC_92HD73XX_REF,
85 STAC_92HD73XX_INTEL, 84 STAC_92HD73XX_INTEL,
@@ -1783,55 +1782,217 @@ static const struct snd_pci_quirk stac925x_fixup_tbl[] = {
1783 {} /* terminator */ 1782 {} /* terminator */
1784}; 1783};
1785 1784
1786static const unsigned int ref92hd73xx_pin_configs[13] = { 1785static const struct hda_pintbl ref92hd73xx_pin_configs[] = {
1787 0x02214030, 0x02a19040, 0x01a19020, 0x02214030, 1786 { 0x0a, 0x02214030 },
1788 0x0181302e, 0x01014010, 0x01014020, 0x01014030, 1787 { 0x0b, 0x02a19040 },
1789 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050, 1788 { 0x0c, 0x01a19020 },
1790 0x01452050, 1789 { 0x0d, 0x02214030 },
1790 { 0x0e, 0x0181302e },
1791 { 0x0f, 0x01014010 },
1792 { 0x10, 0x01014020 },
1793 { 0x11, 0x01014030 },
1794 { 0x12, 0x02319040 },
1795 { 0x13, 0x90a000f0 },
1796 { 0x14, 0x90a000f0 },
1797 { 0x22, 0x01452050 },
1798 { 0x23, 0x01452050 },
1799 {}
1791}; 1800};
1792 1801
1793static const unsigned int dell_m6_pin_configs[13] = { 1802static const struct hda_pintbl dell_m6_pin_configs[] = {
1794 0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110, 1803 { 0x0a, 0x0321101f },
1795 0x03a11020, 0x0321101f, 0x4f0000f0, 0x4f0000f0, 1804 { 0x0b, 0x4f00000f },
1796 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0, 1805 { 0x0c, 0x4f0000f0 },
1797 0x4f0000f0, 1806 { 0x0d, 0x90170110 },
1807 { 0x0e, 0x03a11020 },
1808 { 0x0f, 0x0321101f },
1809 { 0x10, 0x4f0000f0 },
1810 { 0x11, 0x4f0000f0 },
1811 { 0x12, 0x4f0000f0 },
1812 { 0x13, 0x90a60160 },
1813 { 0x14, 0x4f0000f0 },
1814 { 0x22, 0x4f0000f0 },
1815 { 0x23, 0x4f0000f0 },
1816 {}
1798}; 1817};
1799 1818
1800static const unsigned int alienware_m17x_pin_configs[13] = { 1819static const struct hda_pintbl alienware_m17x_pin_configs[] = {
1801 0x0321101f, 0x0321101f, 0x03a11020, 0x03014020, 1820 { 0x0a, 0x0321101f },
1802 0x90170110, 0x4f0000f0, 0x4f0000f0, 0x4f0000f0, 1821 { 0x0b, 0x0321101f },
1803 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0, 1822 { 0x0c, 0x03a11020 },
1804 0x904601b0, 1823 { 0x0d, 0x03014020 },
1824 { 0x0e, 0x90170110 },
1825 { 0x0f, 0x4f0000f0 },
1826 { 0x10, 0x4f0000f0 },
1827 { 0x11, 0x4f0000f0 },
1828 { 0x12, 0x4f0000f0 },
1829 { 0x13, 0x90a60160 },
1830 { 0x14, 0x4f0000f0 },
1831 { 0x22, 0x4f0000f0 },
1832 { 0x23, 0x904601b0 },
1833 {}
1805}; 1834};
1806 1835
1807static const unsigned int intel_dg45id_pin_configs[13] = { 1836static const struct hda_pintbl intel_dg45id_pin_configs[] = {
1808 0x02214230, 0x02A19240, 0x01013214, 0x01014210, 1837 { 0x0a, 0x02214230 },
1809 0x01A19250, 0x01011212, 0x01016211 1838 { 0x0b, 0x02A19240 },
1839 { 0x0c, 0x01013214 },
1840 { 0x0d, 0x01014210 },
1841 { 0x0e, 0x01A19250 },
1842 { 0x0f, 0x01011212 },
1843 { 0x10, 0x01016211 },
1844 {}
1810}; 1845};
1811 1846
1812static const unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { 1847static void stac92hd73xx_fixup_ref(struct hda_codec *codec,
1813 [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, 1848 const struct hda_fixup *fix, int action)
1814 [STAC_DELL_M6_AMIC] = dell_m6_pin_configs, 1849{
1815 [STAC_DELL_M6_DMIC] = dell_m6_pin_configs, 1850 struct sigmatel_spec *spec = codec->spec;
1816 [STAC_DELL_M6_BOTH] = dell_m6_pin_configs, 1851
1817 [STAC_DELL_EQ] = dell_m6_pin_configs, 1852 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1818 [STAC_ALIENWARE_M17X] = alienware_m17x_pin_configs, 1853 return;
1819 [STAC_92HD73XX_INTEL] = intel_dg45id_pin_configs, 1854
1855 snd_hda_apply_pincfgs(codec, ref92hd73xx_pin_configs);
1856 spec->gpio_mask = spec->gpio_dir = spec->gpio_data = 0;
1857}
1858
1859static void stac92hd73xx_fixup_dell(struct hda_codec *codec)
1860{
1861 struct sigmatel_spec *spec = codec->spec;
1862
1863 snd_hda_apply_pincfgs(codec, dell_m6_pin_configs);
1864 spec->num_smuxes = 0;
1865 spec->eapd_switch = 0;
1866}
1867
1868static void stac92hd73xx_fixup_dell_eq(struct hda_codec *codec,
1869 const struct hda_fixup *fix, int action)
1870{
1871 struct sigmatel_spec *spec = codec->spec;
1872
1873 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1874 return;
1875
1876 stac92hd73xx_fixup_dell(codec);
1877 snd_hda_add_verbs(codec, dell_eq_core_init);
1878 spec->volknob_init = 1;
1879}
1880
1881/* Analog Mics */
1882static void stac92hd73xx_fixup_dell_m6_amic(struct hda_codec *codec,
1883 const struct hda_fixup *fix, int action)
1884{
1885 struct sigmatel_spec *spec = codec->spec;
1886
1887 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1888 return;
1889
1890 stac92hd73xx_fixup_dell(codec);
1891 snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170);
1892 spec->num_dmics = 0;
1893}
1894
1895/* Digital Mics */
1896static void stac92hd73xx_fixup_dell_m6_dmic(struct hda_codec *codec,
1897 const struct hda_fixup *fix, int action)
1898{
1899 struct sigmatel_spec *spec = codec->spec;
1900
1901 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1902 return;
1903
1904 stac92hd73xx_fixup_dell(codec);
1905 snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160);
1906 spec->num_dmics = 1;
1907}
1908
1909/* Both */
1910static void stac92hd73xx_fixup_dell_m6_both(struct hda_codec *codec,
1911 const struct hda_fixup *fix, int action)
1912{
1913 struct sigmatel_spec *spec = codec->spec;
1914
1915 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1916 return;
1917
1918 stac92hd73xx_fixup_dell(codec);
1919 snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170);
1920 snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160);
1921 spec->num_dmics = 1;
1922}
1923
1924static void stac92hd73xx_fixup_alienware_m17x(struct hda_codec *codec,
1925 const struct hda_fixup *fix, int action)
1926{
1927 struct sigmatel_spec *spec = codec->spec;
1928
1929 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1930 return;
1931
1932 snd_hda_apply_pincfgs(codec, alienware_m17x_pin_configs);
1933 spec->num_dmics = STAC92HD73XX_NUM_DMICS;
1934 spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids);
1935 spec->eapd_switch = 0;
1936}
1937
1938static void stac92hd73xx_fixup_no_jd(struct hda_codec *codec,
1939 const struct hda_fixup *fix, int action)
1940{
1941 struct sigmatel_spec *spec = codec->spec;
1942
1943 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1944 return;
1945 spec->hp_detect = 0;
1946}
1947
1948static const struct hda_fixup stac92hd73xx_fixups[] = {
1949 [STAC_92HD73XX_REF] = {
1950 .type = HDA_FIXUP_FUNC,
1951 .v.func = stac92hd73xx_fixup_ref,
1952 },
1953 [STAC_DELL_M6_AMIC] = {
1954 .type = HDA_FIXUP_FUNC,
1955 .v.func = stac92hd73xx_fixup_dell_m6_amic,
1956 },
1957 [STAC_DELL_M6_DMIC] = {
1958 .type = HDA_FIXUP_FUNC,
1959 .v.func = stac92hd73xx_fixup_dell_m6_dmic,
1960 },
1961 [STAC_DELL_M6_BOTH] = {
1962 .type = HDA_FIXUP_FUNC,
1963 .v.func = stac92hd73xx_fixup_dell_m6_both,
1964 },
1965 [STAC_DELL_EQ] = {
1966 .type = HDA_FIXUP_FUNC,
1967 .v.func = stac92hd73xx_fixup_dell_eq,
1968 },
1969 [STAC_ALIENWARE_M17X] = {
1970 .type = HDA_FIXUP_FUNC,
1971 .v.func = stac92hd73xx_fixup_alienware_m17x,
1972 },
1973 [STAC_92HD73XX_INTEL] = {
1974 .type = HDA_FIXUP_PINS,
1975 .v.pins = intel_dg45id_pin_configs,
1976 },
1977 [STAC_92HD73XX_NO_JD] = {
1978 .type = HDA_FIXUP_FUNC,
1979 .v.func = stac92hd73xx_fixup_no_jd,
1980 }
1820}; 1981};
1821 1982
1822static const char * const stac92hd73xx_models[STAC_92HD73XX_MODELS] = { 1983static const struct hda_model_fixup stac92hd73xx_models[] = {
1823 [STAC_92HD73XX_AUTO] = "auto", 1984 { .id = STAC_92HD73XX_NO_JD, .name = "no-jd" },
1824 [STAC_92HD73XX_NO_JD] = "no-jd", 1985 { .id = STAC_92HD73XX_REF, .name = "ref" },
1825 [STAC_92HD73XX_REF] = "ref", 1986 { .id = STAC_92HD73XX_INTEL, .name = "intel" },
1826 [STAC_92HD73XX_INTEL] = "intel", 1987 { .id = STAC_DELL_M6_AMIC, .name = "dell-m6-amic" },
1827 [STAC_DELL_M6_AMIC] = "dell-m6-amic", 1988 { .id = STAC_DELL_M6_DMIC, .name = "dell-m6-dmic" },
1828 [STAC_DELL_M6_DMIC] = "dell-m6-dmic", 1989 { .id = STAC_DELL_M6_BOTH, .name = "dell-m6" },
1829 [STAC_DELL_M6_BOTH] = "dell-m6", 1990 { .id = STAC_DELL_EQ, .name = "dell-eq" },
1830 [STAC_DELL_EQ] = "dell-eq", 1991 { .id = STAC_ALIENWARE_M17X, .name = "alienware" },
1831 [STAC_ALIENWARE_M17X] = "alienware", 1992 {}
1832}; 1993};
1833 1994
1834static const struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { 1995static const struct snd_pci_quirk stac92hd73xx_fixup_tbl[] = {
1835 /* SigmaTel reference board */ 1996 /* SigmaTel reference board */
1836 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 1997 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1837 "DFI LanParty", STAC_92HD73XX_REF), 1998 "DFI LanParty", STAC_92HD73XX_REF),
@@ -1869,10 +2030,7 @@ static const struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
1869 "Dell Studio XPS 1645", STAC_DELL_M6_DMIC), 2030 "Dell Studio XPS 1645", STAC_DELL_M6_DMIC),
1870 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0413, 2031 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0413,
1871 "Dell Studio 1558", STAC_DELL_M6_DMIC), 2032 "Dell Studio 1558", STAC_DELL_M6_DMIC),
1872 {} /* terminator */ 2033 /* codec SSID matching */
1873};
1874
1875static const struct snd_pci_quirk stac92hd73xx_codec_id_cfg_tbl[] = {
1876 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a1, 2034 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a1,
1877 "Alienware M17x", STAC_ALIENWARE_M17X), 2035 "Alienware M17x", STAC_ALIENWARE_M17X),
1878 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a, 2036 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a,
@@ -6262,23 +6420,9 @@ static int patch_stac92hd73xx(struct hda_codec *codec)
6262 spec = codec->spec; 6420 spec = codec->spec;
6263 spec->linear_tone_beep = 0; 6421 spec->linear_tone_beep = 0;
6264 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs; 6422 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs;
6265 spec->board_config = snd_hda_check_board_config(codec, 6423
6266 STAC_92HD73XX_MODELS, 6424 snd_hda_pick_fixup(codec, stac92hd73xx_models, stac92hd73xx_fixup_tbl,
6267 stac92hd73xx_models, 6425 stac92hd73xx_fixups);
6268 stac92hd73xx_cfg_tbl);
6269 /* check codec subsystem id if not found */
6270 if (spec->board_config < 0)
6271 spec->board_config =
6272 snd_hda_check_board_codec_sid_config(codec,
6273 STAC_92HD73XX_MODELS, stac92hd73xx_models,
6274 stac92hd73xx_codec_id_cfg_tbl);
6275again:
6276 if (spec->board_config < 0)
6277 snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6278 codec->chip_name);
6279 else
6280 stac92xx_set_config_regs(codec,
6281 stac92hd73xx_brd_tbl[spec->board_config]);
6282 6426
6283 num_dacs = snd_hda_get_connections(codec, 0x0a, 6427 num_dacs = snd_hda_get_connections(codec, 0x0a,
6284 conn, STAC92HD73_DAC_COUNT + 2) - 1; 6428 conn, STAC92HD73_DAC_COUNT + 2) - 1;
@@ -6288,7 +6432,7 @@ again:
6288 "number of channels defaulting to DAC count\n"); 6432 "number of channels defaulting to DAC count\n");
6289 num_dacs = STAC92HD73_DAC_COUNT; 6433 num_dacs = STAC92HD73_DAC_COUNT;
6290 } 6434 }
6291 spec->init = stac92hd73xx_core_init; 6435
6292 switch (num_dacs) { 6436 switch (num_dacs) {
6293 case 0x3: /* 6 Channel */ 6437 case 0x3: /* 6 Channel */
6294 spec->aloopback_ctl = stac92hd73xx_6ch_loopback; 6438 spec->aloopback_ctl = stac92hd73xx_6ch_loopback;
@@ -6320,76 +6464,37 @@ again:
6320 spec->capvols = stac92hd73xx_capvols; 6464 spec->capvols = stac92hd73xx_capvols;
6321 spec->capsws = stac92hd73xx_capsws; 6465 spec->capsws = stac92hd73xx_capsws;
6322 6466
6323 switch (spec->board_config) { 6467 /* GPIO0 High = Enable EAPD */
6324 case STAC_DELL_EQ: 6468 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
6325 spec->init = dell_eq_core_init; 6469 spec->gpio_data = 0x01;
6326 /* fallthru */
6327 case STAC_DELL_M6_AMIC:
6328 case STAC_DELL_M6_DMIC:
6329 case STAC_DELL_M6_BOTH:
6330 spec->num_smuxes = 0;
6331 spec->eapd_switch = 0;
6332 6470
6333 switch (spec->board_config) { 6471 spec->num_dmics = STAC92HD73XX_NUM_DMICS;
6334 case STAC_DELL_M6_AMIC: /* Analog Mics */ 6472 spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids);
6335 snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170); 6473 spec->eapd_switch = 1;
6336 spec->num_dmics = 0;
6337 break;
6338 case STAC_DELL_M6_DMIC: /* Digital Mics */
6339 snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160);
6340 spec->num_dmics = 1;
6341 break;
6342 case STAC_DELL_M6_BOTH: /* Both */
6343 snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170);
6344 snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160);
6345 spec->num_dmics = 1;
6346 break;
6347 }
6348 break;
6349 case STAC_ALIENWARE_M17X:
6350 spec->num_dmics = STAC92HD73XX_NUM_DMICS;
6351 spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids);
6352 spec->eapd_switch = 0;
6353 break;
6354 default:
6355 spec->num_dmics = STAC92HD73XX_NUM_DMICS;
6356 spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids);
6357 spec->eapd_switch = 1;
6358 break;
6359 }
6360 if (spec->board_config != STAC_92HD73XX_REF) {
6361 /* GPIO0 High = Enable EAPD */
6362 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
6363 spec->gpio_data = 0x01;
6364 }
6365 6474
6366 spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids); 6475 spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids);
6367 spec->pwr_nids = stac92hd73xx_pwr_nids; 6476 spec->pwr_nids = stac92hd73xx_pwr_nids;
6368 6477
6478 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
6479
6480 if (!spec->volknob_init)
6481 snd_hda_add_verbs(codec, stac92hd73xx_core_init);
6482
6369 err = stac92xx_parse_auto_config(codec); 6483 err = stac92xx_parse_auto_config(codec);
6370 6484
6371 if (!err) { 6485 if (!err)
6372 if (spec->board_config < 0) {
6373 printk(KERN_WARNING "hda_codec: No auto-config is "
6374 "available, default to model=ref\n");
6375 spec->board_config = STAC_92HD73XX_REF;
6376 goto again;
6377 }
6378 err = -EINVAL; 6486 err = -EINVAL;
6379 }
6380
6381 if (err < 0) { 6487 if (err < 0) {
6382 stac92xx_free(codec); 6488 stac92xx_free(codec);
6383 return err; 6489 return err;
6384 } 6490 }
6385 6491
6386 if (spec->board_config == STAC_92HD73XX_NO_JD)
6387 spec->hp_detect = 0;
6388
6389 codec->patch_ops = stac92xx_patch_ops; 6492 codec->patch_ops = stac92xx_patch_ops;
6390 6493
6391 codec->proc_widget_hook = stac92hd7x_proc_hook; 6494 codec->proc_widget_hook = stac92hd7x_proc_hook;
6392 6495
6496 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
6497
6393 return 0; 6498 return 0;
6394} 6499}
6395 6500