aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_sigmatel.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-02-08 11:50:10 -0500
committerJaroslav Kysela <perex@suse.cz>2007-02-14 02:38:20 -0500
commit9e507abd87103b5263bb0bbd94a15d74004557e9 (patch)
tree75b4b82501506a99602f1c4de847654dc5bba223 /sound/pci/hda/patch_sigmatel.c
parentac98695d6c1508b724f246f38ce57fb4e3cec356 (diff)
[ALSA] hda-codec - Fix Oops with probing sigmatel codec chips
When a device is unkown, the driver tries to set up the codec based on the BIOS information. Then it may result in Oops if BIOS is broken. The patch fixes the issue, falling back to a reference model in such a case. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/hda/patch_sigmatel.c')
-rw-r--r--sound/pci/hda/patch_sigmatel.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 6f4a39273b98..2535c1ad39e9 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -1800,6 +1800,7 @@ static int patch_stac925x(struct hda_codec *codec)
1800 spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS, 1800 spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS,
1801 stac925x_models, 1801 stac925x_models,
1802 stac925x_cfg_tbl); 1802 stac925x_cfg_tbl);
1803 again:
1803 if (spec->board_config < 0) { 1804 if (spec->board_config < 0) {
1804 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x, using BIOS defaults\n"); 1805 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x, using BIOS defaults\n");
1805 err = stac92xx_save_bios_config_regs(codec); 1806 err = stac92xx_save_bios_config_regs(codec);
@@ -1825,6 +1826,15 @@ static int patch_stac925x(struct hda_codec *codec)
1825 spec->mixer = stac925x_mixer; 1826 spec->mixer = stac925x_mixer;
1826 1827
1827 err = stac92xx_parse_auto_config(codec, 0x8, 0x7); 1828 err = stac92xx_parse_auto_config(codec, 0x8, 0x7);
1829 if (!err) {
1830 if (spec->board_config < 0) {
1831 printk(KERN_WARNING "hda_codec: No auto-config is "
1832 "available, default to model=ref\n");
1833 spec->board_config = STAC_925x_REF;
1834 goto again;
1835 }
1836 err = -EINVAL;
1837 }
1828 if (err < 0) { 1838 if (err < 0) {
1829 stac92xx_free(codec); 1839 stac92xx_free(codec);
1830 return err; 1840 return err;
@@ -1850,6 +1860,7 @@ static int patch_stac922x(struct hda_codec *codec)
1850 spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS, 1860 spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS,
1851 stac922x_models, 1861 stac922x_models,
1852 stac922x_cfg_tbl); 1862 stac922x_cfg_tbl);
1863 again:
1853 if (spec->board_config < 0) { 1864 if (spec->board_config < 0) {
1854 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, " 1865 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, "
1855 "using BIOS defaults\n"); 1866 "using BIOS defaults\n");
@@ -1875,6 +1886,15 @@ static int patch_stac922x(struct hda_codec *codec)
1875 spec->multiout.dac_nids = spec->dac_nids; 1886 spec->multiout.dac_nids = spec->dac_nids;
1876 1887
1877 err = stac92xx_parse_auto_config(codec, 0x08, 0x09); 1888 err = stac92xx_parse_auto_config(codec, 0x08, 0x09);
1889 if (!err) {
1890 if (spec->board_config < 0) {
1891 printk(KERN_WARNING "hda_codec: No auto-config is "
1892 "available, default to model=ref\n");
1893 spec->board_config = STAC_D945_REF;
1894 goto again;
1895 }
1896 err = -EINVAL;
1897 }
1878 if (err < 0) { 1898 if (err < 0) {
1879 stac92xx_free(codec); 1899 stac92xx_free(codec);
1880 return err; 1900 return err;
@@ -1903,6 +1923,7 @@ static int patch_stac927x(struct hda_codec *codec)
1903 spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS, 1923 spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS,
1904 stac927x_models, 1924 stac927x_models,
1905 stac927x_cfg_tbl); 1925 stac927x_cfg_tbl);
1926 again:
1906 if (spec->board_config < 0) { 1927 if (spec->board_config < 0) {
1907 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC927x, using BIOS defaults\n"); 1928 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC927x, using BIOS defaults\n");
1908 err = stac92xx_save_bios_config_regs(codec); 1929 err = stac92xx_save_bios_config_regs(codec);
@@ -1945,6 +1966,15 @@ static int patch_stac927x(struct hda_codec *codec)
1945 spec->multiout.dac_nids = spec->dac_nids; 1966 spec->multiout.dac_nids = spec->dac_nids;
1946 1967
1947 err = stac92xx_parse_auto_config(codec, 0x1e, 0x20); 1968 err = stac92xx_parse_auto_config(codec, 0x1e, 0x20);
1969 if (!err) {
1970 if (spec->board_config < 0) {
1971 printk(KERN_WARNING "hda_codec: No auto-config is "
1972 "available, default to model=ref\n");
1973 spec->board_config = STAC_D965_REF;
1974 goto again;
1975 }
1976 err = -EINVAL;
1977 }
1948 if (err < 0) { 1978 if (err < 0) {
1949 stac92xx_free(codec); 1979 stac92xx_free(codec);
1950 return err; 1980 return err;
@@ -1970,6 +2000,7 @@ static int patch_stac9205(struct hda_codec *codec)
1970 spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS, 2000 spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS,
1971 stac9205_models, 2001 stac9205_models,
1972 stac9205_cfg_tbl); 2002 stac9205_cfg_tbl);
2003 again:
1973 if (spec->board_config < 0) { 2004 if (spec->board_config < 0) {
1974 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n"); 2005 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n");
1975 err = stac92xx_save_bios_config_regs(codec); 2006 err = stac92xx_save_bios_config_regs(codec);
@@ -2008,6 +2039,15 @@ static int patch_stac9205(struct hda_codec *codec)
2008 AC_VERB_SET_GPIO_MASK, 0x00000001); 2039 AC_VERB_SET_GPIO_MASK, 0x00000001);
2009 2040
2010 err = stac92xx_parse_auto_config(codec, 0x1f, 0x20); 2041 err = stac92xx_parse_auto_config(codec, 0x1f, 0x20);
2042 if (!err) {
2043 if (spec->board_config < 0) {
2044 printk(KERN_WARNING "hda_codec: No auto-config is "
2045 "available, default to model=ref\n");
2046 spec->board_config = STAC_9205_REF;
2047 goto again;
2048 }
2049 err = -EINVAL;
2050 }
2011 if (err < 0) { 2051 if (err < 0) {
2012 stac92xx_free(codec); 2052 stac92xx_free(codec);
2013 return err; 2053 return err;