diff options
author | James Courtier-Dutton <James@superbug.co.uk> | 2007-07-26 13:31:39 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2007-10-16 09:58:03 -0400 |
commit | f93abe51e8dc7e929d29e6a9a1991bf7fd234d4a (patch) | |
tree | e23ba606e72d14b59297a8d2937d1b76f34e5e2a /sound/pci/emu10k1/emuproc.c | |
parent | 95a5b0850a96c155f6b8dac03f45c19bc482ced7 (diff) |
[ALSA] snd-emu10k1:Implement SPDIF/ADAT status.
Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/emu10k1/emuproc.c')
-rw-r--r-- | sound/pci/emu10k1/emuproc.c | 48 |
1 files changed, 39 insertions, 9 deletions
diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c index a0dae0d916cb..3e2ed1d9d5fe 100644 --- a/sound/pci/emu10k1/emuproc.c +++ b/sound/pci/emu10k1/emuproc.c | |||
@@ -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 < 0x40; 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 | ||