Răsfoiți Sursa

[ALSA] hda-intel - Add black/whitelist for position_fix option

Some devices are known to require position_fix=1 or 2 to make the
driver working correctly.  Otherwise the sound gets weird effects,
such as stutters.
Now a black/whitelist is introduced to indicate the position_fix
value explicitly for such misbehaving hardwares.  As a first example,
Dell D820 is listed there.  More will come later likely...

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Takashi Iwai 18 ani în urmă
părinte
comite
3372a153c2
1 a modificat fișierele cu 27 adăugiri și 1 ștergeri
  1. 27 1
      sound/pci/hda/hda_intel.c

+ 27 - 1
sound/pci/hda/hda_intel.c

@@ -1502,6 +1502,31 @@ static int azx_dev_free(struct snd_device *device)
 	return azx_free(device->device_data);
 	return azx_free(device->device_data);
 }
 }
 
 
+/*
+ * white/black-listing for position_fix
+ */
+static const struct snd_pci_quirk position_fix_list[] __devinitdata = {
+	SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_NONE),
+	{}
+};
+
+static int __devinit check_position_fix(struct azx *chip, int fix)
+{
+	const struct snd_pci_quirk *q;
+
+	if (fix == POS_FIX_AUTO) {
+		q = snd_pci_quirk_lookup(chip->pci, position_fix_list);
+		if (q) {
+			snd_printdd(KERN_INFO
+				    "hda_intel: position_fix set to %d "
+				    "for device %04x:%04x\n",
+				    q->value, q->subvendor, q->subdevice);
+			return q->value;
+		}
+	}
+	return fix;
+}
+
 /*
 /*
  * constructor
  * constructor
  */
  */
@@ -1536,7 +1561,8 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
 	chip->driver_type = driver_type;
 	chip->driver_type = driver_type;
 	chip->msi = enable_msi;
 	chip->msi = enable_msi;
 
 
-	chip->position_fix = position_fix;
+	chip->position_fix = check_position_fix(chip, position_fix);
+
 	chip->single_cmd = single_cmd;
 	chip->single_cmd = single_cmd;
 
 
 #if BITS_PER_LONG != 64
 #if BITS_PER_LONG != 64