]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/suse-2.6.27.39/patches.drivers/alsa-hda-probe-fix
Fix oinkmaster patch.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.drivers / alsa-hda-probe-fix
CommitLineData
2cb7cef9
BS
1From: Takashi Iwai <tiwai@suse.de>
2Subject: ALSA: hda - Fix and clean-up codec-probing
3Patch-mainline: 2.6.28-rc1
4References:
5
6Fixed and cleaned up the codec-probing code. The 4th slot is used
7for HDMI on some devices, and this patch allows to probe it as well.
8
9Signed-off-by: Takashi Iwai <tiwai@suse.de>
10
11---
12---
13 sound/pci/hda/hda_intel.c | 41 +++++++++++++++++++++++++++--------------
14 1 file changed, 27 insertions(+), 14 deletions(-)
15
16--- a/sound/pci/hda/hda_intel.c
17+++ b/sound/pci/hda/hda_intel.c
18@@ -223,9 +223,9 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO
19 #define RIRB_INT_OVERRUN 0x04
20 #define RIRB_INT_MASK 0x05
21
22-/* STATESTS int mask: SD2,SD1,SD0 */
23-#define AZX_MAX_CODECS 3
24-#define STATESTS_INT_MASK 0x07
25+/* STATESTS int mask: S3,SD2,SD1,SD0 */
26+#define AZX_MAX_CODECS 4
27+#define STATESTS_INT_MASK 0x0f
28
29 /* SD_CTL bits */
30 #define SD_CTL_STREAM_RESET 0x01 /* stream reset bit */
31@@ -402,6 +402,7 @@ enum {
32 AZX_DRIVER_ULI,
33 AZX_DRIVER_NVIDIA,
34 AZX_DRIVER_TERA,
35+ AZX_NUM_DRIVERS, /* keep this as last entry */
36 };
37
38 static char *driver_short_names[] __devinitdata = {
39@@ -1173,23 +1174,26 @@ static int azx_setup_controller(struct a
40 * Codec initialization
41 */
42
43-static unsigned int azx_max_codecs[] __devinitdata = {
44- [AZX_DRIVER_ICH] = 4, /* Some ICH9 boards use SD3 */
45- [AZX_DRIVER_SCH] = 3,
46- [AZX_DRIVER_ATI] = 4,
47- [AZX_DRIVER_ATIHDMI] = 4,
48- [AZX_DRIVER_VIA] = 3, /* FIXME: correct? */
49- [AZX_DRIVER_SIS] = 3, /* FIXME: correct? */
50- [AZX_DRIVER_ULI] = 3, /* FIXME: correct? */
51- [AZX_DRIVER_NVIDIA] = 3, /* FIXME: correct? */
52+/* number of codec slots for each chipset: 0 = default slots (i.e. 4) */
53+static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] __devinitdata = {
54 [AZX_DRIVER_TERA] = 1,
55 };
56
57+/* number of slots to probe as default
58+ * this can be different from azx_max_codecs[] -- e.g. some boards
59+ * report wrongly the non-existing 4th slot availability
60+ */
61+static unsigned int azx_default_codecs[AZX_NUM_DRIVERS] __devinitdata = {
62+ [AZX_DRIVER_ICH] = 3,
63+ [AZX_DRIVER_ATI] = 3,
64+};
65+
66 static int __devinit azx_codec_create(struct azx *chip, const char *model,
67 unsigned int codec_probe_mask)
68 {
69 struct hda_bus_template bus_temp;
70 int c, codecs, audio_codecs, err;
71+ int def_slots, max_slots;
72
73 memset(&bus_temp, 0, sizeof(bus_temp));
74 bus_temp.private_data = chip;
75@@ -1205,8 +1209,17 @@ static int __devinit azx_codec_create(st
76 if (err < 0)
77 return err;
78
79+ if (chip->driver_type == AZX_DRIVER_NVIDIA)
80+ chip->bus->needs_damn_long_delay = 1;
81+
82 codecs = audio_codecs = 0;
83- for (c = 0; c < AZX_MAX_CODECS; c++) {
84+ max_slots = azx_max_codecs[chip->driver_type];
85+ if (!max_slots)
86+ max_slots = AZX_MAX_CODECS;
87+ def_slots = azx_default_codecs[chip->driver_type];
88+ if (!def_slots)
89+ def_slots = max_slots;
90+ for (c = 0; c < def_slots; c++) {
91 if ((chip->codec_mask & (1 << c)) & codec_probe_mask) {
92 struct hda_codec *codec;
93 err = snd_hda_codec_new(chip->bus, c, &codec);
94@@ -1219,7 +1232,7 @@ static int __devinit azx_codec_create(st
95 }
96 if (!audio_codecs) {
97 /* probe additional slots if no codec is found */
98- for (; c < azx_max_codecs[chip->driver_type]; c++) {
99+ for (; c < max_slots; c++) {
100 if ((chip->codec_mask & (1 << c)) & codec_probe_mask) {
101 err = snd_hda_codec_new(chip->bus, c, NULL);
102 if (err < 0)