aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-02-13 02:16:55 -0500
committerTakashi Iwai <tiwai@suse.de>2009-02-13 02:16:55 -0500
commitf1eaaeec11982c6b529d4255987fdf507a5fa69e (patch)
tree221055efba132f54eb71c4ae30fb385f9a1e7559
parentc98041f7d71890ac6aa2257d78ef175db44d2cd3 (diff)
ALSA: hda - Allow fixed codec-probe mask
Some devices have broken BIOS and they don't set the codec probe-bit properly after cleared by the driver. This makes the driver skipping the necessary codec slots. Since BIOS update isn't always easy, now the semantics of probe_mask option is changed a bit. When it contains the bit 8 (0x100), the lower bits are used to probe that slots regardless of codec-probe bits returned by the hardware. For example, probe_mask=0x103 will force to probe the codec slot #0 and #1. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/hda_intel.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 11e791b965f6..19886e4bc829 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -381,6 +381,7 @@ struct azx {
381 381
382 /* HD codec */ 382 /* HD codec */
383 unsigned short codec_mask; 383 unsigned short codec_mask;
384 int codec_probe_mask; /* copied from probe_mask option */
384 struct hda_bus *bus; 385 struct hda_bus *bus;
385 386
386 /* CORB/RIRB */ 387 /* CORB/RIRB */
@@ -1228,7 +1229,6 @@ static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] __devinitdata = {
1228}; 1229};
1229 1230
1230static int __devinit azx_codec_create(struct azx *chip, const char *model, 1231static int __devinit azx_codec_create(struct azx *chip, const char *model,
1231 unsigned int codec_probe_mask,
1232 int no_init) 1232 int no_init)
1233{ 1233{
1234 struct hda_bus_template bus_temp; 1234 struct hda_bus_template bus_temp;
@@ -1261,7 +1261,7 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model,
1261 1261
1262 /* First try to probe all given codec slots */ 1262 /* First try to probe all given codec slots */
1263 for (c = 0; c < max_slots; c++) { 1263 for (c = 0; c < max_slots; c++) {
1264 if ((chip->codec_mask & (1 << c)) & codec_probe_mask) { 1264 if ((chip->codec_mask & (1 << c)) & chip->codec_probe_mask) {
1265 if (probe_codec(chip, c) < 0) { 1265 if (probe_codec(chip, c) < 0) {
1266 /* Some BIOSen give you wrong codec addresses 1266 /* Some BIOSen give you wrong codec addresses
1267 * that don't exist 1267 * that don't exist
@@ -1285,7 +1285,7 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model,
1285 1285
1286 /* Then create codec instances */ 1286 /* Then create codec instances */
1287 for (c = 0; c < max_slots; c++) { 1287 for (c = 0; c < max_slots; c++) {
1288 if ((chip->codec_mask & (1 << c)) & codec_probe_mask) { 1288 if ((chip->codec_mask & (1 << c)) & chip->codec_probe_mask) {
1289 struct hda_codec *codec; 1289 struct hda_codec *codec;
1290 err = snd_hda_codec_new(chip->bus, c, !no_init, &codec); 1290 err = snd_hda_codec_new(chip->bus, c, !no_init, &codec);
1291 if (err < 0) 1291 if (err < 0)
@@ -2101,20 +2101,31 @@ static struct snd_pci_quirk probe_mask_list[] __devinitdata = {
2101 {} 2101 {}
2102}; 2102};
2103 2103
2104#define AZX_FORCE_CODEC_MASK 0x100
2105
2104static void __devinit check_probe_mask(struct azx *chip, int dev) 2106static void __devinit check_probe_mask(struct azx *chip, int dev)
2105{ 2107{
2106 const struct snd_pci_quirk *q; 2108 const struct snd_pci_quirk *q;
2107 2109
2108 if (probe_mask[dev] == -1) { 2110 chip->codec_probe_mask = probe_mask[dev];
2111 if (chip->codec_probe_mask == -1) {
2109 q = snd_pci_quirk_lookup(chip->pci, probe_mask_list); 2112 q = snd_pci_quirk_lookup(chip->pci, probe_mask_list);
2110 if (q) { 2113 if (q) {
2111 printk(KERN_INFO 2114 printk(KERN_INFO
2112 "hda_intel: probe_mask set to 0x%x " 2115 "hda_intel: probe_mask set to 0x%x "
2113 "for device %04x:%04x\n", 2116 "for device %04x:%04x\n",
2114 q->value, q->subvendor, q->subdevice); 2117 q->value, q->subvendor, q->subdevice);
2115 probe_mask[dev] = q->value; 2118 chip->codec_probe_mask = q->value;
2116 } 2119 }
2117 } 2120 }
2121
2122 /* check forced option */
2123 if (chip->codec_probe_mask != -1 &&
2124 (chip->codec_probe_mask & AZX_FORCE_CODEC_MASK)) {
2125 chip->codec_mask = chip->codec_probe_mask & 0xff;
2126 printk(KERN_INFO "hda_intel: codec_mask forced to 0x%x\n",
2127 chip->codec_mask);
2128 }
2118} 2129}
2119 2130
2120 2131
@@ -2347,8 +2358,7 @@ static int __devinit azx_probe(struct pci_dev *pci,
2347 card->private_data = chip; 2358 card->private_data = chip;
2348 2359
2349 /* create codec instances */ 2360 /* create codec instances */
2350 err = azx_codec_create(chip, model[dev], probe_mask[dev], 2361 err = azx_codec_create(chip, model[dev], probe_only[dev]);
2351 probe_only[dev]);
2352 if (err < 0) 2362 if (err < 0)
2353 goto out_free; 2363 goto out_free;
2354 2364