aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-09-03 10:00:44 -0400
committerJaroslav Kysela <perex@perex.cz>2008-09-09 03:10:49 -0400
commit2f5983f2aaffbc92addc4ec378989a1c200cf3dd (patch)
tree507a36327ceeb658e0ab055451ec9a64e7b63ae4 /sound/pci
parent7003609b3bdf0336c742974bd1ad2d82ffb3b043 (diff)
ALSA: hda - allow probing of 4 codecs
Allow probing of 4 codecs on known good situations. On some known bad situations, it should be avoided. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/hda_intel.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 52a3adfac7f8..60cc44abf58f 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -222,9 +222,9 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
222#define RIRB_INT_OVERRUN 0x04 222#define RIRB_INT_OVERRUN 0x04
223#define RIRB_INT_MASK 0x05 223#define RIRB_INT_MASK 0x05
224 224
225/* STATESTS int mask: SD2,SD1,SD0 */ 225/* STATESTS int mask: S3,SD2,SD1,SD0 */
226#define AZX_MAX_CODECS 3 226#define AZX_MAX_CODECS 4
227#define STATESTS_INT_MASK 0x07 227#define STATESTS_INT_MASK 0x0f
228 228
229/* SD_CTL bits */ 229/* SD_CTL bits */
230#define SD_CTL_STREAM_RESET 0x01 /* stream reset bit */ 230#define SD_CTL_STREAM_RESET 0x01 /* stream reset bit */
@@ -410,6 +410,7 @@ enum {
410 AZX_DRIVER_ULI, 410 AZX_DRIVER_ULI,
411 AZX_DRIVER_NVIDIA, 411 AZX_DRIVER_NVIDIA,
412 AZX_DRIVER_TERA, 412 AZX_DRIVER_TERA,
413 AZX_NUM_DRIVERS, /* keep this as last entry */
413}; 414};
414 415
415static char *driver_short_names[] __devinitdata = { 416static char *driver_short_names[] __devinitdata = {
@@ -1184,23 +1185,26 @@ static int azx_setup_controller(struct azx *chip, struct azx_dev *azx_dev)
1184 * Codec initialization 1185 * Codec initialization
1185 */ 1186 */
1186 1187
1187static unsigned int azx_max_codecs[] __devinitdata = { 1188/* number of codec slots for each chipset: 0 = default slots (i.e. 4) */
1188 [AZX_DRIVER_ICH] = 4, /* Some ICH9 boards use SD3 */ 1189static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] __devinitdata = {
1189 [AZX_DRIVER_SCH] = 3,
1190 [AZX_DRIVER_ATI] = 4,
1191 [AZX_DRIVER_ATIHDMI] = 4,
1192 [AZX_DRIVER_VIA] = 3, /* FIXME: correct? */
1193 [AZX_DRIVER_SIS] = 3, /* FIXME: correct? */
1194 [AZX_DRIVER_ULI] = 3, /* FIXME: correct? */
1195 [AZX_DRIVER_NVIDIA] = 3, /* FIXME: correct? */
1196 [AZX_DRIVER_TERA] = 1, 1190 [AZX_DRIVER_TERA] = 1,
1197}; 1191};
1198 1192
1193/* number of slots to probe as default
1194 * this can be different from azx_max_codecs[] -- e.g. some boards
1195 * report wrongly the non-existing 4th slot availability
1196 */
1197static unsigned int azx_default_codecs[AZX_NUM_DRIVERS] __devinitdata = {
1198 [AZX_DRIVER_ICH] = 3,
1199 [AZX_DRIVER_ATI] = 3,
1200};
1201
1199static int __devinit azx_codec_create(struct azx *chip, const char *model, 1202static int __devinit azx_codec_create(struct azx *chip, const char *model,
1200 unsigned int codec_probe_mask) 1203 unsigned int codec_probe_mask)
1201{ 1204{
1202 struct hda_bus_template bus_temp; 1205 struct hda_bus_template bus_temp;
1203 int c, codecs, audio_codecs, err; 1206 int c, codecs, audio_codecs, err;
1207 int def_slots, max_slots;
1204 1208
1205 memset(&bus_temp, 0, sizeof(bus_temp)); 1209 memset(&bus_temp, 0, sizeof(bus_temp));
1206 bus_temp.private_data = chip; 1210 bus_temp.private_data = chip;
@@ -1217,7 +1221,13 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model,
1217 return err; 1221 return err;
1218 1222
1219 codecs = audio_codecs = 0; 1223 codecs = audio_codecs = 0;
1220 for (c = 0; c < AZX_MAX_CODECS; c++) { 1224 max_slots = azx_max_codecs[chip->driver_type];
1225 if (!max_slots)
1226 max_slots = AZX_MAX_CODECS;
1227 def_slots = azx_default_codecs[chip->driver_type];
1228 if (!def_slots)
1229 def_slots = max_slots;
1230 for (c = 0; c < def_slots; c++) {
1221 if ((chip->codec_mask & (1 << c)) & codec_probe_mask) { 1231 if ((chip->codec_mask & (1 << c)) & codec_probe_mask) {
1222 struct hda_codec *codec; 1232 struct hda_codec *codec;
1223 err = snd_hda_codec_new(chip->bus, c, &codec); 1233 err = snd_hda_codec_new(chip->bus, c, &codec);
@@ -1230,7 +1240,7 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model,
1230 } 1240 }
1231 if (!audio_codecs) { 1241 if (!audio_codecs) {
1232 /* probe additional slots if no codec is found */ 1242 /* probe additional slots if no codec is found */
1233 for (; c < azx_max_codecs[chip->driver_type]; c++) { 1243 for (; c < max_slots; c++) {
1234 if ((chip->codec_mask & (1 << c)) & codec_probe_mask) { 1244 if ((chip->codec_mask & (1 << c)) & codec_probe_mask) {
1235 err = snd_hda_codec_new(chip->bus, c, NULL); 1245 err = snd_hda_codec_new(chip->bus, c, NULL);
1236 if (err < 0) 1246 if (err < 0)