aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/emu10k1/emuproc.c
diff options
context:
space:
mode:
authorJames Courtier-Dutton <James@superbug.co.uk>2005-04-09 10:57:09 -0400
committerJaroslav Kysela <perex@suse.cz>2005-05-29 03:58:46 -0400
commitdf34140a9c15d4be8833f7977dca277a03ab87b0 (patch)
tree79a13a1c51d96fc36b77237b49646f7a4dfcb298 /sound/pci/emu10k1/emuproc.c
parentf953eff29c1ea4c744afe3d50ff5ca33b44efcd2 (diff)
[ALSA] Display SPDIF in status in proc fs 'spdif-in' file.
EMU10K1/EMU10K2 driver Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Diffstat (limited to 'sound/pci/emu10k1/emuproc.c')
-rw-r--r--sound/pci/emu10k1/emuproc.c61
1 files changed, 38 insertions, 23 deletions
diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c
index 732d17d1307f..187a4e60a5fe 100644
--- a/sound/pci/emu10k1/emuproc.c
+++ b/sound/pci/emu10k1/emuproc.c
@@ -44,28 +44,33 @@ static void snd_emu10k1_proc_spdif_status(emu10k1_t * emu,
44 unsigned int status, rate = 0; 44 unsigned int status, rate = 0;
45 45
46 status = snd_emu10k1_ptr_read(emu, status_reg, 0); 46 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 47
50 snd_iprintf(buffer, "\n%s\n", title); 48 snd_iprintf(buffer, "\n%s\n", title);
51 49
52 snd_iprintf(buffer, "Professional Mode : %s\n", (status & SPCS_PROFESSIONAL) ? "yes" : "no"); 50 if (status != 0xffffffff) {
53 snd_iprintf(buffer, "Not Audio Data : %s\n", (status & SPCS_NOTAUDIODATA) ? "yes" : "no"); 51 snd_iprintf(buffer, "Professional Mode : %s\n", (status & SPCS_PROFESSIONAL) ? "yes" : "no");
54 snd_iprintf(buffer, "Copyright : %s\n", (status & SPCS_COPYRIGHT) ? "yes" : "no"); 52 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]); 53 snd_iprintf(buffer, "Copyright : %s\n", (status & SPCS_COPYRIGHT) ? "yes" : "no");
56 snd_iprintf(buffer, "Mode : %i\n", (status & SPCS_MODEMASK) >> 6); 54 snd_iprintf(buffer, "Emphasis : %s\n", emphasis[(status & SPCS_EMPHASISMASK) >> 3]);
57 snd_iprintf(buffer, "Category Code : 0x%x\n", (status & SPCS_CATEGORYCODEMASK) >> 8); 55 snd_iprintf(buffer, "Mode : %i\n", (status & SPCS_MODEMASK) >> 6);
58 snd_iprintf(buffer, "Generation Status : %s\n", status & SPCS_GENERATIONSTATUS ? "original" : "copy"); 56 snd_iprintf(buffer, "Category Code : 0x%x\n", (status & SPCS_CATEGORYCODEMASK) >> 8);
59 snd_iprintf(buffer, "Source Mask : %i\n", (status & SPCS_SOURCENUMMASK) >> 16); 57 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]); 58 snd_iprintf(buffer, "Source Mask : %i\n", (status & SPCS_SOURCENUMMASK) >> 16);
61 snd_iprintf(buffer, "Sample Rate : %iHz\n", samplerate[(status & SPCS_SAMPLERATEMASK) >> 24]); 59 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]); 60 snd_iprintf(buffer, "Sample Rate : %iHz\n", samplerate[(status & SPCS_SAMPLERATEMASK) >> 24]);
63 61 snd_iprintf(buffer, "Clock Accuracy : %s\n", clkaccy[(status & SPCS_CLKACCYMASK) >> 28]);
64 if (rate_reg > 0) { 62
65 snd_iprintf(buffer, "S/PDIF Locked : %s\n", rate & SRCS_SPDIFLOCKED ? "on" : "off"); 63 if (rate_reg > 0) {
66 snd_iprintf(buffer, "Rate Locked : %s\n", rate & SRCS_RATELOCKED ? "on" : "off"); 64 rate = snd_emu10k1_ptr_read(emu, rate_reg, 0);
67 snd_iprintf(buffer, "Estimated Sample Rate : 0x%x\n", rate & SRCS_ESTSAMPLERATE); 65 snd_iprintf(buffer, "S/PDIF Locked : %s\n", rate & SRCS_SPDIFLOCKED ? "on" : "off");
66 snd_iprintf(buffer, "Rate Locked : %s\n", rate & SRCS_RATELOCKED ? "on" : "off");
67 /* From ((Rate * 48000 ) / 262144); */
68 snd_iprintf(buffer, "Estimated Sample Rate : %d\n", ((rate & 0xFFFFF ) * 375) >> 11);
69 }
70 } else {
71 snd_iprintf(buffer, "No signal detected.\n");
68 } 72 }
73
69} 74}
70 75
71static void snd_emu10k1_proc_read(snd_info_entry_t *entry, 76static void snd_emu10k1_proc_read(snd_info_entry_t *entry,
@@ -223,15 +228,20 @@ static void snd_emu10k1_proc_read(snd_info_entry_t *entry,
223 snd_iprintf(buffer, "\nAll FX Outputs :\n"); 228 snd_iprintf(buffer, "\nAll FX Outputs :\n");
224 for (idx = 0; idx < (emu->audigy ? 64 : 32); idx++) 229 for (idx = 0; idx < (emu->audigy ? 64 : 32); idx++)
225 snd_iprintf(buffer, " Output %02i [%s]\n", idx, outputs[idx]); 230 snd_iprintf(buffer, " Output %02i [%s]\n", idx, outputs[idx]);
226 snd_emu10k1_proc_spdif_status(emu, buffer, "S/PDIF Output 0", SPCS0, -1); 231}
227 snd_emu10k1_proc_spdif_status(emu, buffer, "S/PDIF Output 1", SPCS1, -1); 232
228 snd_emu10k1_proc_spdif_status(emu, buffer, "S/PDIF Output 2/3", SPCS2, -1); 233static 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); 234 snd_info_buffer_t * buffer)
230 snd_emu10k1_proc_spdif_status(emu, buffer, "General purpose S/PDIF", GPSCS, GPSRCS); 235{
236 emu10k1_t *emu = entry->private_data;
237 snd_emu10k1_proc_spdif_status(emu, buffer, "CD-ROM S/PDIF In", CDCS, CDSRCS);
238 snd_emu10k1_proc_spdif_status(emu, buffer, "Optical or Coax S/PDIF In", GPSCS, GPSRCS);
239#if 0
231 val = snd_emu10k1_ptr_read(emu, ZVSRCS, 0); 240 val = snd_emu10k1_ptr_read(emu, ZVSRCS, 0);
232 snd_iprintf(buffer, "\nZoomed Video\n"); 241 snd_iprintf(buffer, "\nZoomed Video\n");
233 snd_iprintf(buffer, "Rate Locked : %s\n", val & SRCS_RATELOCKED ? "on" : "off"); 242 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); 243 snd_iprintf(buffer, "Estimated Sample Rate : 0x%x\n", val & SRCS_ESTSAMPLERATE);
244#endif
235} 245}
236 246
237static void snd_emu10k1_proc_acode_read(snd_info_entry_t *entry, 247static void snd_emu10k1_proc_acode_read(snd_info_entry_t *entry,
@@ -526,6 +536,11 @@ int __devinit snd_emu10k1_proc_init(emu10k1_t * emu)
526 if (! snd_card_proc_new(emu->card, "emu10k1", &entry)) 536 if (! snd_card_proc_new(emu->card, "emu10k1", &entry))
527 snd_info_set_text_ops(entry, emu, 2048, snd_emu10k1_proc_read); 537 snd_info_set_text_ops(entry, emu, 2048, snd_emu10k1_proc_read);
528 538
539 if (emu->card_capabilities->emu10k2_chip) {
540 if (! snd_card_proc_new(emu->card, "spdif-in", &entry))
541 snd_info_set_text_ops(entry, emu, 2048, snd_emu10k1_proc_spdif_read);
542 }
543
529 if (! snd_card_proc_new(emu->card, "voices", &entry)) 544 if (! snd_card_proc_new(emu->card, "voices", &entry))
530 snd_info_set_text_ops(entry, emu, 2048, snd_emu10k1_proc_voices_read); 545 snd_info_set_text_ops(entry, emu, 2048, snd_emu10k1_proc_voices_read);
531 546