aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/oxygen/oxygen_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/oxygen/oxygen_lib.c')
-rw-r--r--sound/pci/oxygen/oxygen_lib.c82
1 files changed, 50 insertions, 32 deletions
diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c
index 5b77c9439c3..ba2bb4995d1 100644
--- a/sound/pci/oxygen/oxygen_lib.c
+++ b/sound/pci/oxygen/oxygen_lib.c
@@ -142,13 +142,25 @@ static void oxygen_proc_read(struct snd_info_entry *entry,
}
if (mutex_lock_interruptible(&chip->mutex) < 0)
return;
- snd_iprintf(buffer, "\nAC97\n");
- for (i = 0; i < 0x80; i += 0x10) {
- snd_iprintf(buffer, "%02x:", i);
- for (j = 0; j < 0x10; j += 2)
- snd_iprintf(buffer, " %04x",
- oxygen_read_ac97(chip, 0, i + j));
- snd_iprintf(buffer, "\n");
+ if (chip->has_ac97_0) {
+ snd_iprintf(buffer, "\nAC97\n");
+ for (i = 0; i < 0x80; i += 0x10) {
+ snd_iprintf(buffer, "%02x:", i);
+ for (j = 0; j < 0x10; j += 2)
+ snd_iprintf(buffer, " %04x",
+ oxygen_read_ac97(chip, 0, i + j));
+ snd_iprintf(buffer, "\n");
+ }
+ }
+ if (chip->has_ac97_1) {
+ snd_iprintf(buffer, "\nAC97 2\n");
+ for (i = 0; i < 0x80; i += 0x10) {
+ snd_iprintf(buffer, "%02x:", i);
+ for (j = 0; j < 0x10; j += 2)
+ snd_iprintf(buffer, " %04x",
+ oxygen_read_ac97(chip, 1, i + j));
+ snd_iprintf(buffer, "\n");
+ }
}
mutex_unlock(&chip->mutex);
}
@@ -184,6 +196,10 @@ static void __devinit oxygen_init(struct oxygen *chip)
if (chip->revision == 1)
oxygen_set_bits8(chip, OXYGEN_MISC, OXYGEN_MISC_MAGIC);
+ i = oxygen_read16(chip, OXYGEN_AC97_CONTROL);
+ chip->has_ac97_0 = (i & OXYGEN_AC97_CODEC_0) != 0;
+ chip->has_ac97_1 = (i & OXYGEN_AC97_CODEC_1) != 0;
+
oxygen_set_bits8(chip, OXYGEN_FUNCTION,
OXYGEN_FUNCTION_RESET_CODEC |
OXYGEN_FUNCTION_ENABLE_SPI_4_5);
@@ -202,31 +218,33 @@ static void __devinit oxygen_init(struct oxygen *chip)
oxygen_write16(chip, OXYGEN_DMA_STATUS, 0);
oxygen_write8(chip, OXYGEN_AC97_INTERRUPT_MASK, 0x00);
- oxygen_clear_bits16(chip, OXYGEN_AC97_OUT_CONFIG,
- OXYGEN_AC97_OUT_MAGIC3);
- oxygen_set_bits16(chip, OXYGEN_AC97_IN_CONFIG,
- OXYGEN_AC97_IN_MAGIC3);
- oxygen_write_ac97(chip, 0, AC97_RESET, 0);
- msleep(1);
- oxygen_ac97_set_bits(chip, 0, 0x70, 0x0300);
- oxygen_ac97_set_bits(chip, 0, 0x64, 0x8043);
- oxygen_ac97_set_bits(chip, 0, 0x62, 0x180f);
- oxygen_write_ac97(chip, 0, AC97_MASTER, 0x0000);
- oxygen_write_ac97(chip, 0, AC97_PC_BEEP, 0x8000);
- oxygen_write_ac97(chip, 0, AC97_MIC, 0x8808);
- oxygen_write_ac97(chip, 0, AC97_LINE, 0x0808);
- oxygen_write_ac97(chip, 0, AC97_CD, 0x8808);
- oxygen_write_ac97(chip, 0, AC97_VIDEO, 0x8808);
- oxygen_write_ac97(chip, 0, AC97_AUX, 0x8808);
- oxygen_write_ac97(chip, 0, AC97_REC_GAIN, 0x8000);
- oxygen_write_ac97(chip, 0, AC97_CENTER_LFE_MASTER, 0x8080);
- oxygen_write_ac97(chip, 0, AC97_SURROUND_MASTER, 0x8080);
- oxygen_ac97_clear_bits(chip, 0, 0x72, 0x0001);
- /* power down unused ADCs and DACs */
- oxygen_ac97_set_bits(chip, 0, AC97_POWERDOWN,
- AC97_PD_PR0 | AC97_PD_PR1);
- oxygen_ac97_set_bits(chip, 0, AC97_EXTENDED_STATUS,
- AC97_EA_PRI | AC97_EA_PRJ | AC97_EA_PRK);
+ if (chip->has_ac97_0) {
+ oxygen_clear_bits16(chip, OXYGEN_AC97_OUT_CONFIG,
+ OXYGEN_AC97_OUT_MAGIC3);
+ oxygen_set_bits16(chip, OXYGEN_AC97_IN_CONFIG,
+ OXYGEN_AC97_IN_MAGIC3);
+ oxygen_write_ac97(chip, 0, AC97_RESET, 0);
+ msleep(1);
+ oxygen_ac97_set_bits(chip, 0, 0x70, 0x0300);
+ oxygen_ac97_set_bits(chip, 0, 0x64, 0x8043);
+ oxygen_ac97_set_bits(chip, 0, 0x62, 0x180f);
+ oxygen_write_ac97(chip, 0, AC97_MASTER, 0x0000);
+ oxygen_write_ac97(chip, 0, AC97_PC_BEEP, 0x8000);
+ oxygen_write_ac97(chip, 0, AC97_MIC, 0x8808);
+ oxygen_write_ac97(chip, 0, AC97_LINE, 0x0808);
+ oxygen_write_ac97(chip, 0, AC97_CD, 0x8808);
+ oxygen_write_ac97(chip, 0, AC97_VIDEO, 0x8808);
+ oxygen_write_ac97(chip, 0, AC97_AUX, 0x8808);
+ oxygen_write_ac97(chip, 0, AC97_REC_GAIN, 0x8000);
+ oxygen_write_ac97(chip, 0, AC97_CENTER_LFE_MASTER, 0x8080);
+ oxygen_write_ac97(chip, 0, AC97_SURROUND_MASTER, 0x8080);
+ oxygen_ac97_clear_bits(chip, 0, 0x72, 0x0001);
+ /* power down unused ADCs and DACs */
+ oxygen_ac97_set_bits(chip, 0, AC97_POWERDOWN,
+ AC97_PD_PR0 | AC97_PD_PR1);
+ oxygen_ac97_set_bits(chip, 0, AC97_EXTENDED_STATUS,
+ AC97_EA_PRI | AC97_EA_PRJ | AC97_EA_PRK);
+ }
}
static void oxygen_card_free(struct snd_card *card)