vserver 2.0 rc7
[linux-2.6.git] / sound / pci / emu10k1 / emuproc.c
1 /*
2  *  Copyright (c) by Jaroslav Kysela <perex@suse.cz>
3  *                   Creative Labs, Inc.
4  *  Routines for control of EMU10K1 chips / proc interface routines
5  *
6  *  BUGS:
7  *    --
8  *
9  *  TODO:
10  *    --
11  *
12  *   This program is free software; you can redistribute it and/or modify
13  *   it under the terms of the GNU General Public License as published by
14  *   the Free Software Foundation; either version 2 of the License, or
15  *   (at your option) any later version.
16  *
17  *   This program is distributed in the hope that it will be useful,
18  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
19  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  *   GNU General Public License for more details.
21  *
22  *   You should have received a copy of the GNU General Public License
23  *   along with this program; if not, write to the Free Software
24  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
25  *
26  */
27
28 #include <sound/driver.h>
29 #include <linux/slab.h>
30 #include <linux/init.h>
31 #include <sound/core.h>
32 #include <sound/emu10k1.h>
33
34 static void snd_emu10k1_proc_spdif_status(emu10k1_t * emu,
35                                           snd_info_buffer_t * buffer,
36                                           char *title,
37                                           int status_reg,
38                                           int rate_reg)
39 {
40         static char *clkaccy[4] = { "1000ppm", "50ppm", "variable", "unknown" };
41         static int samplerate[16] = { 44100, 1, 48000, 32000, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
42         static char *channel[16] = { "unspec", "left", "right", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" };
43         static char *emphasis[8] = { "none", "50/15 usec 2 channel", "2", "3", "4", "5", "6", "7" };
44         unsigned int status, rate = 0;
45         
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
50         snd_iprintf(buffer, "\n%s\n", title);
51
52         snd_iprintf(buffer, "Professional Mode     : %s\n", (status & SPCS_PROFESSIONAL) ? "yes" : "no");
53         snd_iprintf(buffer, "Not Audio Data        : %s\n", (status & SPCS_NOTAUDIODATA) ? "yes" : "no");
54         snd_iprintf(buffer, "Copyright             : %s\n", (status & SPCS_COPYRIGHT) ? "yes" : "no");
55         snd_iprintf(buffer, "Emphasis              : %s\n", emphasis[(status & SPCS_EMPHASISMASK) >> 3]);
56         snd_iprintf(buffer, "Mode                  : %i\n", (status & SPCS_MODEMASK) >> 6);
57         snd_iprintf(buffer, "Category Code         : 0x%x\n", (status & SPCS_CATEGORYCODEMASK) >> 8);
58         snd_iprintf(buffer, "Generation Status     : %s\n", status & SPCS_GENERATIONSTATUS ? "original" : "copy");
59         snd_iprintf(buffer, "Source Mask           : %i\n", (status & SPCS_SOURCENUMMASK) >> 16);
60         snd_iprintf(buffer, "Channel Number        : %s\n", channel[(status & SPCS_CHANNELNUMMASK) >> 20]);
61         snd_iprintf(buffer, "Sample Rate           : %iHz\n", samplerate[(status & SPCS_SAMPLERATEMASK) >> 24]);
62         snd_iprintf(buffer, "Clock Accuracy        : %s\n", clkaccy[(status & SPCS_CLKACCYMASK) >> 28]);
63
64         if (rate_reg > 0) {
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                 snd_iprintf(buffer, "Estimated Sample Rate : 0x%x\n", rate & SRCS_ESTSAMPLERATE);
68         }
69 }
70
71 static void snd_emu10k1_proc_read(snd_info_entry_t *entry, 
72                                   snd_info_buffer_t * buffer)
73 {
74         /* FIXME - output names are in emufx.c too */
75         static char *creative_outs[32] = {
76                 /* 00 */ "AC97 Left",
77                 /* 01 */ "AC97 Right",
78                 /* 02 */ "Optical IEC958 Left",
79                 /* 03 */ "Optical IEC958 Right",
80                 /* 04 */ "Center",
81                 /* 05 */ "LFE",
82                 /* 06 */ "Headphone Left",
83                 /* 07 */ "Headphone Right",
84                 /* 08 */ "Surround Left",
85                 /* 09 */ "Surround Right",
86                 /* 10 */ "PCM Capture Left",
87                 /* 11 */ "PCM Capture Right",
88                 /* 12 */ "MIC Capture",
89                 /* 13 */ "AC97 Surround Left",
90                 /* 14 */ "AC97 Surround Right",
91                 /* 15 */ "???",
92                 /* 16 */ "???",
93                 /* 17 */ "Analog Center",
94                 /* 18 */ "Analog LFE",
95                 /* 19 */ "???",
96                 /* 20 */ "???",
97                 /* 21 */ "???",
98                 /* 22 */ "???",
99                 /* 23 */ "???",
100                 /* 24 */ "???",
101                 /* 25 */ "???",
102                 /* 26 */ "???",
103                 /* 27 */ "???",
104                 /* 28 */ "???",
105                 /* 29 */ "???",
106                 /* 30 */ "???",
107                 /* 31 */ "???"
108         };
109
110         static char *audigy_outs[64] = {
111                 /* 00 */ "Digital Front Left",
112                 /* 01 */ "Digital Front Right",
113                 /* 02 */ "Digital Center",
114                 /* 03 */ "Digital LEF",
115                 /* 04 */ "Headphone Left",
116                 /* 05 */ "Headphone Right",
117                 /* 06 */ "Digital Rear Left",
118                 /* 07 */ "Digital Rear Right",
119                 /* 08 */ "Front Left",
120                 /* 09 */ "Front Right",
121                 /* 10 */ "Center",
122                 /* 11 */ "LFE",
123                 /* 12 */ "???",
124                 /* 13 */ "???",
125                 /* 14 */ "Rear Left",
126                 /* 15 */ "Rear Right",
127                 /* 16 */ "AC97 Front Left",
128                 /* 17 */ "AC97 Front Right",
129                 /* 18 */ "ADC Caputre Left",
130                 /* 19 */ "ADC Capture Right",
131                 /* 20 */ "???",
132                 /* 21 */ "???",
133                 /* 22 */ "???",
134                 /* 23 */ "???",
135                 /* 24 */ "???",
136                 /* 25 */ "???",
137                 /* 26 */ "???",
138                 /* 27 */ "???",
139                 /* 28 */ "???",
140                 /* 29 */ "???",
141                 /* 30 */ "???",
142                 /* 31 */ "???",
143                 /* 32 */ "FXBUS2_0",
144                 /* 33 */ "FXBUS2_1",
145                 /* 34 */ "FXBUS2_2",
146                 /* 35 */ "FXBUS2_3",
147                 /* 36 */ "FXBUS2_4",
148                 /* 37 */ "FXBUS2_5",
149                 /* 38 */ "FXBUS2_6",
150                 /* 39 */ "FXBUS2_7",
151                 /* 40 */ "FXBUS2_8",
152                 /* 41 */ "FXBUS2_9",
153                 /* 42 */ "FXBUS2_10",
154                 /* 43 */ "FXBUS2_11",
155                 /* 44 */ "FXBUS2_12",
156                 /* 45 */ "FXBUS2_13",
157                 /* 46 */ "FXBUS2_14",
158                 /* 47 */ "FXBUS2_15",
159                 /* 48 */ "FXBUS2_16",
160                 /* 49 */ "FXBUS2_17",
161                 /* 50 */ "FXBUS2_18",
162                 /* 51 */ "FXBUS2_19",
163                 /* 52 */ "FXBUS2_20",
164                 /* 53 */ "FXBUS2_21",
165                 /* 54 */ "FXBUS2_22",
166                 /* 55 */ "FXBUS2_23",
167                 /* 56 */ "FXBUS2_24",
168                 /* 57 */ "FXBUS2_25",
169                 /* 58 */ "FXBUS2_26",
170                 /* 59 */ "FXBUS2_27",
171                 /* 60 */ "FXBUS2_28",
172                 /* 61 */ "FXBUS2_29",
173                 /* 62 */ "FXBUS2_30",
174                 /* 63 */ "FXBUS2_31"
175         };
176
177         emu10k1_t *emu = entry->private_data;
178         unsigned int val, val1;
179         int nefx = emu->audigy ? 64 : 32;
180         char **outputs = emu->audigy ? audigy_outs : creative_outs;
181         int idx;
182         
183         snd_iprintf(buffer, "EMU10K1\n\n");
184         snd_iprintf(buffer, "Card                  : %s\n",
185                     emu->audigy ? "Audigy" : (emu->APS ? "EMU APS" : "Creative"));
186         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);
188         snd_iprintf(buffer, "\n");
189         snd_iprintf(buffer, "Effect Send Routing   :\n");
190         for (idx = 0; idx < NUM_G; idx++) {
191                 val = emu->audigy ?
192                         snd_emu10k1_ptr_read(emu, A_FXRT1, idx) :
193                         snd_emu10k1_ptr_read(emu, FXRT, idx);
194                 val1 = emu->audigy ?
195                         snd_emu10k1_ptr_read(emu, A_FXRT2, idx) :
196                         0;
197                 if (emu->audigy) {
198                         snd_iprintf(buffer, "Ch%i: A=%i, B=%i, C=%i, D=%i, ",
199                                 idx,
200                                 val & 0x3f,
201                                 (val >> 8) & 0x3f,
202                                 (val >> 16) & 0x3f,
203                                 (val >> 24) & 0x3f);
204                         snd_iprintf(buffer, "E=%i, F=%i, G=%i, H=%i\n",
205                                 val1 & 0x3f,
206                                 (val1 >> 8) & 0x3f,
207                                 (val1 >> 16) & 0x3f,
208                                 (val1 >> 24) & 0x3f);
209                 } else {
210                         snd_iprintf(buffer, "Ch%i: A=%i, B=%i, C=%i, D=%i\n",
211                                 idx,
212                                 (val >> 16) & 0x0f,
213                                 (val >> 20) & 0x0f,
214                                 (val >> 24) & 0x0f,
215                                 (val >> 28) & 0x0f);
216                 }
217         }
218         snd_iprintf(buffer, "\nCaptured FX Outputs   :\n");
219         for (idx = 0; idx < nefx; idx++) {
220                 if (emu->efx_voices_mask[idx/32] & (1 << (idx%32)))
221                         snd_iprintf(buffer, "  Output %02i [%s]\n", idx, outputs[idx]);
222         }
223         snd_iprintf(buffer, "\nAll FX Outputs        :\n");
224         for (idx = 0; idx < (emu->audigy ? 64 : 32); idx++)
225                 snd_iprintf(buffer, "  Output %02i [%s]\n", idx, outputs[idx]);
226         snd_emu10k1_proc_spdif_status(emu, buffer, "S/PDIF Output 0", SPCS0, -1);
227         snd_emu10k1_proc_spdif_status(emu, buffer, "S/PDIF Output 1", SPCS1, -1);
228         snd_emu10k1_proc_spdif_status(emu, buffer, "S/PDIF Output 2/3", SPCS2, -1);
229         snd_emu10k1_proc_spdif_status(emu, buffer, "CD-ROM S/PDIF", CDCS, CDSRCS);
230         snd_emu10k1_proc_spdif_status(emu, buffer, "General purpose S/PDIF", GPSCS, GPSRCS);
231         val = snd_emu10k1_ptr_read(emu, ZVSRCS, 0);
232         snd_iprintf(buffer, "\nZoomed Video\n");
233         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);
235 }
236
237 static void snd_emu10k1_proc_acode_read(snd_info_entry_t *entry, 
238                                         snd_info_buffer_t * buffer)
239 {
240         u32 pc;
241         emu10k1_t *emu = entry->private_data;
242
243         snd_iprintf(buffer, "FX8010 Instruction List '%s'\n", emu->fx8010.name);
244         snd_iprintf(buffer, "  Code dump      :\n");
245         for (pc = 0; pc < (emu->audigy ? 1024 : 512); pc++) {
246                 u32 low, high;
247                         
248                 low = snd_emu10k1_efx_read(emu, pc * 2);
249                 high = snd_emu10k1_efx_read(emu, pc * 2 + 1);
250                 if (emu->audigy)
251                         snd_iprintf(buffer, "    OP(0x%02x, 0x%03x, 0x%03x, 0x%03x, 0x%03x) /* 0x%04x: 0x%08x%08x */\n",
252                                     (high >> 24) & 0x0f,
253                                     (high >> 12) & 0x7ff,
254                                     (high >> 0) & 0x7ff,
255                                     (low >> 12) & 0x7ff,
256                                     (low >> 0) & 0x7ff,
257                                     pc,
258                                     high, low);
259                 else
260                         snd_iprintf(buffer, "    OP(0x%02x, 0x%03x, 0x%03x, 0x%03x, 0x%03x) /* 0x%04x: 0x%08x%08x */\n",
261                                     (high >> 20) & 0x0f,
262                                     (high >> 10) & 0x3ff,
263                                     (high >> 0) & 0x3ff,
264                                     (low >> 10) & 0x3ff,
265                                     (low >> 0) & 0x3ff,
266                                     pc,
267                                     high, low);
268         }
269 }
270
271 #define TOTAL_SIZE_GPR          (0x100*4)
272 #define A_TOTAL_SIZE_GPR        (0x200*4)
273 #define TOTAL_SIZE_TANKMEM_DATA (0xa0*4)
274 #define TOTAL_SIZE_TANKMEM_ADDR (0xa0*4)
275 #define A_TOTAL_SIZE_TANKMEM_DATA (0x100*4)
276 #define A_TOTAL_SIZE_TANKMEM_ADDR (0x100*4)
277 #define TOTAL_SIZE_CODE         (0x200*8)
278 #define A_TOTAL_SIZE_CODE       (0x400*8)
279
280 static long snd_emu10k1_fx8010_read(snd_info_entry_t *entry, void *file_private_data,
281                                     struct file *file, char __user *buf,
282                                     unsigned long count, unsigned long pos)
283 {
284         long size;
285         emu10k1_t *emu = entry->private_data;
286         unsigned int offset;
287         int tram_addr = 0;
288         
289         if (!strcmp(entry->name, "fx8010_tram_addr")) {
290                 offset = TANKMEMADDRREGBASE;
291                 tram_addr = 1;
292         } else if (!strcmp(entry->name, "fx8010_tram_data")) {
293                 offset = TANKMEMDATAREGBASE;
294         } else if (!strcmp(entry->name, "fx8010_code")) {
295                 offset = emu->audigy ? A_MICROCODEBASE : MICROCODEBASE;
296         } else {
297                 offset = emu->audigy ? A_FXGPREGBASE : FXGPREGBASE;
298         }
299         size = count;
300         if (pos + size > entry->size)
301                 size = (long)entry->size - pos;
302         if (size > 0) {
303                 unsigned int *tmp;
304                 long res;
305                 unsigned int idx;
306                 if ((tmp = kmalloc(size + 8, GFP_KERNEL)) == NULL)
307                         return -ENOMEM;
308                 for (idx = 0; idx < ((pos & 3) + size + 3) >> 2; idx++)
309                         if (tram_addr && emu->audigy) {
310                                 tmp[idx] = snd_emu10k1_ptr_read(emu, offset + idx + (pos >> 2), 0) >> 11;
311                                 tmp[idx] |= snd_emu10k1_ptr_read(emu, 0x100 + idx + (pos >> 2), 0) << 20;
312                         } else 
313                                 tmp[idx] = snd_emu10k1_ptr_read(emu, offset + idx + (pos >> 2), 0);
314                 if (copy_to_user(buf, ((char *)tmp) + (pos & 3), size))
315                         res = -EFAULT;
316                 else {
317                         res = size;
318                 }
319                 kfree(tmp);
320                 return res;
321         }
322         return 0;
323 }
324
325 static void snd_emu10k1_proc_voices_read(snd_info_entry_t *entry, 
326                                   snd_info_buffer_t * buffer)
327 {
328         emu10k1_t *emu = entry->private_data;
329         emu10k1_voice_t *voice;
330         int idx;
331         
332         snd_iprintf(buffer, "ch\tuse\tpcm\tefx\tsynth\tmidi\n");
333         for (idx = 0; idx < NUM_G; idx++) {
334                 voice = &emu->voices[idx];
335                 snd_iprintf(buffer, "%i\t%i\t%i\t%i\t%i\t%i\n",
336                         idx,
337                         voice->use,
338                         voice->pcm,
339                         voice->efx,
340                         voice->synth,
341                         voice->midi);
342         }
343 }
344
345 #ifdef CONFIG_SND_DEBUG
346 static void snd_emu_proc_io_reg_read(snd_info_entry_t *entry,
347                                      snd_info_buffer_t * buffer)
348 {
349         emu10k1_t *emu = entry->private_data;
350         unsigned long value;
351         unsigned long flags;
352         int i;
353         snd_iprintf(buffer, "IO Registers:\n\n");
354         for(i = 0; i < 0x40; i+=4) {
355                 spin_lock_irqsave(&emu->emu_lock, flags);
356                 value = inl(emu->port + i);
357                 spin_unlock_irqrestore(&emu->emu_lock, flags);
358                 snd_iprintf(buffer, "%02X: %08lX\n", i, value);
359         }
360 }
361
362 static void snd_emu_proc_io_reg_write(snd_info_entry_t *entry,
363                                       snd_info_buffer_t * buffer)
364 {
365         emu10k1_t *emu = entry->private_data;
366         unsigned long flags;
367         char line[64];
368         u32 reg, val;
369         while (!snd_info_get_line(buffer, line, sizeof(line))) {
370                 if (sscanf(line, "%x %x", &reg, &val) != 2)
371                         continue;
372                 if ((reg < 0x40) && (reg >=0) && (val <= 0xffffffff) ) {
373                         spin_lock_irqsave(&emu->emu_lock, flags);
374                         outl(val, emu->port + (reg & 0xfffffffc));
375                         spin_unlock_irqrestore(&emu->emu_lock, flags);
376                 }
377         }
378 }
379
380 static unsigned int snd_ptr_read(emu10k1_t * emu,
381                                  unsigned int iobase,
382                                  unsigned int reg,
383                                  unsigned int chn)
384 {
385         unsigned long flags;
386         unsigned int regptr, val;
387
388         regptr = (reg << 16) | chn;
389
390         spin_lock_irqsave(&emu->emu_lock, flags);
391         outl(regptr, emu->port + iobase + PTR);
392         val = inl(emu->port + iobase + DATA);
393         spin_unlock_irqrestore(&emu->emu_lock, flags);
394         return val;
395 }
396
397 static void snd_ptr_write(emu10k1_t *emu,
398                           unsigned int iobase,
399                           unsigned int reg,
400                           unsigned int chn,
401                           unsigned int data)
402 {
403         unsigned int regptr;
404         unsigned long flags;
405
406         regptr = (reg << 16) | chn;
407
408         spin_lock_irqsave(&emu->emu_lock, flags);
409         outl(regptr, emu->port + iobase + PTR);
410         outl(data, emu->port + iobase + DATA);
411         spin_unlock_irqrestore(&emu->emu_lock, flags);
412 }
413
414
415 static void snd_emu_proc_ptr_reg_read(snd_info_entry_t *entry,
416                                       snd_info_buffer_t * buffer, int iobase, int offset, int length, int voices)
417 {
418         emu10k1_t *emu = entry->private_data;
419         unsigned long value;
420         int i,j;
421         if (offset+length > 0x80) {
422                 snd_iprintf(buffer, "Input values out of range\n");
423                 return;
424         }
425         snd_iprintf(buffer, "Registers 0x%x\n", iobase);
426         for(i = offset; i < offset+length; i++) {
427                 snd_iprintf(buffer, "%02X: ",i);
428                 for (j = 0; j < voices; j++) {
429                         if(iobase == 0)
430                                 value = snd_ptr_read(emu, 0, i, j);
431                         else
432                                 value = snd_ptr_read(emu, 0x20, i, j);
433                         snd_iprintf(buffer, "%08lX ", value);
434                 }
435                 snd_iprintf(buffer, "\n");
436         }
437 }
438
439 static void snd_emu_proc_ptr_reg_write(snd_info_entry_t *entry,
440                                        snd_info_buffer_t * buffer, int iobase)
441 {
442         emu10k1_t *emu = entry->private_data;
443         char line[64];
444         unsigned int reg, channel_id , val;
445         while (!snd_info_get_line(buffer, line, sizeof(line))) {
446                 if (sscanf(line, "%x %x %x", &reg, &channel_id, &val) != 3)
447                         continue;
448                 if ((reg < 0x80) && (reg >=0) && (val <= 0xffffffff) && (channel_id >=0) && (channel_id <= 3) )
449                         snd_ptr_write(emu, iobase, reg, channel_id, val);
450         }
451 }
452
453 static void snd_emu_proc_ptr_reg_write00(snd_info_entry_t *entry,
454                                          snd_info_buffer_t * buffer)
455 {
456         snd_emu_proc_ptr_reg_write(entry, buffer, 0);
457 }
458
459 static void snd_emu_proc_ptr_reg_write20(snd_info_entry_t *entry,
460                                          snd_info_buffer_t * buffer)
461 {
462         snd_emu_proc_ptr_reg_write(entry, buffer, 0x20);
463 }
464         
465
466 static void snd_emu_proc_ptr_reg_read00a(snd_info_entry_t *entry,
467                                          snd_info_buffer_t * buffer)
468 {
469         snd_emu_proc_ptr_reg_read(entry, buffer, 0, 0, 0x40, 64);
470 }
471
472 static void snd_emu_proc_ptr_reg_read00b(snd_info_entry_t *entry,
473                                          snd_info_buffer_t * buffer)
474 {
475         snd_emu_proc_ptr_reg_read(entry, buffer, 0, 0x40, 0x40, 64);
476 }
477
478 static void snd_emu_proc_ptr_reg_read20a(snd_info_entry_t *entry,
479                                          snd_info_buffer_t * buffer)
480 {
481         snd_emu_proc_ptr_reg_read(entry, buffer, 0x20, 0, 0x40, 4);
482 }
483
484 static void snd_emu_proc_ptr_reg_read20b(snd_info_entry_t *entry,
485                                          snd_info_buffer_t * buffer)
486 {
487         snd_emu_proc_ptr_reg_read(entry, buffer, 0x20, 0x40, 0x40, 4);
488 }
489 #endif
490
491 static struct snd_info_entry_ops snd_emu10k1_proc_ops_fx8010 = {
492         .read = snd_emu10k1_fx8010_read,
493 };
494
495 int __devinit snd_emu10k1_proc_init(emu10k1_t * emu)
496 {
497         snd_info_entry_t *entry;
498 #ifdef CONFIG_SND_DEBUG
499         if (! snd_card_proc_new(emu->card, "io_regs", &entry)) {
500                 snd_info_set_text_ops(entry, emu, 1024, snd_emu_proc_io_reg_read);
501                 entry->c.text.write_size = 64;
502                 entry->c.text.write = snd_emu_proc_io_reg_write;
503         }
504         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);
506                 entry->c.text.write_size = 64;
507                 entry->c.text.write = snd_emu_proc_ptr_reg_write00;
508         }
509         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);
511                 entry->c.text.write_size = 64;
512                 entry->c.text.write = snd_emu_proc_ptr_reg_write00;
513         }
514         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);
516                 entry->c.text.write_size = 64;
517                 entry->c.text.write = snd_emu_proc_ptr_reg_write20;
518         }
519         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);
521                 entry->c.text.write_size = 64;
522                 entry->c.text.write = snd_emu_proc_ptr_reg_write20;
523         }
524 #endif
525         
526         if (! snd_card_proc_new(emu->card, "emu10k1", &entry))
527                 snd_info_set_text_ops(entry, emu, 2048, snd_emu10k1_proc_read);
528
529         if (! snd_card_proc_new(emu->card, "voices", &entry))
530                 snd_info_set_text_ops(entry, emu, 2048, snd_emu10k1_proc_voices_read);
531
532         if (! snd_card_proc_new(emu->card, "fx8010_gpr", &entry)) {
533                 entry->content = SNDRV_INFO_CONTENT_DATA;
534                 entry->private_data = emu;
535                 entry->mode = S_IFREG | S_IRUGO /*| S_IWUSR*/;
536                 entry->size = emu->audigy ? A_TOTAL_SIZE_GPR : TOTAL_SIZE_GPR;
537                 entry->c.ops = &snd_emu10k1_proc_ops_fx8010;
538         }
539         if (! snd_card_proc_new(emu->card, "fx8010_tram_data", &entry)) {
540                 entry->content = SNDRV_INFO_CONTENT_DATA;
541                 entry->private_data = emu;
542                 entry->mode = S_IFREG | S_IRUGO /*| S_IWUSR*/;
543                 entry->size = emu->audigy ? A_TOTAL_SIZE_TANKMEM_DATA : TOTAL_SIZE_TANKMEM_DATA ;
544                 entry->c.ops = &snd_emu10k1_proc_ops_fx8010;
545         }
546         if (! snd_card_proc_new(emu->card, "fx8010_tram_addr", &entry)) {
547                 entry->content = SNDRV_INFO_CONTENT_DATA;
548                 entry->private_data = emu;
549                 entry->mode = S_IFREG | S_IRUGO /*| S_IWUSR*/;
550                 entry->size = emu->audigy ? A_TOTAL_SIZE_TANKMEM_ADDR : TOTAL_SIZE_TANKMEM_ADDR ;
551                 entry->c.ops = &snd_emu10k1_proc_ops_fx8010;
552         }
553         if (! snd_card_proc_new(emu->card, "fx8010_code", &entry)) {
554                 entry->content = SNDRV_INFO_CONTENT_DATA;
555                 entry->private_data = emu;
556                 entry->mode = S_IFREG | S_IRUGO /*| S_IWUSR*/;
557                 entry->size = emu->audigy ? A_TOTAL_SIZE_CODE : TOTAL_SIZE_CODE;
558                 entry->c.ops = &snd_emu10k1_proc_ops_fx8010;
559         }
560         if (! snd_card_proc_new(emu->card, "fx8010_acode", &entry)) {
561                 entry->content = SNDRV_INFO_CONTENT_TEXT;
562                 entry->private_data = emu;
563                 entry->mode = S_IFREG | S_IRUGO /*| S_IWUSR*/;
564                 entry->c.text.read_size = 128*1024;
565                 entry->c.text.read = snd_emu10k1_proc_acode_read;
566         }
567         return 0;
568 }