diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/ac97_codec.c linux-2.5/sound/oss/ac97_codec.c --- bk-linus/sound/oss/ac97_codec.c 2002-11-21 02:26:01.000000000 +0000 +++ linux-2.5/sound/oss/ac97_codec.c 2002-11-21 18:06:14.000000000 +0000 @@ -113,7 +113,7 @@ static const struct { {0x41445340, "Analog Devices AD1881", &null_ops}, {0x41445348, "Analog Devices AD1881A", &null_ops}, {0x41445360, "Analog Devices AD1885", &default_ops}, - {0x41445361, "Analog Devices AD1886", &default_ops}, + {0x41445361, "Analog Devices AD1886", &ad1886_ops}, {0x41445460, "Analog Devices AD1885", &default_ops}, {0x41445461, "Analog Devices AD1886", &ad1886_ops}, {0x414B4D00, "Asahi Kasei AK4540", &null_ops}, @@ -654,6 +654,27 @@ int ac97_read_proc (char *page, char **s } /** + * codec_id - Turn id1/id2 into a PnP string + * @id1: Vendor ID1 + * @id2: Vendor ID2 + * @buf: 10 byte buffer + * + * Fills buf with a zero terminated PnP ident string for the id1/id2 + * pair. For convenience the return is the passed in buffer pointer. + */ + +static char *codec_id(u16 id1, u16 id2, char *buf) +{ + if(id1&0x8080) + snprintf(buf, 10, "%0x4X:%0x4X", id1, id2); + buf[0] = (id1 >> 8); + buf[1] = (id1 & 0xFF); + buf[2] = (id2 >> 8); + snprintf(buf+3, 7, "%d", id2&0xFF); + return buf; +} + +/** * ac97_probe_codec - Initialize and setup AC97-compatible codec * @codec: (in/out) Kernel info for a single AC97 codec * @@ -681,6 +702,7 @@ int ac97_probe_codec(struct ac97_codec * u16 id1, id2; u16 audio, modem; int i; + char cidbuf[10]; /* probing AC97 codec, AC97 2.0 says that bit 15 of register 0x00 (reset) should * be read zero. @@ -698,13 +720,16 @@ int ac97_probe_codec(struct ac97_codec * if ((audio = codec->codec_read(codec, AC97_RESET)) & 0x8000) { printk(KERN_ERR "ac97_codec: %s ac97 codec not present\n", - codec->id ? "Secondary" : "Primary"); + (codec->id & 0x2) ? (codec->id&1 ? "4th" : "Tertiary") + : (codec->id&1 ? "Secondary": "Primary")); return 0; } /* probe for Modem Codec */ codec->codec_write(codec, AC97_EXTENDED_MODEM_ID, 0L); - modem = codec->codec_read(codec, AC97_EXTENDED_MODEM_ID); + modem = codec->codec_read(codec, AC97_EXTENDED_MODEM_ID) & 1; + modem |= (audio&2); + audio &= ~2; codec->name = NULL; codec->codec_ops = &null_ops; @@ -721,9 +746,9 @@ int ac97_probe_codec(struct ac97_codec * } if (codec->name == NULL) codec->name = "Unknown"; - printk(KERN_INFO "ac97_codec: AC97 %s codec, id: 0x%04x:" - "0x%04x (%s)\n", audio ? "Audio" : (modem ? "Modem" : ""), - id1, id2, codec->name); + printk(KERN_INFO "ac97_codec: AC97 %s codec, id: %s(%s)\n", + modem ? "Modem" : (audio ? "Audio" : ""), + codec_id(id1, id2, cidbuf), codec->name); return ac97_init_mixer(codec); } @@ -746,10 +771,10 @@ static int ac97_init_mixer(struct ac97_c /* detect bit resolution */ codec->codec_write(codec, AC97_MASTER_VOL_STEREO, 0x2020); - if(codec->codec_read(codec, AC97_MASTER_VOL_STEREO) == 0x1f1f) - codec->bit_resolution = 5; - else + if(codec->codec_read(codec, AC97_MASTER_VOL_STEREO) == 0x2020) codec->bit_resolution = 6; + else + codec->bit_resolution = 5; /* generic OSS to AC97 wrapper */ codec->read_mixer = ac97_read_mixer; @@ -917,7 +942,7 @@ static int tritech_maestro_init(struct a /* * Presario700 workaround - * for Jack Sense/SPDIF Register misetting causing + * for Jack Sense/SPDIF Register mis-setting causing * no audible output * by Santiago Nullo 04/05/2002 */ diff -urpN --exclude-from=/home/davej/.exclude bk-linus/include/linux/ac97_codec.h linux-2.5/include/linux/ac97_codec.h --- bk-linus/include/linux/ac97_codec.h 2002-11-21 02:23:44.000000000 +0000 +++ linux-2.5/include/linux/ac97_codec.h 2002-11-21 18:04:37.000000000 +0000 @@ -32,7 +32,7 @@ #define AC97_PCM_FRONT_DAC_RATE 0x002C /* PCM Front DAC Rate */ #define AC97_PCM_SURR_DAC_RATE 0x002E /* PCM Surround DAC Rate */ #define AC97_PCM_LFE_DAC_RATE 0x0030 /* PCM LFE DAC Rate */ -#define AC97_PCM_LR_ADC_RATE 0x0032 /* PCM LR DAC Rate */ +#define AC97_PCM_LR_ADC_RATE 0x0032 /* PCM LR ADC Rate */ #define AC97_PCM_MIC_ADC_RATE 0x0034 /* PCM MIC ADC Rate */ #define AC97_CENTER_LFE_MASTER 0x0036 /* Center + LFE Master Volume */ #define AC97_SURROUND_MASTER 0x0038 /* Surround (Rear) Master Volume */ @@ -143,6 +143,39 @@ #define AC97_PWR_PR6 0x4000 /* HP amp powerdown */ #define AC97_PWR_PR7 0x8000 /* Modem off - if supported */ +/* extended audio ID register bit defines */ +#define AC97_EXTID_VRA 0x0001 +#define AC97_EXTID_DRA 0x0002 +#define AC97_EXTID_SPDIF 0x0004 +#define AC97_EXTID_VRM 0x0008 +#define AC97_EXTID_DSA0 0x0010 +#define AC97_EXTID_DSA1 0x0020 +#define AC97_EXTID_CDAC 0x0040 +#define AC97_EXTID_SDAC 0x0080 +#define AC97_EXTID_LDAC 0x0100 +#define AC97_EXTID_AMAP 0x0200 +#define AC97_EXTID_REV0 0x0400 +#define AC97_EXTID_REV1 0x0800 +#define AC97_EXTID_ID0 0x4000 +#define AC97_EXTID_ID1 0x8000 + +/* extended status register bit defines */ +#define AC97_EXTSTAT_VRA 0x0001 +#define AC97_EXTSTAT_DRA 0x0002 +#define AC97_EXTSTAT_SPDIF 0x0004 +#define AC97_EXTSTAT_VRM 0x0008 +#define AC97_EXTSTAT_SPSA0 0x0010 +#define AC97_EXTSTAT_SPSA1 0x0020 +#define AC97_EXTSTAT_CDAC 0x0040 +#define AC97_EXTSTAT_SDAC 0x0080 +#define AC97_EXTSTAT_LDAC 0x0100 +#define AC97_EXTSTAT_MADC 0x0200 +#define AC97_EXTSTAT_SPCV 0x0400 +#define AC97_EXTSTAT_PRI 0x0800 +#define AC97_EXTSTAT_PRJ 0x1000 +#define AC97_EXTSTAT_PRK 0x2000 +#define AC97_EXTSTAT_PRL 0x4000 + /* useful power states */ #define AC97_PWR_D0 0x0000 /* everything on */ #define AC97_PWR_D1 AC97_PWR_PR0|AC97_PWR_PR1|AC97_PWR_PR4