diff options
Diffstat (limited to 'sound/pci/emu10k1/emuproc.c')
-rw-r--r-- | sound/pci/emu10k1/emuproc.c | 89 |
1 files changed, 65 insertions, 24 deletions
diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c index d990d5eb45a8..cc22707c91fa 100644 --- a/sound/pci/emu10k1/emuproc.c +++ b/sound/pci/emu10k1/emuproc.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/init.h> | 30 | #include <linux/init.h> |
31 | #include <sound/core.h> | 31 | #include <sound/core.h> |
32 | #include <sound/emu10k1.h> | 32 | #include <sound/emu10k1.h> |
33 | #include "p16v.h" | ||
33 | 34 | ||
34 | static void snd_emu10k1_proc_spdif_status(emu10k1_t * emu, | 35 | static void snd_emu10k1_proc_spdif_status(emu10k1_t * emu, |
35 | snd_info_buffer_t * buffer, | 36 | snd_info_buffer_t * buffer, |
@@ -44,28 +45,34 @@ static void snd_emu10k1_proc_spdif_status(emu10k1_t * emu, | |||
44 | unsigned int status, rate = 0; | 45 | unsigned int status, rate = 0; |
45 | 46 | ||
46 | status = snd_emu10k1_ptr_read(emu, status_reg, 0); | 47 | status = snd_emu10k1_ptr_read(emu, status_reg, 0); |
47 | if (rate_reg > 0) | ||
48 | rate = snd_emu10k1_ptr_read(emu, rate_reg, 0); | ||
49 | 48 | ||
50 | snd_iprintf(buffer, "\n%s\n", title); | 49 | snd_iprintf(buffer, "\n%s\n", title); |
51 | 50 | ||
52 | snd_iprintf(buffer, "Professional Mode : %s\n", (status & SPCS_PROFESSIONAL) ? "yes" : "no"); | 51 | if (status != 0xffffffff) { |
53 | snd_iprintf(buffer, "Not Audio Data : %s\n", (status & SPCS_NOTAUDIODATA) ? "yes" : "no"); | 52 | snd_iprintf(buffer, "Professional Mode : %s\n", (status & SPCS_PROFESSIONAL) ? "yes" : "no"); |
54 | snd_iprintf(buffer, "Copyright : %s\n", (status & SPCS_COPYRIGHT) ? "yes" : "no"); | 53 | snd_iprintf(buffer, "Not Audio Data : %s\n", (status & SPCS_NOTAUDIODATA) ? "yes" : "no"); |
55 | snd_iprintf(buffer, "Emphasis : %s\n", emphasis[(status & SPCS_EMPHASISMASK) >> 3]); | 54 | snd_iprintf(buffer, "Copyright : %s\n", (status & SPCS_COPYRIGHT) ? "yes" : "no"); |
56 | snd_iprintf(buffer, "Mode : %i\n", (status & SPCS_MODEMASK) >> 6); | 55 | snd_iprintf(buffer, "Emphasis : %s\n", emphasis[(status & SPCS_EMPHASISMASK) >> 3]); |
57 | snd_iprintf(buffer, "Category Code : 0x%x\n", (status & SPCS_CATEGORYCODEMASK) >> 8); | 56 | snd_iprintf(buffer, "Mode : %i\n", (status & SPCS_MODEMASK) >> 6); |
58 | snd_iprintf(buffer, "Generation Status : %s\n", status & SPCS_GENERATIONSTATUS ? "original" : "copy"); | 57 | snd_iprintf(buffer, "Category Code : 0x%x\n", (status & SPCS_CATEGORYCODEMASK) >> 8); |
59 | snd_iprintf(buffer, "Source Mask : %i\n", (status & SPCS_SOURCENUMMASK) >> 16); | 58 | snd_iprintf(buffer, "Generation Status : %s\n", status & SPCS_GENERATIONSTATUS ? "original" : "copy"); |
60 | snd_iprintf(buffer, "Channel Number : %s\n", channel[(status & SPCS_CHANNELNUMMASK) >> 20]); | 59 | snd_iprintf(buffer, "Source Mask : %i\n", (status & SPCS_SOURCENUMMASK) >> 16); |
61 | snd_iprintf(buffer, "Sample Rate : %iHz\n", samplerate[(status & SPCS_SAMPLERATEMASK) >> 24]); | 60 | snd_iprintf(buffer, "Channel Number : %s\n", channel[(status & SPCS_CHANNELNUMMASK) >> 20]); |
62 | snd_iprintf(buffer, "Clock Accuracy : %s\n", clkaccy[(status & SPCS_CLKACCYMASK) >> 28]); | 61 | snd_iprintf(buffer, "Sample Rate : %iHz\n", samplerate[(status & SPCS_SAMPLERATEMASK) >> 24]); |
63 | 62 | snd_iprintf(buffer, "Clock Accuracy : %s\n", clkaccy[(status & SPCS_CLKACCYMASK) >> 28]); | |
64 | if (rate_reg > 0) { | 63 | |
65 | snd_iprintf(buffer, "S/PDIF Locked : %s\n", rate & SRCS_SPDIFLOCKED ? "on" : "off"); | 64 | if (rate_reg > 0) { |
66 | snd_iprintf(buffer, "Rate Locked : %s\n", rate & SRCS_RATELOCKED ? "on" : "off"); | 65 | rate = snd_emu10k1_ptr_read(emu, rate_reg, 0); |
67 | snd_iprintf(buffer, "Estimated Sample Rate : 0x%x\n", rate & SRCS_ESTSAMPLERATE); | 66 | snd_iprintf(buffer, "S/PDIF Valid : %s\n", rate & SRCS_SPDIFVALID ? "on" : "off"); |
67 | snd_iprintf(buffer, "S/PDIF Locked : %s\n", rate & SRCS_SPDIFLOCKED ? "on" : "off"); | ||
68 | snd_iprintf(buffer, "Rate Locked : %s\n", rate & SRCS_RATELOCKED ? "on" : "off"); | ||
69 | /* From ((Rate * 48000 ) / 262144); */ | ||
70 | snd_iprintf(buffer, "Estimated Sample Rate : %d\n", ((rate & 0xFFFFF ) * 375) >> 11); | ||
71 | } | ||
72 | } else { | ||
73 | snd_iprintf(buffer, "No signal detected.\n"); | ||
68 | } | 74 | } |
75 | |||
69 | } | 76 | } |
70 | 77 | ||
71 | static void snd_emu10k1_proc_read(snd_info_entry_t *entry, | 78 | static void snd_emu10k1_proc_read(snd_info_entry_t *entry, |
@@ -182,7 +189,7 @@ static void snd_emu10k1_proc_read(snd_info_entry_t *entry, | |||
182 | 189 | ||
183 | snd_iprintf(buffer, "EMU10K1\n\n"); | 190 | snd_iprintf(buffer, "EMU10K1\n\n"); |
184 | snd_iprintf(buffer, "Card : %s\n", | 191 | snd_iprintf(buffer, "Card : %s\n", |
185 | emu->audigy ? "Audigy" : (emu->APS ? "EMU APS" : "Creative")); | 192 | emu->audigy ? "Audigy" : (emu->card_capabilities->ecard ? "EMU APS" : "Creative")); |
186 | snd_iprintf(buffer, "Internal TRAM (words) : 0x%x\n", emu->fx8010.itram_size); | 193 | snd_iprintf(buffer, "Internal TRAM (words) : 0x%x\n", emu->fx8010.itram_size); |
187 | snd_iprintf(buffer, "External TRAM (words) : 0x%x\n", (int)emu->fx8010.etram_pages.bytes / 2); | 194 | snd_iprintf(buffer, "External TRAM (words) : 0x%x\n", (int)emu->fx8010.etram_pages.bytes / 2); |
188 | snd_iprintf(buffer, "\n"); | 195 | snd_iprintf(buffer, "\n"); |
@@ -223,15 +230,35 @@ static void snd_emu10k1_proc_read(snd_info_entry_t *entry, | |||
223 | snd_iprintf(buffer, "\nAll FX Outputs :\n"); | 230 | snd_iprintf(buffer, "\nAll FX Outputs :\n"); |
224 | for (idx = 0; idx < (emu->audigy ? 64 : 32); idx++) | 231 | for (idx = 0; idx < (emu->audigy ? 64 : 32); idx++) |
225 | snd_iprintf(buffer, " Output %02i [%s]\n", idx, outputs[idx]); | 232 | snd_iprintf(buffer, " Output %02i [%s]\n", idx, outputs[idx]); |
226 | snd_emu10k1_proc_spdif_status(emu, buffer, "S/PDIF Output 0", SPCS0, -1); | 233 | } |
227 | snd_emu10k1_proc_spdif_status(emu, buffer, "S/PDIF Output 1", SPCS1, -1); | 234 | |
228 | snd_emu10k1_proc_spdif_status(emu, buffer, "S/PDIF Output 2/3", SPCS2, -1); | 235 | static void snd_emu10k1_proc_spdif_read(snd_info_entry_t *entry, |
229 | snd_emu10k1_proc_spdif_status(emu, buffer, "CD-ROM S/PDIF", CDCS, CDSRCS); | 236 | snd_info_buffer_t * buffer) |
230 | snd_emu10k1_proc_spdif_status(emu, buffer, "General purpose S/PDIF", GPSCS, GPSRCS); | 237 | { |
238 | emu10k1_t *emu = entry->private_data; | ||
239 | snd_emu10k1_proc_spdif_status(emu, buffer, "CD-ROM S/PDIF In", CDCS, CDSRCS); | ||
240 | snd_emu10k1_proc_spdif_status(emu, buffer, "Optical or Coax S/PDIF In", GPSCS, GPSRCS); | ||
241 | #if 0 | ||
231 | val = snd_emu10k1_ptr_read(emu, ZVSRCS, 0); | 242 | val = snd_emu10k1_ptr_read(emu, ZVSRCS, 0); |
232 | snd_iprintf(buffer, "\nZoomed Video\n"); | 243 | snd_iprintf(buffer, "\nZoomed Video\n"); |
233 | snd_iprintf(buffer, "Rate Locked : %s\n", val & SRCS_RATELOCKED ? "on" : "off"); | 244 | snd_iprintf(buffer, "Rate Locked : %s\n", val & SRCS_RATELOCKED ? "on" : "off"); |
234 | snd_iprintf(buffer, "Estimated Sample Rate : 0x%x\n", val & SRCS_ESTSAMPLERATE); | 245 | snd_iprintf(buffer, "Estimated Sample Rate : 0x%x\n", val & SRCS_ESTSAMPLERATE); |
246 | #endif | ||
247 | } | ||
248 | |||
249 | static void snd_emu10k1_proc_rates_read(snd_info_entry_t *entry, | ||
250 | snd_info_buffer_t * buffer) | ||
251 | { | ||
252 | static int samplerate[8] = { 44100, 48000, 96000, 192000, 4, 5, 6, 7 }; | ||
253 | emu10k1_t *emu = entry->private_data; | ||
254 | unsigned int val, tmp, n; | ||
255 | val = snd_emu10k1_ptr20_read(emu, CAPTURE_RATE_STATUS, 0); | ||
256 | tmp = (val >> 16) & 0x8; | ||
257 | for (n=0;n<4;n++) { | ||
258 | tmp = val >> (16 + (n*4)); | ||
259 | if (tmp & 0x8) snd_iprintf(buffer, "Channel %d: Rate=%d\n", n, samplerate[tmp & 0x7]); | ||
260 | else snd_iprintf(buffer, "Channel %d: No input\n", n); | ||
261 | } | ||
235 | } | 262 | } |
236 | 263 | ||
237 | static void snd_emu10k1_proc_acode_read(snd_info_entry_t *entry, | 264 | static void snd_emu10k1_proc_acode_read(snd_info_entry_t *entry, |
@@ -500,32 +527,46 @@ int __devinit snd_emu10k1_proc_init(emu10k1_t * emu) | |||
500 | snd_info_set_text_ops(entry, emu, 1024, snd_emu_proc_io_reg_read); | 527 | snd_info_set_text_ops(entry, emu, 1024, snd_emu_proc_io_reg_read); |
501 | entry->c.text.write_size = 64; | 528 | entry->c.text.write_size = 64; |
502 | entry->c.text.write = snd_emu_proc_io_reg_write; | 529 | entry->c.text.write = snd_emu_proc_io_reg_write; |
530 | entry->mode |= S_IWUSR; | ||
503 | } | 531 | } |
504 | if (! snd_card_proc_new(emu->card, "ptr_regs00a", &entry)) { | 532 | if (! snd_card_proc_new(emu->card, "ptr_regs00a", &entry)) { |
505 | snd_info_set_text_ops(entry, emu, 65536, snd_emu_proc_ptr_reg_read00a); | 533 | snd_info_set_text_ops(entry, emu, 65536, snd_emu_proc_ptr_reg_read00a); |
506 | entry->c.text.write_size = 64; | 534 | entry->c.text.write_size = 64; |
507 | entry->c.text.write = snd_emu_proc_ptr_reg_write00; | 535 | entry->c.text.write = snd_emu_proc_ptr_reg_write00; |
536 | entry->mode |= S_IWUSR; | ||
508 | } | 537 | } |
509 | if (! snd_card_proc_new(emu->card, "ptr_regs00b", &entry)) { | 538 | if (! snd_card_proc_new(emu->card, "ptr_regs00b", &entry)) { |
510 | snd_info_set_text_ops(entry, emu, 65536, snd_emu_proc_ptr_reg_read00b); | 539 | snd_info_set_text_ops(entry, emu, 65536, snd_emu_proc_ptr_reg_read00b); |
511 | entry->c.text.write_size = 64; | 540 | entry->c.text.write_size = 64; |
512 | entry->c.text.write = snd_emu_proc_ptr_reg_write00; | 541 | entry->c.text.write = snd_emu_proc_ptr_reg_write00; |
542 | entry->mode |= S_IWUSR; | ||
513 | } | 543 | } |
514 | if (! snd_card_proc_new(emu->card, "ptr_regs20a", &entry)) { | 544 | if (! snd_card_proc_new(emu->card, "ptr_regs20a", &entry)) { |
515 | snd_info_set_text_ops(entry, emu, 65536, snd_emu_proc_ptr_reg_read20a); | 545 | snd_info_set_text_ops(entry, emu, 65536, snd_emu_proc_ptr_reg_read20a); |
516 | entry->c.text.write_size = 64; | 546 | entry->c.text.write_size = 64; |
517 | entry->c.text.write = snd_emu_proc_ptr_reg_write20; | 547 | entry->c.text.write = snd_emu_proc_ptr_reg_write20; |
548 | entry->mode |= S_IWUSR; | ||
518 | } | 549 | } |
519 | if (! snd_card_proc_new(emu->card, "ptr_regs20b", &entry)) { | 550 | if (! snd_card_proc_new(emu->card, "ptr_regs20b", &entry)) { |
520 | snd_info_set_text_ops(entry, emu, 65536, snd_emu_proc_ptr_reg_read20b); | 551 | snd_info_set_text_ops(entry, emu, 65536, snd_emu_proc_ptr_reg_read20b); |
521 | entry->c.text.write_size = 64; | 552 | entry->c.text.write_size = 64; |
522 | entry->c.text.write = snd_emu_proc_ptr_reg_write20; | 553 | entry->c.text.write = snd_emu_proc_ptr_reg_write20; |
554 | entry->mode |= S_IWUSR; | ||
523 | } | 555 | } |
524 | #endif | 556 | #endif |
525 | 557 | ||
526 | if (! snd_card_proc_new(emu->card, "emu10k1", &entry)) | 558 | if (! snd_card_proc_new(emu->card, "emu10k1", &entry)) |
527 | snd_info_set_text_ops(entry, emu, 2048, snd_emu10k1_proc_read); | 559 | snd_info_set_text_ops(entry, emu, 2048, snd_emu10k1_proc_read); |
528 | 560 | ||
561 | if (emu->card_capabilities->emu10k2_chip) { | ||
562 | if (! snd_card_proc_new(emu->card, "spdif-in", &entry)) | ||
563 | snd_info_set_text_ops(entry, emu, 2048, snd_emu10k1_proc_spdif_read); | ||
564 | } | ||
565 | if (emu->card_capabilities->ca0151_chip) { | ||
566 | if (! snd_card_proc_new(emu->card, "capture-rates", &entry)) | ||
567 | snd_info_set_text_ops(entry, emu, 2048, snd_emu10k1_proc_rates_read); | ||
568 | } | ||
569 | |||
529 | if (! snd_card_proc_new(emu->card, "voices", &entry)) | 570 | if (! snd_card_proc_new(emu->card, "voices", &entry)) |
530 | snd_info_set_text_ops(entry, emu, 2048, snd_emu10k1_proc_voices_read); | 571 | snd_info_set_text_ops(entry, emu, 2048, snd_emu10k1_proc_voices_read); |
531 | 572 | ||