Merge upstream (approx. 2.6.12-git8) into 'janitor' branch of netdev-2.6.
[linux-2.6] / 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 #include "p16v.h"
34
35 static void snd_emu10k1_proc_spdif_status(emu10k1_t * emu,
36                                           snd_info_buffer_t * buffer,
37                                           char *title,
38                                           int status_reg,
39                                           int rate_reg)
40 {
41         static char *clkaccy[4] = { "1000ppm", "50ppm", "variable", "unknown" };
42         static int samplerate[16] = { 44100, 1, 48000, 32000, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
43         static char *channel[16] = { "unspec", "left", "right", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" };
44         static char *emphasis[8] = { "none", "50/15 usec 2 channel", "2", "3", "4", "5", "6", "7" };
45         unsigned int status, rate = 0;
46         
47         status = snd_emu10k1_ptr_read(emu, status_reg, 0);
48
49         snd_iprintf(buffer, "\n%s\n", title);
50
51         if (status != 0xffffffff) {
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                         rate = snd_emu10k1_ptr_read(emu, rate_reg, 0);
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");
74         }
75
76 }
77
78 static void snd_emu10k1_proc_read(snd_info_entry_t *entry, 
79                                   snd_info_buffer_t * buffer)
80 {
81         /* FIXME - output names are in emufx.c too */
82         static char *creative_outs[32] = {
83                 /* 00 */ "AC97 Left",
84                 /* 01 */ "AC97 Right",
85                 /* 02 */ "Optical IEC958 Left",
86                 /* 03 */ "Optical IEC958 Right",
87                 /* 04 */ "Center",
88                 /* 05 */ "LFE",
89                 /* 06 */ "Headphone Left",
90                 /* 07 */ "Headphone Right",
91                 /* 08 */ "Surround Left",
92                 /* 09 */ "Surround Right",
93                 /* 10 */ "PCM Capture Left",
94                 /* 11 */ "PCM Capture Right",
95                 /* 12 */ "MIC Capture",
96                 /* 13 */ "AC97 Surround Left",
97                 /* 14 */ "AC97 Surround Right",
98                 /* 15 */ "???",
99                 /* 16 */ "???",
100                 /* 17 */ "Analog Center",
101                 /* 18 */ "Analog LFE",
102                 /* 19 */ "???",
103                 /* 20 */ "???",
104                 /* 21 */ "???",
105                 /* 22 */ "???",
106                 /* 23 */ "???",
107                 /* 24 */ "???",
108                 /* 25 */ "???",
109                 /* 26 */ "???",
110                 /* 27 */ "???",
111                 /* 28 */ "???",
112                 /* 29 */ "???",
113                 /* 30 */ "???",
114                 /* 31 */ "???"
115         };
116
117         static char *audigy_outs[64] = {
118                 /* 00 */ "Digital Front Left",
119                 /* 01 */ "Digital Front Right",
120                 /* 02 */ "Digital Center",
121                 /* 03 */ "Digital LEF",
122                 /* 04 */ "Headphone Left",
123                 /* 05 */ "Headphone Right",
124                 /* 06 */ "Digital Rear Left",
125                 /* 07 */ "Digital Rear Right",
126                 /* 08 */ "Front Left",
127                 /* 09 */ "Front Right",
128                 /* 10 */ "Center",
129                 /* 11 */ "LFE",
130                 /* 12 */ "???",
131                 /* 13 */ "???",
132                 /* 14 */ "Rear Left",
133                 /* 15 */ "Rear Right",
134                 /* 16 */ "AC97 Front Left",
135                 /* 17 */ "AC97 Front Right",
136                 /* 18 */ "ADC Caputre Left",
137                 /* 19 */ "ADC Capture Right",
138                 /* 20 */ "???",
139                 /* 21 */ "???",
140                 /* 22 */ "???",
141                 /* 23 */ "???",
142                 /* 24 */ "???",
143                 /* 25 */ "???",
144                 /* 26 */ "???",
145                 /* 27 */ "???",
146                 /* 28 */ "???",
147                 /* 29 */ "???",
148                 /* 30 */ "???",
149                 /* 31 */ "???",
150                 /* 32 */ "FXBUS2_0",
151                 /* 33 */ "FXBUS2_1",
152                 /* 34 */ "FXBUS2_2",
153                 /* 35 */ "FXBUS2_3",
154                 /* 36 */ "FXBUS2_4",
155                 /* 37 */ "FXBUS2_5",
156                 /* 38 */ "FXBUS2_6",
157                 /* 39 */ "FXBUS2_7",
158                 /* 40 */ "FXBUS2_8",
159                 /* 41 */ "FXBUS2_9",
160                 /* 42 */ "FXBUS2_10",
161                 /* 43 */ "FXBUS2_11",
162                 /* 44 */ "FXBUS2_12",
163                 /* 45 */ "FXBUS2_13",
164                 /* 46 */ "FXBUS2_14",
165                 /* 47 */ "FXBUS2_15",
166                 /* 48 */ "FXBUS2_16",
167                 /* 49 */ "FXBUS2_17",
168                 /* 50 */ "FXBUS2_18",
169                 /* 51 */ "FXBUS2_19",
170                 /* 52 */ "FXBUS2_20",
171                 /* 53 */ "FXBUS2_21",
172                 /* 54 */ "FXBUS2_22",
173                 /* 55 */ "FXBUS2_23",
174                 /* 56 */ "FXBUS2_24",
175                 /* 57 */ "FXBUS2_25",
176                 /* 58 */ "FXBUS2_26",
177                 /* 59 */ "FXBUS2_27",
178                 /* 60 */ "FXBUS2_28",
179                 /* 61 */ "FXBUS2_29",
180                 /* 62 */ "FXBUS2_30",
181                 /* 63 */ "FXBUS2_31"
182         };
183
184         emu10k1_t *emu = entry->private_data;
185         unsigned int val, val1;
186         int nefx = emu->audigy ? 64 : 32;
187         char **outputs = emu->audigy ? audigy_outs : creative_outs;
188         int idx;
189         
190         snd_iprintf(buffer, "EMU10K1\n\n");
191         snd_iprintf(buffer, "Card                  : %s\n",
192                     emu->audigy ? "Audigy" : (emu->card_capabilities->ecard ? "EMU APS" : "Creative"));
193         snd_iprintf(buffer, "Internal TRAM (words) : 0x%x\n", emu->fx8010.itram_size);
194         snd_iprintf(buffer, "External TRAM (words) : 0x%x\n", (int)emu->fx8010.etram_pages.bytes / 2);
195         snd_iprintf(buffer, "\n");
196         snd_iprintf(buffer, "Effect Send Routing   :\n");
197         for (idx = 0; idx < NUM_G; idx++) {
198                 val = emu->audigy ?
199                         snd_emu10k1_ptr_read(emu, A_FXRT1, idx) :
200                         snd_emu10k1_ptr_read(emu, FXRT, idx);
201                 val1 = emu->audigy ?
202                         snd_emu10k1_ptr_read(emu, A_FXRT2, idx) :
203                         0;
204                 if (emu->audigy) {
205                         snd_iprintf(buffer, "Ch%i: A=%i, B=%i, C=%i, D=%i, ",
206                                 idx,
207                                 val & 0x3f,
208                                 (val >> 8) & 0x3f,
209                                 (val >> 16) & 0x3f,
210                                 (val >> 24) & 0x3f);
211                         snd_iprintf(buffer, "E=%i, F=%i, G=%i, H=%i\n",
212                                 val1 & 0x3f,
213                                 (val1 >> 8) & 0x3f,
214                                 (val1 >> 16) & 0x3f,
215                                 (val1 >> 24) & 0x3f);
216                 } else {
217                         snd_iprintf(buffer, "Ch%i: A=%i, B=%i, C=%i, D=%i\n",
218                                 idx,
219                                 (val >> 16) & 0x0f,
220                                 (val >> 20) & 0x0f,
221                                 (val >> 24) & 0x0f,
222                                 (val >> 28) & 0x0f);
223                 }
224         }
225         snd_iprintf(buffer, "\nCaptured FX Outputs   :\n");
226         for (idx = 0; idx < nefx; idx++) {
227                 if (emu->efx_voices_mask[idx/32] & (1 << (idx%32)))
228                         snd_iprintf(buffer, "  Output %02i [%s]\n", idx, outputs[idx]);
229         }
230         snd_iprintf(buffer, "\nAll FX Outputs        :\n");
231         for (idx = 0; idx < (emu->audigy ? 64 : 32); idx++)
232                 snd_iprintf(buffer, "  Output %02i [%s]\n", idx, outputs[idx]);
233 }
234
235 static void snd_emu10k1_proc_spdif_read(snd_info_entry_t *entry, 
236                                   snd_info_buffer_t * buffer)
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
242         val = snd_emu10k1_ptr_read(emu, ZVSRCS, 0);
243         snd_iprintf(buffer, "\nZoomed Video\n");
244         snd_iprintf(buffer, "Rate Locked           : %s\n", val & SRCS_RATELOCKED ? "on" : "off");
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         }
262 }
263
264 static void snd_emu10k1_proc_acode_read(snd_info_entry_t *entry, 
265                                         snd_info_buffer_t * buffer)
266 {
267         u32 pc;
268         emu10k1_t *emu = entry->private_data;
269
270         snd_iprintf(buffer, "FX8010 Instruction List '%s'\n", emu->fx8010.name);
271         snd_iprintf(buffer, "  Code dump      :\n");
272         for (pc = 0; pc < (emu->audigy ? 1024 : 512); pc++) {
273                 u32 low, high;
274                         
275                 low = snd_emu10k1_efx_read(emu, pc * 2);
276                 high = snd_emu10k1_efx_read(emu, pc * 2 + 1);
277                 if (emu->audigy)
278                         snd_iprintf(buffer, "    OP(0x%02x, 0x%03x, 0x%03x, 0x%03x, 0x%03x) /* 0x%04x: 0x%08x%08x */\n",
279                                     (high >> 24) & 0x0f,
280                                     (high >> 12) & 0x7ff,
281                                     (high >> 0) & 0x7ff,
282                                     (low >> 12) & 0x7ff,
283                                     (low >> 0) & 0x7ff,
284                                     pc,
285                                     high, low);
286                 else
287                         snd_iprintf(buffer, "    OP(0x%02x, 0x%03x, 0x%03x, 0x%03x, 0x%03x) /* 0x%04x: 0x%08x%08x */\n",
288                                     (high >> 20) & 0x0f,
289                                     (high >> 10) & 0x3ff,
290                                     (high >> 0) & 0x3ff,
291                                     (low >> 10) & 0x3ff,
292                                     (low >> 0) & 0x3ff,
293                                     pc,
294                                     high, low);
295         }
296 }
297
298 #define TOTAL_SIZE_GPR          (0x100*4)
299 #define A_TOTAL_SIZE_GPR        (0x200*4)
300 #define TOTAL_SIZE_TANKMEM_DATA (0xa0*4)
301 #define TOTAL_SIZE_TANKMEM_ADDR (0xa0*4)
302 #define A_TOTAL_SIZE_TANKMEM_DATA (0x100*4)
303 #define A_TOTAL_SIZE_TANKMEM_ADDR (0x100*4)
304 #define TOTAL_SIZE_CODE         (0x200*8)
305 #define A_TOTAL_SIZE_CODE       (0x400*8)
306
307 static long snd_emu10k1_fx8010_read(snd_info_entry_t *entry, void *file_private_data,
308                                     struct file *file, char __user *buf,
309                                     unsigned long count, unsigned long pos)
310 {
311         long size;
312         emu10k1_t *emu = entry->private_data;
313         unsigned int offset;
314         int tram_addr = 0;
315         
316         if (!strcmp(entry->name, "fx8010_tram_addr")) {
317                 offset = TANKMEMADDRREGBASE;
318                 tram_addr = 1;
319         } else if (!strcmp(entry->name, "fx8010_tram_data")) {
320                 offset = TANKMEMDATAREGBASE;
321         } else if (!strcmp(entry->name, "fx8010_code")) {
322                 offset = emu->audigy ? A_MICROCODEBASE : MICROCODEBASE;
323         } else {
324                 offset = emu->audigy ? A_FXGPREGBASE : FXGPREGBASE;
325         }
326         size = count;
327         if (pos + size > entry->size)
328                 size = (long)entry->size - pos;
329         if (size > 0) {
330                 unsigned int *tmp;
331                 long res;
332                 unsigned int idx;
333                 if ((tmp = kmalloc(size + 8, GFP_KERNEL)) == NULL)
334                         return -ENOMEM;
335                 for (idx = 0; idx < ((pos & 3) + size + 3) >> 2; idx++)
336                         if (tram_addr && emu->audigy) {
337                                 tmp[idx] = snd_emu10k1_ptr_read(emu, offset + idx + (pos >> 2), 0) >> 11;
338                                 tmp[idx] |= snd_emu10k1_ptr_read(emu, 0x100 + idx + (pos >> 2), 0) << 20;
339                         } else 
340                                 tmp[idx] = snd_emu10k1_ptr_read(emu, offset + idx + (pos >> 2), 0);
341                 if (copy_to_user(buf, ((char *)tmp) + (pos & 3), size))
342                         res = -EFAULT;
343                 else {
344                         res = size;
345                 }
346                 kfree(tmp);
347                 return res;
348         }
349         return 0;
350 }
351
352 static void snd_emu10k1_proc_voices_read(snd_info_entry_t *entry, 
353                                   snd_info_buffer_t * buffer)
354 {
355         emu10k1_t *emu = entry->private_data;
356         emu10k1_voice_t *voice;
357         int idx;
358         
359         snd_iprintf(buffer, "ch\tuse\tpcm\tefx\tsynth\tmidi\n");
360         for (idx = 0; idx < NUM_G; idx++) {
361                 voice = &emu->voices[idx];
362                 snd_iprintf(buffer, "%i\t%i\t%i\t%i\t%i\t%i\n",
363                         idx,
364                         voice->use,
365                         voice->pcm,
366                         voice->efx,
367                         voice->synth,
368                         voice->midi);
369         }
370 }
371
372 #ifdef CONFIG_SND_DEBUG
373 static void snd_emu_proc_io_reg_read(snd_info_entry_t *entry,
374                                      snd_info_buffer_t * buffer)
375 {
376         emu10k1_t *emu = entry->private_data;
377         unsigned long value;
378         unsigned long flags;
379         int i;
380         snd_iprintf(buffer, "IO Registers:\n\n");
381         for(i = 0; i < 0x40; i+=4) {
382                 spin_lock_irqsave(&emu->emu_lock, flags);
383                 value = inl(emu->port + i);
384                 spin_unlock_irqrestore(&emu->emu_lock, flags);
385                 snd_iprintf(buffer, "%02X: %08lX\n", i, value);
386         }
387 }
388
389 static void snd_emu_proc_io_reg_write(snd_info_entry_t *entry,
390                                       snd_info_buffer_t * buffer)
391 {
392         emu10k1_t *emu = entry->private_data;
393         unsigned long flags;
394         char line[64];
395         u32 reg, val;
396         while (!snd_info_get_line(buffer, line, sizeof(line))) {
397                 if (sscanf(line, "%x %x", &reg, &val) != 2)
398                         continue;
399                 if ((reg < 0x40) && (reg >=0) && (val <= 0xffffffff) ) {
400                         spin_lock_irqsave(&emu->emu_lock, flags);
401                         outl(val, emu->port + (reg & 0xfffffffc));
402                         spin_unlock_irqrestore(&emu->emu_lock, flags);
403                 }
404         }
405 }
406
407 static unsigned int snd_ptr_read(emu10k1_t * emu,
408                                  unsigned int iobase,
409                                  unsigned int reg,
410                                  unsigned int chn)
411 {
412         unsigned long flags;
413         unsigned int regptr, val;
414
415         regptr = (reg << 16) | chn;
416
417         spin_lock_irqsave(&emu->emu_lock, flags);
418         outl(regptr, emu->port + iobase + PTR);
419         val = inl(emu->port + iobase + DATA);
420         spin_unlock_irqrestore(&emu->emu_lock, flags);
421         return val;
422 }
423
424 static void snd_ptr_write(emu10k1_t *emu,
425                           unsigned int iobase,
426                           unsigned int reg,
427                           unsigned int chn,
428                           unsigned int data)
429 {
430         unsigned int regptr;
431         unsigned long flags;
432
433         regptr = (reg << 16) | chn;
434
435         spin_lock_irqsave(&emu->emu_lock, flags);
436         outl(regptr, emu->port + iobase + PTR);
437         outl(data, emu->port + iobase + DATA);
438         spin_unlock_irqrestore(&emu->emu_lock, flags);
439 }
440
441
442 static void snd_emu_proc_ptr_reg_read(snd_info_entry_t *entry,
443                                       snd_info_buffer_t * buffer, int iobase, int offset, int length, int voices)
444 {
445         emu10k1_t *emu = entry->private_data;
446         unsigned long value;
447         int i,j;
448         if (offset+length > 0x80) {
449                 snd_iprintf(buffer, "Input values out of range\n");
450                 return;
451         }
452         snd_iprintf(buffer, "Registers 0x%x\n", iobase);
453         for(i = offset; i < offset+length; i++) {
454                 snd_iprintf(buffer, "%02X: ",i);
455                 for (j = 0; j < voices; j++) {
456                         if(iobase == 0)
457                                 value = snd_ptr_read(emu, 0, i, j);
458                         else
459                                 value = snd_ptr_read(emu, 0x20, i, j);
460                         snd_iprintf(buffer, "%08lX ", value);
461                 }
462                 snd_iprintf(buffer, "\n");
463         }
464 }
465
466 static void snd_emu_proc_ptr_reg_write(snd_info_entry_t *entry,
467                                        snd_info_buffer_t * buffer, int iobase)
468 {
469         emu10k1_t *emu = entry->private_data;
470         char line[64];
471         unsigned int reg, channel_id , val;
472         while (!snd_info_get_line(buffer, line, sizeof(line))) {
473                 if (sscanf(line, "%x %x %x", &reg, &channel_id, &val) != 3)
474                         continue;
475                 if ((reg < 0x80) && (reg >=0) && (val <= 0xffffffff) && (channel_id >=0) && (channel_id <= 3) )
476                         snd_ptr_write(emu, iobase, reg, channel_id, val);
477         }
478 }
479
480 static void snd_emu_proc_ptr_reg_write00(snd_info_entry_t *entry,
481                                          snd_info_buffer_t * buffer)
482 {
483         snd_emu_proc_ptr_reg_write(entry, buffer, 0);
484 }
485
486 static void snd_emu_proc_ptr_reg_write20(snd_info_entry_t *entry,
487                                          snd_info_buffer_t * buffer)
488 {
489         snd_emu_proc_ptr_reg_write(entry, buffer, 0x20);
490 }
491         
492
493 static void snd_emu_proc_ptr_reg_read00a(snd_info_entry_t *entry,
494                                          snd_info_buffer_t * buffer)
495 {
496         snd_emu_proc_ptr_reg_read(entry, buffer, 0, 0, 0x40, 64);
497 }
498
499 static void snd_emu_proc_ptr_reg_read00b(snd_info_entry_t *entry,
500                                          snd_info_buffer_t * buffer)
501 {
502         snd_emu_proc_ptr_reg_read(entry, buffer, 0, 0x40, 0x40, 64);
503 }
504
505 static void snd_emu_proc_ptr_reg_read20a(snd_info_entry_t *entry,
506                                          snd_info_buffer_t * buffer)
507 {
508         snd_emu_proc_ptr_reg_read(entry, buffer, 0x20, 0, 0x40, 4);
509 }
510
511 static void snd_emu_proc_ptr_reg_read20b(snd_info_entry_t *entry,
512                                          snd_info_buffer_t * buffer)
513 {
514         snd_emu_proc_ptr_reg_read(entry, buffer, 0x20, 0x40, 0x40, 4);
515 }
516 #endif
517
518 static struct snd_info_entry_ops snd_emu10k1_proc_ops_fx8010 = {
519         .read = snd_emu10k1_fx8010_read,
520 };
521
522 int __devinit snd_emu10k1_proc_init(emu10k1_t * emu)
523 {
524         snd_info_entry_t *entry;
525 #ifdef CONFIG_SND_DEBUG
526         if (! snd_card_proc_new(emu->card, "io_regs", &entry)) {
527                 snd_info_set_text_ops(entry, emu, 1024, snd_emu_proc_io_reg_read);
528                 entry->c.text.write_size = 64;
529                 entry->c.text.write = snd_emu_proc_io_reg_write;
530                 entry->mode |= S_IWUSR;
531         }
532         if (! snd_card_proc_new(emu->card, "ptr_regs00a", &entry)) {
533                 snd_info_set_text_ops(entry, emu, 65536, snd_emu_proc_ptr_reg_read00a);
534                 entry->c.text.write_size = 64;
535                 entry->c.text.write = snd_emu_proc_ptr_reg_write00;
536                 entry->mode |= S_IWUSR;
537         }
538         if (! snd_card_proc_new(emu->card, "ptr_regs00b", &entry)) {
539                 snd_info_set_text_ops(entry, emu, 65536, snd_emu_proc_ptr_reg_read00b);
540                 entry->c.text.write_size = 64;
541                 entry->c.text.write = snd_emu_proc_ptr_reg_write00;
542                 entry->mode |= S_IWUSR;
543         }
544         if (! snd_card_proc_new(emu->card, "ptr_regs20a", &entry)) {
545                 snd_info_set_text_ops(entry, emu, 65536, snd_emu_proc_ptr_reg_read20a);
546                 entry->c.text.write_size = 64;
547                 entry->c.text.write = snd_emu_proc_ptr_reg_write20;
548                 entry->mode |= S_IWUSR;
549         }
550         if (! snd_card_proc_new(emu->card, "ptr_regs20b", &entry)) {
551                 snd_info_set_text_ops(entry, emu, 65536, snd_emu_proc_ptr_reg_read20b);
552                 entry->c.text.write_size = 64;
553                 entry->c.text.write = snd_emu_proc_ptr_reg_write20;
554                 entry->mode |= S_IWUSR;
555         }
556 #endif
557         
558         if (! snd_card_proc_new(emu->card, "emu10k1", &entry))
559                 snd_info_set_text_ops(entry, emu, 2048, snd_emu10k1_proc_read);
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
570         if (! snd_card_proc_new(emu->card, "voices", &entry))
571                 snd_info_set_text_ops(entry, emu, 2048, snd_emu10k1_proc_voices_read);
572
573         if (! snd_card_proc_new(emu->card, "fx8010_gpr", &entry)) {
574                 entry->content = SNDRV_INFO_CONTENT_DATA;
575                 entry->private_data = emu;
576                 entry->mode = S_IFREG | S_IRUGO /*| S_IWUSR*/;
577                 entry->size = emu->audigy ? A_TOTAL_SIZE_GPR : TOTAL_SIZE_GPR;
578                 entry->c.ops = &snd_emu10k1_proc_ops_fx8010;
579         }
580         if (! snd_card_proc_new(emu->card, "fx8010_tram_data", &entry)) {
581                 entry->content = SNDRV_INFO_CONTENT_DATA;
582                 entry->private_data = emu;
583                 entry->mode = S_IFREG | S_IRUGO /*| S_IWUSR*/;
584                 entry->size = emu->audigy ? A_TOTAL_SIZE_TANKMEM_DATA : TOTAL_SIZE_TANKMEM_DATA ;
585                 entry->c.ops = &snd_emu10k1_proc_ops_fx8010;
586         }
587         if (! snd_card_proc_new(emu->card, "fx8010_tram_addr", &entry)) {
588                 entry->content = SNDRV_INFO_CONTENT_DATA;
589                 entry->private_data = emu;
590                 entry->mode = S_IFREG | S_IRUGO /*| S_IWUSR*/;
591                 entry->size = emu->audigy ? A_TOTAL_SIZE_TANKMEM_ADDR : TOTAL_SIZE_TANKMEM_ADDR ;
592                 entry->c.ops = &snd_emu10k1_proc_ops_fx8010;
593         }
594         if (! snd_card_proc_new(emu->card, "fx8010_code", &entry)) {
595                 entry->content = SNDRV_INFO_CONTENT_DATA;
596                 entry->private_data = emu;
597                 entry->mode = S_IFREG | S_IRUGO /*| S_IWUSR*/;
598                 entry->size = emu->audigy ? A_TOTAL_SIZE_CODE : TOTAL_SIZE_CODE;
599                 entry->c.ops = &snd_emu10k1_proc_ops_fx8010;
600         }
601         if (! snd_card_proc_new(emu->card, "fx8010_acode", &entry)) {
602                 entry->content = SNDRV_INFO_CONTENT_TEXT;
603                 entry->private_data = emu;
604                 entry->mode = S_IFREG | S_IRUGO /*| S_IWUSR*/;
605                 entry->c.text.read_size = 128*1024;
606                 entry->c.text.read = snd_emu10k1_proc_acode_read;
607         }
608         return 0;
609 }