]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: Takashi Iwai <tiwai@suse.de> |
2 | Subject: ALSA: hda - Allow fixed codec-probe mask | |
3 | Patch-mainline: 2.6.30-rc1 | |
4 | References: bnc#502733 | |
5 | ||
6 | Some devices have broken BIOS and they don't set the codec probe-bit | |
7 | properly after cleared by the driver. This makes the driver skipping | |
8 | the necessary codec slots. | |
9 | ||
10 | Since BIOS update isn't always easy, now the semantics of probe_mask | |
11 | option is changed a bit. When it contains the bit 8 (0x100), the | |
12 | lower bits are used to probe that slots regardless of codec-probe bits | |
13 | returned by the hardware. | |
14 | ||
15 | For example, probe_mask=0x103 will force to probe the codec slot #0 | |
16 | and #1. | |
17 | ||
18 | Signed-off-by: Takashi Iwai <tiwai@suse.de> | |
19 | Signed-off-by: Takashi Iwai <tiwai@suse.de> | |
20 | ||
21 | --- | |
22 | sound/pci/hda/hda_intel.c | 29 ++++++++++++++++++++++------- | |
23 | 1 file changed, 22 insertions(+), 7 deletions(-) | |
24 | ||
25 | --- a/sound/pci/hda/hda_intel.c | |
26 | +++ b/sound/pci/hda/hda_intel.c | |
27 | @@ -373,6 +373,7 @@ struct azx { | |
28 | ||
29 | /* HD codec */ | |
30 | unsigned short codec_mask; | |
31 | + int codec_probe_mask; /* copied from probe_mask option */ | |
32 | struct hda_bus *bus; | |
33 | ||
34 | /* CORB/RIRB */ | |
35 | @@ -1222,8 +1223,7 @@ static unsigned int azx_max_codecs[AZX_N | |
36 | [AZX_DRIVER_TERA] = 1, | |
37 | }; | |
38 | ||
39 | -static int __devinit azx_codec_create(struct azx *chip, const char *model, | |
40 | - unsigned int codec_probe_mask) | |
41 | +static int __devinit azx_codec_create(struct azx *chip, const char *model) | |
42 | { | |
43 | struct hda_bus_template bus_temp; | |
44 | int c, codecs, err; | |
45 | @@ -1253,7 +1253,7 @@ static int __devinit azx_codec_create(st | |
46 | ||
47 | /* First try to probe all given codec slots */ | |
48 | for (c = 0; c < max_slots; c++) { | |
49 | - if ((chip->codec_mask & (1 << c)) & codec_probe_mask) { | |
50 | + if ((chip->codec_mask & (1 << c)) & chip->codec_probe_mask) { | |
51 | if (probe_codec(chip, c) < 0) { | |
52 | /* Some BIOSen give you wrong codec addresses | |
53 | * that don't exist | |
54 | @@ -1277,7 +1277,7 @@ static int __devinit azx_codec_create(st | |
55 | ||
56 | /* Then create codec instances */ | |
57 | for (c = 0; c < max_slots; c++) { | |
58 | - if ((chip->codec_mask & (1 << c)) & codec_probe_mask) { | |
59 | + if ((chip->codec_mask & (1 << c)) & chip->codec_probe_mask) { | |
60 | struct hda_codec *codec; | |
61 | err = snd_hda_codec_new(chip->bus, c, &codec); | |
62 | if (err < 0) | |
63 | @@ -2153,23 +2153,38 @@ static struct snd_pci_quirk probe_mask_l | |
64 | SND_PCI_QUIRK(0x17aa, 0x20ac, "Thinkpad X/T/R61", 0x01), | |
65 | /* broken BIOS */ | |
66 | SND_PCI_QUIRK(0x1028, 0x20ac, "Dell Studio Desktop", 0x01), | |
67 | + /* including bogus ALC268 in slot#2 that conflicts with ALC888 */ | |
68 | + SND_PCI_QUIRK(0x17c0, 0x4085, "Medion MD96630", 0x01), | |
69 | + /* forced codec slots */ | |
70 | + SND_PCI_QUIRK(0x1046, 0x1262, "ASUS W5F", 0x103), | |
71 | {} | |
72 | }; | |
73 | ||
74 | +#define AZX_FORCE_CODEC_MASK 0x100 | |
75 | + | |
76 | static void __devinit check_probe_mask(struct azx *chip, int dev) | |
77 | { | |
78 | const struct snd_pci_quirk *q; | |
79 | ||
80 | - if (probe_mask[dev] == -1) { | |
81 | + chip->codec_probe_mask = probe_mask[dev]; | |
82 | + if (chip->codec_probe_mask == -1) { | |
83 | q = snd_pci_quirk_lookup(chip->pci, probe_mask_list); | |
84 | if (q) { | |
85 | printk(KERN_INFO | |
86 | "hda_intel: probe_mask set to 0x%x " | |
87 | "for device %04x:%04x\n", | |
88 | q->value, q->subvendor, q->subdevice); | |
89 | - probe_mask[dev] = q->value; | |
90 | + chip->codec_probe_mask = q->value; | |
91 | } | |
92 | } | |
93 | + | |
94 | + /* check forced option */ | |
95 | + if (chip->codec_probe_mask != -1 && | |
96 | + (chip->codec_probe_mask & AZX_FORCE_CODEC_MASK)) { | |
97 | + chip->codec_mask = chip->codec_probe_mask & 0xff; | |
98 | + printk(KERN_INFO "hda_intel: codec_mask forced to 0x%x\n", | |
99 | + chip->codec_mask); | |
100 | + } | |
101 | } | |
102 | ||
103 | ||
104 | @@ -2407,7 +2422,7 @@ static int __devinit azx_probe(struct pc | |
105 | card->private_data = chip; | |
106 | ||
107 | /* create codec instances */ | |
108 | - err = azx_codec_create(chip, model[dev], probe_mask[dev]); | |
109 | + err = azx_codec_create(chip, model[dev]); | |
110 | if (err < 0) | |
111 | goto out_free; | |
112 |