Commit 2f5983f2 authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

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: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@perex.cz>
parent 7003609b
...@@ -222,9 +222,9 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 }; ...@@ -222,9 +222,9 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
#define RIRB_INT_OVERRUN 0x04 #define RIRB_INT_OVERRUN 0x04
#define RIRB_INT_MASK 0x05 #define RIRB_INT_MASK 0x05
/* STATESTS int mask: SD2,SD1,SD0 */ /* STATESTS int mask: S3,SD2,SD1,SD0 */
#define AZX_MAX_CODECS 3 #define AZX_MAX_CODECS 4
#define STATESTS_INT_MASK 0x07 #define STATESTS_INT_MASK 0x0f
/* SD_CTL bits */ /* SD_CTL bits */
#define SD_CTL_STREAM_RESET 0x01 /* stream reset bit */ #define SD_CTL_STREAM_RESET 0x01 /* stream reset bit */
...@@ -410,6 +410,7 @@ enum { ...@@ -410,6 +410,7 @@ enum {
AZX_DRIVER_ULI, AZX_DRIVER_ULI,
AZX_DRIVER_NVIDIA, AZX_DRIVER_NVIDIA,
AZX_DRIVER_TERA, AZX_DRIVER_TERA,
AZX_NUM_DRIVERS, /* keep this as last entry */
}; };
static char *driver_short_names[] __devinitdata = { static char *driver_short_names[] __devinitdata = {
...@@ -1184,23 +1185,26 @@ static int azx_setup_controller(struct azx *chip, struct azx_dev *azx_dev) ...@@ -1184,23 +1185,26 @@ static int azx_setup_controller(struct azx *chip, struct azx_dev *azx_dev)
* Codec initialization * Codec initialization
*/ */
static unsigned int azx_max_codecs[] __devinitdata = { /* number of codec slots for each chipset: 0 = default slots (i.e. 4) */
[AZX_DRIVER_ICH] = 4, /* Some ICH9 boards use SD3 */ static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] __devinitdata = {
[AZX_DRIVER_SCH] = 3,
[AZX_DRIVER_ATI] = 4,
[AZX_DRIVER_ATIHDMI] = 4,
[AZX_DRIVER_VIA] = 3, /* FIXME: correct? */
[AZX_DRIVER_SIS] = 3, /* FIXME: correct? */
[AZX_DRIVER_ULI] = 3, /* FIXME: correct? */
[AZX_DRIVER_NVIDIA] = 3, /* FIXME: correct? */
[AZX_DRIVER_TERA] = 1, [AZX_DRIVER_TERA] = 1,
}; };
/* number of slots to probe as default
* this can be different from azx_max_codecs[] -- e.g. some boards
* report wrongly the non-existing 4th slot availability
*/
static unsigned int azx_default_codecs[AZX_NUM_DRIVERS] __devinitdata = {
[AZX_DRIVER_ICH] = 3,
[AZX_DRIVER_ATI] = 3,
};
static int __devinit azx_codec_create(struct azx *chip, const char *model, static int __devinit azx_codec_create(struct azx *chip, const char *model,
unsigned int codec_probe_mask) unsigned int codec_probe_mask)
{ {
struct hda_bus_template bus_temp; struct hda_bus_template bus_temp;
int c, codecs, audio_codecs, err; int c, codecs, audio_codecs, err;
int def_slots, max_slots;
memset(&bus_temp, 0, sizeof(bus_temp)); memset(&bus_temp, 0, sizeof(bus_temp));
bus_temp.private_data = chip; bus_temp.private_data = chip;
...@@ -1217,7 +1221,13 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model, ...@@ -1217,7 +1221,13 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model,
return err; return err;
codecs = audio_codecs = 0; codecs = audio_codecs = 0;
for (c = 0; c < AZX_MAX_CODECS; c++) { max_slots = azx_max_codecs[chip->driver_type];
if (!max_slots)
max_slots = AZX_MAX_CODECS;
def_slots = azx_default_codecs[chip->driver_type];
if (!def_slots)
def_slots = max_slots;
for (c = 0; c < def_slots; c++) {
if ((chip->codec_mask & (1 << c)) & codec_probe_mask) { if ((chip->codec_mask & (1 << c)) & codec_probe_mask) {
struct hda_codec *codec; struct hda_codec *codec;
err = snd_hda_codec_new(chip->bus, c, &codec); 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,7 +1240,7 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model,
} }
if (!audio_codecs) { if (!audio_codecs) {
/* probe additional slots if no codec is found */ /* probe additional slots if no codec is found */
for (; c < azx_max_codecs[chip->driver_type]; c++) { for (; c < max_slots; c++) {
if ((chip->codec_mask & (1 << c)) & codec_probe_mask) { if ((chip->codec_mask & (1 << c)) & codec_probe_mask) {
err = snd_hda_codec_new(chip->bus, c, NULL); err = snd_hda_codec_new(chip->bus, c, NULL);
if (err < 0) if (err < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment