diff options
Diffstat (limited to 'sound/pci/emu10k1/emuproc.c')
-rw-r--r-- | sound/pci/emu10k1/emuproc.c | 58 |
1 files changed, 44 insertions, 14 deletions
diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c index 2c1585991bc8..c3fb10e81c9e 100644 --- a/sound/pci/emu10k1/emuproc.c +++ b/sound/pci/emu10k1/emuproc.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) by Jaroslav Kysela <perex@suse.cz> | 2 | * Copyright (c) by Jaroslav Kysela <perex@perex.cz> |
3 | * Creative Labs, Inc. | 3 | * Creative Labs, Inc. |
4 | * Routines for control of EMU10K1 chips / proc interface routines | 4 | * Routines for control of EMU10K1 chips / proc interface routines |
5 | * | 5 | * |
@@ -240,8 +240,42 @@ static void snd_emu10k1_proc_spdif_read(struct snd_info_entry *entry, | |||
240 | struct snd_info_buffer *buffer) | 240 | struct snd_info_buffer *buffer) |
241 | { | 241 | { |
242 | struct snd_emu10k1 *emu = entry->private_data; | 242 | struct snd_emu10k1 *emu = entry->private_data; |
243 | snd_emu10k1_proc_spdif_status(emu, buffer, "CD-ROM S/PDIF In", CDCS, CDSRCS); | 243 | u32 value; |
244 | snd_emu10k1_proc_spdif_status(emu, buffer, "Optical or Coax S/PDIF In", GPSCS, GPSRCS); | 244 | u32 value2; |
245 | unsigned long flags; | ||
246 | u32 rate; | ||
247 | |||
248 | if (emu->card_capabilities->emu1010) { | ||
249 | spin_lock_irqsave(&emu->emu_lock, flags); | ||
250 | snd_emu1010_fpga_read(emu, 0x38, &value); | ||
251 | spin_unlock_irqrestore(&emu->emu_lock, flags); | ||
252 | if ((value & 0x1) == 0) { | ||
253 | spin_lock_irqsave(&emu->emu_lock, flags); | ||
254 | snd_emu1010_fpga_read(emu, 0x2a, &value); | ||
255 | snd_emu1010_fpga_read(emu, 0x2b, &value2); | ||
256 | spin_unlock_irqrestore(&emu->emu_lock, flags); | ||
257 | rate = 0x1770000 / (((value << 5) | value2)+1); | ||
258 | snd_iprintf(buffer, "ADAT Locked : %u\n", rate); | ||
259 | } else { | ||
260 | snd_iprintf(buffer, "ADAT Unlocked\n"); | ||
261 | } | ||
262 | spin_lock_irqsave(&emu->emu_lock, flags); | ||
263 | snd_emu1010_fpga_read(emu, 0x20, &value); | ||
264 | spin_unlock_irqrestore(&emu->emu_lock, flags); | ||
265 | if ((value & 0x4) == 0) { | ||
266 | spin_lock_irqsave(&emu->emu_lock, flags); | ||
267 | snd_emu1010_fpga_read(emu, 0x28, &value); | ||
268 | snd_emu1010_fpga_read(emu, 0x29, &value2); | ||
269 | spin_unlock_irqrestore(&emu->emu_lock, flags); | ||
270 | rate = 0x1770000 / (((value << 5) | value2)+1); | ||
271 | snd_iprintf(buffer, "SPDIF Locked : %d\n", rate); | ||
272 | } else { | ||
273 | snd_iprintf(buffer, "SPDIF Unlocked\n"); | ||
274 | } | ||
275 | } else { | ||
276 | snd_emu10k1_proc_spdif_status(emu, buffer, "CD-ROM S/PDIF In", CDCS, CDSRCS); | ||
277 | snd_emu10k1_proc_spdif_status(emu, buffer, "Optical or Coax S/PDIF In", GPSCS, GPSRCS); | ||
278 | } | ||
245 | #if 0 | 279 | #if 0 |
246 | val = snd_emu10k1_ptr_read(emu, ZVSRCS, 0); | 280 | val = snd_emu10k1_ptr_read(emu, ZVSRCS, 0); |
247 | snd_iprintf(buffer, "\nZoomed Video\n"); | 281 | snd_iprintf(buffer, "\nZoomed Video\n"); |
@@ -379,20 +413,16 @@ static void snd_emu_proc_emu1010_reg_read(struct snd_info_entry *entry, | |||
379 | struct snd_info_buffer *buffer) | 413 | struct snd_info_buffer *buffer) |
380 | { | 414 | { |
381 | struct snd_emu10k1 *emu = entry->private_data; | 415 | struct snd_emu10k1 *emu = entry->private_data; |
382 | unsigned long value; | 416 | int value; |
383 | unsigned long flags; | 417 | unsigned long flags; |
384 | unsigned long regs; | ||
385 | int i; | 418 | int i; |
386 | snd_iprintf(buffer, "EMU1010 Registers:\n\n"); | 419 | snd_iprintf(buffer, "EMU1010 Registers:\n\n"); |
387 | 420 | ||
388 | for(i = 0; i < 0x30; i+=1) { | 421 | for(i = 0; i < 0x40; i+=1) { |
389 | spin_lock_irqsave(&emu->emu_lock, flags); | 422 | spin_lock_irqsave(&emu->emu_lock, flags); |
390 | regs=i+0x40; /* 0x40 upwards are registers. */ | 423 | snd_emu1010_fpga_read(emu, i, &value); |
391 | outl(regs, emu->port + A_IOCFG); | ||
392 | outl(regs | 0x80, emu->port + A_IOCFG); /* High bit clocks the value into the fpga. */ | ||
393 | value = inl(emu->port + A_IOCFG); | ||
394 | spin_unlock_irqrestore(&emu->emu_lock, flags); | 424 | spin_unlock_irqrestore(&emu->emu_lock, flags); |
395 | snd_iprintf(buffer, "%02X: %08lX, %02lX\n", i, value, (value >> 8) & 0x7f); | 425 | snd_iprintf(buffer, "%02X: %08X, %02X\n", i, value, (value >> 8) & 0x7f); |
396 | } | 426 | } |
397 | } | 427 | } |
398 | 428 | ||
@@ -555,9 +585,9 @@ int __devinit snd_emu10k1_proc_init(struct snd_emu10k1 * emu) | |||
555 | { | 585 | { |
556 | struct snd_info_entry *entry; | 586 | struct snd_info_entry *entry; |
557 | #ifdef CONFIG_SND_DEBUG | 587 | #ifdef CONFIG_SND_DEBUG |
558 | if ((emu->card_capabilities->emu1010) && | 588 | if (emu->card_capabilities->emu1010) { |
559 | snd_card_proc_new(emu->card, "emu1010_regs", &entry)) { | 589 | if (! snd_card_proc_new(emu->card, "emu1010_regs", &entry)) |
560 | snd_info_set_text_ops(entry, emu, snd_emu_proc_emu1010_reg_read); | 590 | snd_info_set_text_ops(entry, emu, snd_emu_proc_emu1010_reg_read); |
561 | } | 591 | } |
562 | if (! snd_card_proc_new(emu->card, "io_regs", &entry)) { | 592 | if (! snd_card_proc_new(emu->card, "io_regs", &entry)) { |
563 | snd_info_set_text_ops(entry, emu, snd_emu_proc_io_reg_read); | 593 | snd_info_set_text_ops(entry, emu, snd_emu_proc_io_reg_read); |