aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/oxygen/oxygen_lib.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2008-04-09 03:16:33 -0400
committerTakashi Iwai <tiwai@suse.de>2008-04-24 06:00:32 -0400
commit1d98c7d4be6ac521e3391025ddffcfe0400c798c (patch)
treebaa410a35f6ef8b275cdb40aa56811f5fccf74a5 /sound/pci/oxygen/oxygen_lib.c
parent11864b4b84194b459fc20e0ec47906885bddb12e (diff)
[ALSA] oxygen: use SPDIF input only if present
If the card model does not have a digital input or an AC97 codec, disable the respective interrupt and mixer controls. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/oxygen/oxygen_lib.c')
-rw-r--r--sound/pci/oxygen/oxygen_lib.c49
1 files changed, 31 insertions, 18 deletions
diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c
index 4f3d9e5fc5db..39e4b7a51740 100644
--- a/sound/pci/oxygen/oxygen_lib.c
+++ b/sound/pci/oxygen/oxygen_lib.c
@@ -291,20 +291,27 @@ static void oxygen_init(struct oxygen *chip)
291 OXYGEN_I2S_MASTER | OXYGEN_I2S_MUTE_MCLK); 291 OXYGEN_I2S_MASTER | OXYGEN_I2S_MUTE_MCLK);
292 oxygen_write16(chip, OXYGEN_I2S_C_FORMAT, 292 oxygen_write16(chip, OXYGEN_I2S_C_FORMAT,
293 OXYGEN_I2S_MASTER | OXYGEN_I2S_MUTE_MCLK); 293 OXYGEN_I2S_MASTER | OXYGEN_I2S_MUTE_MCLK);
294 oxygen_write32_masked(chip, OXYGEN_SPDIF_CONTROL, 294 oxygen_clear_bits32(chip, OXYGEN_SPDIF_CONTROL,
295 OXYGEN_SPDIF_SENSE_MASK | 295 OXYGEN_SPDIF_OUT_ENABLE |
296 OXYGEN_SPDIF_LOCK_MASK | 296 OXYGEN_SPDIF_LOOPBACK);
297 OXYGEN_SPDIF_RATE_MASK | 297 if (chip->model->pcm_dev_cfg & CAPTURE_1_FROM_SPDIF)
298 OXYGEN_SPDIF_LOCK_PAR | 298 oxygen_write32_masked(chip, OXYGEN_SPDIF_CONTROL,
299 OXYGEN_SPDIF_IN_CLOCK_96, 299 OXYGEN_SPDIF_SENSE_MASK |
300 OXYGEN_SPDIF_OUT_ENABLE | 300 OXYGEN_SPDIF_LOCK_MASK |
301 OXYGEN_SPDIF_LOOPBACK | 301 OXYGEN_SPDIF_RATE_MASK |
302 OXYGEN_SPDIF_SENSE_MASK | 302 OXYGEN_SPDIF_LOCK_PAR |
303 OXYGEN_SPDIF_LOCK_MASK | 303 OXYGEN_SPDIF_IN_CLOCK_96,
304 OXYGEN_SPDIF_RATE_MASK | 304 OXYGEN_SPDIF_SENSE_MASK |
305 OXYGEN_SPDIF_SENSE_PAR | 305 OXYGEN_SPDIF_LOCK_MASK |
306 OXYGEN_SPDIF_LOCK_PAR | 306 OXYGEN_SPDIF_RATE_MASK |
307 OXYGEN_SPDIF_IN_CLOCK_MASK); 307 OXYGEN_SPDIF_SENSE_PAR |
308 OXYGEN_SPDIF_LOCK_PAR |
309 OXYGEN_SPDIF_IN_CLOCK_MASK);
310 else
311 oxygen_clear_bits32(chip, OXYGEN_SPDIF_CONTROL,
312 OXYGEN_SPDIF_SENSE_MASK |
313 OXYGEN_SPDIF_LOCK_MASK |
314 OXYGEN_SPDIF_RATE_MASK);
308 oxygen_write32(chip, OXYGEN_SPDIF_OUTPUT_BITS, chip->spdif_bits); 315 oxygen_write32(chip, OXYGEN_SPDIF_OUTPUT_BITS, chip->spdif_bits);
309 oxygen_clear_bits8(chip, OXYGEN_MPU401_CONTROL, OXYGEN_MPU401_LOOPBACK); 316 oxygen_clear_bits8(chip, OXYGEN_MPU401_CONTROL, OXYGEN_MPU401_LOOPBACK);
310 oxygen_write8(chip, OXYGEN_GPI_INTERRUPT_MASK, 0); 317 oxygen_write8(chip, OXYGEN_GPI_INTERRUPT_MASK, 0);
@@ -327,9 +334,12 @@ static void oxygen_init(struct oxygen *chip)
327 (2 << OXYGEN_A_MONITOR_ROUTE_2_SHIFT) | 334 (2 << OXYGEN_A_MONITOR_ROUTE_2_SHIFT) |
328 (3 << OXYGEN_A_MONITOR_ROUTE_3_SHIFT)); 335 (3 << OXYGEN_A_MONITOR_ROUTE_3_SHIFT));
329 336
330 oxygen_write8(chip, OXYGEN_AC97_INTERRUPT_MASK, 337 if (chip->has_ac97_0 | chip->has_ac97_1)
331 OXYGEN_AC97_INT_READ_DONE | 338 oxygen_write8(chip, OXYGEN_AC97_INTERRUPT_MASK,
332 OXYGEN_AC97_INT_WRITE_DONE); 339 OXYGEN_AC97_INT_READ_DONE |
340 OXYGEN_AC97_INT_WRITE_DONE);
341 else
342 oxygen_write8(chip, OXYGEN_AC97_INTERRUPT_MASK, 0);
333 oxygen_write32(chip, OXYGEN_AC97_OUT_CONFIG, 0); 343 oxygen_write32(chip, OXYGEN_AC97_OUT_CONFIG, 0);
334 oxygen_write32(chip, OXYGEN_AC97_IN_CONFIG, 0); 344 oxygen_write32(chip, OXYGEN_AC97_IN_CONFIG, 0);
335 if (!(chip->has_ac97_0 | chip->has_ac97_1)) 345 if (!(chip->has_ac97_0 | chip->has_ac97_1))
@@ -495,7 +505,10 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
495 oxygen_proc_init(chip); 505 oxygen_proc_init(chip);
496 506
497 spin_lock_irq(&chip->reg_lock); 507 spin_lock_irq(&chip->reg_lock);
498 chip->interrupt_mask |= OXYGEN_INT_SPDIF_IN_DETECT | OXYGEN_INT_AC97; 508 if (chip->model->pcm_dev_cfg & CAPTURE_1_FROM_SPDIF)
509 chip->interrupt_mask |= OXYGEN_INT_SPDIF_IN_DETECT;
510 if (chip->has_ac97_0 | chip->has_ac97_1)
511 chip->interrupt_mask |= OXYGEN_INT_AC97;
499 oxygen_write16(chip, OXYGEN_INTERRUPT_MASK, chip->interrupt_mask); 512 oxygen_write16(chip, OXYGEN_INTERRUPT_MASK, chip->interrupt_mask);
500 spin_unlock_irq(&chip->reg_lock); 513 spin_unlock_irq(&chip->reg_lock);
501 514