diff options
Diffstat (limited to 'sound/pci/emu10k1/emuproc.c')
-rw-r--r-- | sound/pci/emu10k1/emuproc.c | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c index b939e03aaedf..2c1585991bc8 100644 --- a/sound/pci/emu10k1/emuproc.c +++ b/sound/pci/emu10k1/emuproc.c | |||
@@ -3,6 +3,9 @@ | |||
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 | * |
6 | * Copyright (c) by James Courtier-Dutton <James@superbug.co.uk> | ||
7 | * Added EMU 1010 support. | ||
8 | * | ||
6 | * BUGS: | 9 | * BUGS: |
7 | * -- | 10 | * -- |
8 | * | 11 | * |
@@ -255,7 +258,7 @@ static void snd_emu10k1_proc_rates_read(struct snd_info_entry *entry, | |||
255 | unsigned int val, tmp, n; | 258 | unsigned int val, tmp, n; |
256 | val = snd_emu10k1_ptr20_read(emu, CAPTURE_RATE_STATUS, 0); | 259 | val = snd_emu10k1_ptr20_read(emu, CAPTURE_RATE_STATUS, 0); |
257 | tmp = (val >> 16) & 0x8; | 260 | tmp = (val >> 16) & 0x8; |
258 | for (n=0;n<4;n++) { | 261 | for (n = 0; n < 4; n++) { |
259 | tmp = val >> (16 + (n*4)); | 262 | tmp = val >> (16 + (n*4)); |
260 | if (tmp & 0x8) snd_iprintf(buffer, "Channel %d: Rate=%d\n", n, samplerate[tmp & 0x7]); | 263 | if (tmp & 0x8) snd_iprintf(buffer, "Channel %d: Rate=%d\n", n, samplerate[tmp & 0x7]); |
261 | else snd_iprintf(buffer, "Channel %d: No input\n", n); | 264 | else snd_iprintf(buffer, "Channel %d: No input\n", n); |
@@ -372,6 +375,27 @@ static void snd_emu10k1_proc_voices_read(struct snd_info_entry *entry, | |||
372 | } | 375 | } |
373 | 376 | ||
374 | #ifdef CONFIG_SND_DEBUG | 377 | #ifdef CONFIG_SND_DEBUG |
378 | static void snd_emu_proc_emu1010_reg_read(struct snd_info_entry *entry, | ||
379 | struct snd_info_buffer *buffer) | ||
380 | { | ||
381 | struct snd_emu10k1 *emu = entry->private_data; | ||
382 | unsigned long value; | ||
383 | unsigned long flags; | ||
384 | unsigned long regs; | ||
385 | int i; | ||
386 | snd_iprintf(buffer, "EMU1010 Registers:\n\n"); | ||
387 | |||
388 | for(i = 0; i < 0x30; i+=1) { | ||
389 | spin_lock_irqsave(&emu->emu_lock, flags); | ||
390 | regs=i+0x40; /* 0x40 upwards are registers. */ | ||
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); | ||
395 | snd_iprintf(buffer, "%02X: %08lX, %02lX\n", i, value, (value >> 8) & 0x7f); | ||
396 | } | ||
397 | } | ||
398 | |||
375 | static void snd_emu_proc_io_reg_read(struct snd_info_entry *entry, | 399 | static void snd_emu_proc_io_reg_read(struct snd_info_entry *entry, |
376 | struct snd_info_buffer *buffer) | 400 | struct snd_info_buffer *buffer) |
377 | { | 401 | { |
@@ -398,7 +422,7 @@ static void snd_emu_proc_io_reg_write(struct snd_info_entry *entry, | |||
398 | while (!snd_info_get_line(buffer, line, sizeof(line))) { | 422 | while (!snd_info_get_line(buffer, line, sizeof(line))) { |
399 | if (sscanf(line, "%x %x", ®, &val) != 2) | 423 | if (sscanf(line, "%x %x", ®, &val) != 2) |
400 | continue; | 424 | continue; |
401 | if ((reg < 0x40) && (reg >=0) && (val <= 0xffffffff) ) { | 425 | if ((reg < 0x40) && (reg >= 0) && (val <= 0xffffffff) ) { |
402 | spin_lock_irqsave(&emu->emu_lock, flags); | 426 | spin_lock_irqsave(&emu->emu_lock, flags); |
403 | outl(val, emu->port + (reg & 0xfffffffc)); | 427 | outl(val, emu->port + (reg & 0xfffffffc)); |
404 | spin_unlock_irqrestore(&emu->emu_lock, flags); | 428 | spin_unlock_irqrestore(&emu->emu_lock, flags); |
@@ -474,7 +498,7 @@ static void snd_emu_proc_ptr_reg_write(struct snd_info_entry *entry, | |||
474 | while (!snd_info_get_line(buffer, line, sizeof(line))) { | 498 | while (!snd_info_get_line(buffer, line, sizeof(line))) { |
475 | if (sscanf(line, "%x %x %x", ®, &channel_id, &val) != 3) | 499 | if (sscanf(line, "%x %x %x", ®, &channel_id, &val) != 3) |
476 | continue; | 500 | continue; |
477 | if ((reg < 0xa0) && (reg >=0) && (val <= 0xffffffff) && (channel_id >=0) && (channel_id <= 3) ) | 501 | if ((reg < 0xa0) && (reg >= 0) && (val <= 0xffffffff) && (channel_id >= 0) && (channel_id <= 3) ) |
478 | snd_ptr_write(emu, iobase, reg, channel_id, val); | 502 | snd_ptr_write(emu, iobase, reg, channel_id, val); |
479 | } | 503 | } |
480 | } | 504 | } |
@@ -531,6 +555,10 @@ int __devinit snd_emu10k1_proc_init(struct snd_emu10k1 * emu) | |||
531 | { | 555 | { |
532 | struct snd_info_entry *entry; | 556 | struct snd_info_entry *entry; |
533 | #ifdef CONFIG_SND_DEBUG | 557 | #ifdef CONFIG_SND_DEBUG |
558 | if ((emu->card_capabilities->emu1010) && | ||
559 | snd_card_proc_new(emu->card, "emu1010_regs", &entry)) { | ||
560 | snd_info_set_text_ops(entry, emu, snd_emu_proc_emu1010_reg_read); | ||
561 | } | ||
534 | if (! snd_card_proc_new(emu->card, "io_regs", &entry)) { | 562 | if (! snd_card_proc_new(emu->card, "io_regs", &entry)) { |
535 | snd_info_set_text_ops(entry, emu, snd_emu_proc_io_reg_read); | 563 | snd_info_set_text_ops(entry, emu, snd_emu_proc_io_reg_read); |
536 | entry->c.text.write = snd_emu_proc_io_reg_write; | 564 | entry->c.text.write = snd_emu_proc_io_reg_write; |