GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / sound / pci / emu10k1 / emuproc.c
blobca69e9aa4803223410cd961fb085ff2931d2ae8a
1 /*
2 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
3 * Creative Labs, Inc.
4 * Routines for control of EMU10K1 chips / proc interface routines
6 * Copyright (c) by James Courtier-Dutton <James@superbug.co.uk>
7 * Added EMU 1010 support.
9 * BUGS:
10 * --
12 * TODO:
13 * --
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 #include <linux/slab.h>
32 #include <linux/init.h>
33 #include <sound/core.h>
34 #include <sound/emu10k1.h>
35 #include "p16v.h"
37 #ifdef CONFIG_PROC_FS
38 static void snd_emu10k1_proc_spdif_status(struct snd_emu10k1 * emu,
39 struct snd_info_buffer *buffer,
40 char *title,
41 int status_reg,
42 int rate_reg)
44 static char *clkaccy[4] = { "1000ppm", "50ppm", "variable", "unknown" };
45 static int samplerate[16] = { 44100, 1, 48000, 32000, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
46 static char *channel[16] = { "unspec", "left", "right", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" };
47 static char *emphasis[8] = { "none", "50/15 usec 2 channel", "2", "3", "4", "5", "6", "7" };
48 unsigned int status, rate = 0;
50 status = snd_emu10k1_ptr_read(emu, status_reg, 0);
52 snd_iprintf(buffer, "\n%s\n", title);
54 if (status != 0xffffffff) {
55 snd_iprintf(buffer, "Professional Mode : %s\n", (status & SPCS_PROFESSIONAL) ? "yes" : "no");
56 snd_iprintf(buffer, "Not Audio Data : %s\n", (status & SPCS_NOTAUDIODATA) ? "yes" : "no");
57 snd_iprintf(buffer, "Copyright : %s\n", (status & SPCS_COPYRIGHT) ? "yes" : "no");
58 snd_iprintf(buffer, "Emphasis : %s\n", emphasis[(status & SPCS_EMPHASISMASK) >> 3]);
59 snd_iprintf(buffer, "Mode : %i\n", (status & SPCS_MODEMASK) >> 6);
60 snd_iprintf(buffer, "Category Code : 0x%x\n", (status & SPCS_CATEGORYCODEMASK) >> 8);
61 snd_iprintf(buffer, "Generation Status : %s\n", status & SPCS_GENERATIONSTATUS ? "original" : "copy");
62 snd_iprintf(buffer, "Source Mask : %i\n", (status & SPCS_SOURCENUMMASK) >> 16);
63 snd_iprintf(buffer, "Channel Number : %s\n", channel[(status & SPCS_CHANNELNUMMASK) >> 20]);
64 snd_iprintf(buffer, "Sample Rate : %iHz\n", samplerate[(status & SPCS_SAMPLERATEMASK) >> 24]);
65 snd_iprintf(buffer, "Clock Accuracy : %s\n", clkaccy[(status & SPCS_CLKACCYMASK) >> 28]);
67 if (rate_reg > 0) {
68 rate = snd_emu10k1_ptr_read(emu, rate_reg, 0);
69 snd_iprintf(buffer, "S/PDIF Valid : %s\n", rate & SRCS_SPDIFVALID ? "on" : "off");
70 snd_iprintf(buffer, "S/PDIF Locked : %s\n", rate & SRCS_SPDIFLOCKED ? "on" : "off");
71 snd_iprintf(buffer, "Rate Locked : %s\n", rate & SRCS_RATELOCKED ? "on" : "off");
72 /* From ((Rate * 48000 ) / 262144); */
73 snd_iprintf(buffer, "Estimated Sample Rate : %d\n", ((rate & 0xFFFFF ) * 375) >> 11);
75 } else {
76 snd_iprintf(buffer, "No signal detected.\n");
81 static void snd_emu10k1_proc_read(struct snd_info_entry *entry,
82 struct snd_info_buffer *buffer)
84 static char *creative_outs[32] = {
85 /* 00 */ "AC97 Left",
86 /* 01 */ "AC97 Right",
87 /* 02 */ "Optical IEC958 Left",
88 /* 03 */ "Optical IEC958 Right",
89 /* 04 */ "Center",
90 /* 05 */ "LFE",
91 /* 06 */ "Headphone Left",
92 /* 07 */ "Headphone Right",
93 /* 08 */ "Surround Left",
94 /* 09 */ "Surround Right",
95 /* 10 */ "PCM Capture Left",
96 /* 11 */ "PCM Capture Right",
97 /* 12 */ "MIC Capture",
98 /* 13 */ "AC97 Surround Left",
99 /* 14 */ "AC97 Surround Right",
100 /* 15 */ "???",
101 /* 16 */ "???",
102 /* 17 */ "Analog Center",
103 /* 18 */ "Analog LFE",
104 /* 19 */ "???",
105 /* 20 */ "???",
106 /* 21 */ "???",
107 /* 22 */ "???",
108 /* 23 */ "???",
109 /* 24 */ "???",
110 /* 25 */ "???",
111 /* 26 */ "???",
112 /* 27 */ "???",
113 /* 28 */ "???",
114 /* 29 */ "???",
115 /* 30 */ "???",
116 /* 31 */ "???"
119 static char *audigy_outs[64] = {
120 /* 00 */ "Digital Front Left",
121 /* 01 */ "Digital Front Right",
122 /* 02 */ "Digital Center",
123 /* 03 */ "Digital LEF",
124 /* 04 */ "Headphone Left",
125 /* 05 */ "Headphone Right",
126 /* 06 */ "Digital Rear Left",
127 /* 07 */ "Digital Rear Right",
128 /* 08 */ "Front Left",
129 /* 09 */ "Front Right",
130 /* 10 */ "Center",
131 /* 11 */ "LFE",
132 /* 12 */ "???",
133 /* 13 */ "???",
134 /* 14 */ "Rear Left",
135 /* 15 */ "Rear Right",
136 /* 16 */ "AC97 Front Left",
137 /* 17 */ "AC97 Front Right",
138 /* 18 */ "ADC Caputre Left",
139 /* 19 */ "ADC Capture Right",
140 /* 20 */ "???",
141 /* 21 */ "???",
142 /* 22 */ "???",
143 /* 23 */ "???",
144 /* 24 */ "???",
145 /* 25 */ "???",
146 /* 26 */ "???",
147 /* 27 */ "???",
148 /* 28 */ "???",
149 /* 29 */ "???",
150 /* 30 */ "???",
151 /* 31 */ "???",
152 /* 32 */ "FXBUS2_0",
153 /* 33 */ "FXBUS2_1",
154 /* 34 */ "FXBUS2_2",
155 /* 35 */ "FXBUS2_3",
156 /* 36 */ "FXBUS2_4",
157 /* 37 */ "FXBUS2_5",
158 /* 38 */ "FXBUS2_6",
159 /* 39 */ "FXBUS2_7",
160 /* 40 */ "FXBUS2_8",
161 /* 41 */ "FXBUS2_9",
162 /* 42 */ "FXBUS2_10",
163 /* 43 */ "FXBUS2_11",
164 /* 44 */ "FXBUS2_12",
165 /* 45 */ "FXBUS2_13",
166 /* 46 */ "FXBUS2_14",
167 /* 47 */ "FXBUS2_15",
168 /* 48 */ "FXBUS2_16",
169 /* 49 */ "FXBUS2_17",
170 /* 50 */ "FXBUS2_18",
171 /* 51 */ "FXBUS2_19",
172 /* 52 */ "FXBUS2_20",
173 /* 53 */ "FXBUS2_21",
174 /* 54 */ "FXBUS2_22",
175 /* 55 */ "FXBUS2_23",
176 /* 56 */ "FXBUS2_24",
177 /* 57 */ "FXBUS2_25",
178 /* 58 */ "FXBUS2_26",
179 /* 59 */ "FXBUS2_27",
180 /* 60 */ "FXBUS2_28",
181 /* 61 */ "FXBUS2_29",
182 /* 62 */ "FXBUS2_30",
183 /* 63 */ "FXBUS2_31"
186 struct snd_emu10k1 *emu = entry->private_data;
187 unsigned int val, val1;
188 int nefx = emu->audigy ? 64 : 32;
189 char **outputs = emu->audigy ? audigy_outs : creative_outs;
190 int idx;
192 snd_iprintf(buffer, "EMU10K1\n\n");
193 snd_iprintf(buffer, "Card : %s\n",
194 emu->audigy ? "Audigy" : (emu->card_capabilities->ecard ? "EMU APS" : "Creative"));
195 snd_iprintf(buffer, "Internal TRAM (words) : 0x%x\n", emu->fx8010.itram_size);
196 snd_iprintf(buffer, "External TRAM (words) : 0x%x\n", (int)emu->fx8010.etram_pages.bytes / 2);
197 snd_iprintf(buffer, "\n");
198 snd_iprintf(buffer, "Effect Send Routing :\n");
199 for (idx = 0; idx < NUM_G; idx++) {
200 val = emu->audigy ?
201 snd_emu10k1_ptr_read(emu, A_FXRT1, idx) :
202 snd_emu10k1_ptr_read(emu, FXRT, idx);
203 val1 = emu->audigy ?
204 snd_emu10k1_ptr_read(emu, A_FXRT2, idx) :
206 if (emu->audigy) {
207 snd_iprintf(buffer, "Ch%i: A=%i, B=%i, C=%i, D=%i, ",
208 idx,
209 val & 0x3f,
210 (val >> 8) & 0x3f,
211 (val >> 16) & 0x3f,
212 (val >> 24) & 0x3f);
213 snd_iprintf(buffer, "E=%i, F=%i, G=%i, H=%i\n",
214 val1 & 0x3f,
215 (val1 >> 8) & 0x3f,
216 (val1 >> 16) & 0x3f,
217 (val1 >> 24) & 0x3f);
218 } else {
219 snd_iprintf(buffer, "Ch%i: A=%i, B=%i, C=%i, D=%i\n",
220 idx,
221 (val >> 16) & 0x0f,
222 (val >> 20) & 0x0f,
223 (val >> 24) & 0x0f,
224 (val >> 28) & 0x0f);
227 snd_iprintf(buffer, "\nCaptured FX Outputs :\n");
228 for (idx = 0; idx < nefx; idx++) {
229 if (emu->efx_voices_mask[idx/32] & (1 << (idx%32)))
230 snd_iprintf(buffer, " Output %02i [%s]\n", idx, outputs[idx]);
232 snd_iprintf(buffer, "\nAll FX Outputs :\n");
233 for (idx = 0; idx < (emu->audigy ? 64 : 32); idx++)
234 snd_iprintf(buffer, " Output %02i [%s]\n", idx, outputs[idx]);
237 static void snd_emu10k1_proc_spdif_read(struct snd_info_entry *entry,
238 struct snd_info_buffer *buffer)
240 struct snd_emu10k1 *emu = entry->private_data;
241 u32 value;
242 u32 value2;
243 unsigned long flags;
244 u32 rate;
246 if (emu->card_capabilities->emu_model) {
247 spin_lock_irqsave(&emu->emu_lock, flags);
248 snd_emu1010_fpga_read(emu, 0x38, &value);
249 spin_unlock_irqrestore(&emu->emu_lock, flags);
250 if ((value & 0x1) == 0) {
251 spin_lock_irqsave(&emu->emu_lock, flags);
252 snd_emu1010_fpga_read(emu, 0x2a, &value);
253 snd_emu1010_fpga_read(emu, 0x2b, &value2);
254 spin_unlock_irqrestore(&emu->emu_lock, flags);
255 rate = 0x1770000 / (((value << 5) | value2)+1);
256 snd_iprintf(buffer, "ADAT Locked : %u\n", rate);
257 } else {
258 snd_iprintf(buffer, "ADAT Unlocked\n");
260 spin_lock_irqsave(&emu->emu_lock, flags);
261 snd_emu1010_fpga_read(emu, 0x20, &value);
262 spin_unlock_irqrestore(&emu->emu_lock, flags);
263 if ((value & 0x4) == 0) {
264 spin_lock_irqsave(&emu->emu_lock, flags);
265 snd_emu1010_fpga_read(emu, 0x28, &value);
266 snd_emu1010_fpga_read(emu, 0x29, &value2);
267 spin_unlock_irqrestore(&emu->emu_lock, flags);
268 rate = 0x1770000 / (((value << 5) | value2)+1);
269 snd_iprintf(buffer, "SPDIF Locked : %d\n", rate);
270 } else {
271 snd_iprintf(buffer, "SPDIF Unlocked\n");
273 } else {
274 snd_emu10k1_proc_spdif_status(emu, buffer, "CD-ROM S/PDIF In", CDCS, CDSRCS);
275 snd_emu10k1_proc_spdif_status(emu, buffer, "Optical or Coax S/PDIF In", GPSCS, GPSRCS);
279 static void snd_emu10k1_proc_rates_read(struct snd_info_entry *entry,
280 struct snd_info_buffer *buffer)
282 static int samplerate[8] = { 44100, 48000, 96000, 192000, 4, 5, 6, 7 };
283 struct snd_emu10k1 *emu = entry->private_data;
284 unsigned int val, tmp, n;
285 val = snd_emu10k1_ptr20_read(emu, CAPTURE_RATE_STATUS, 0);
286 tmp = (val >> 16) & 0x8;
287 for (n = 0; n < 4; n++) {
288 tmp = val >> (16 + (n*4));
289 if (tmp & 0x8) snd_iprintf(buffer, "Channel %d: Rate=%d\n", n, samplerate[tmp & 0x7]);
290 else snd_iprintf(buffer, "Channel %d: No input\n", n);
294 static void snd_emu10k1_proc_acode_read(struct snd_info_entry *entry,
295 struct snd_info_buffer *buffer)
297 u32 pc;
298 struct snd_emu10k1 *emu = entry->private_data;
300 snd_iprintf(buffer, "FX8010 Instruction List '%s'\n", emu->fx8010.name);
301 snd_iprintf(buffer, " Code dump :\n");
302 for (pc = 0; pc < (emu->audigy ? 1024 : 512); pc++) {
303 u32 low, high;
305 low = snd_emu10k1_efx_read(emu, pc * 2);
306 high = snd_emu10k1_efx_read(emu, pc * 2 + 1);
307 if (emu->audigy)
308 snd_iprintf(buffer, " OP(0x%02x, 0x%03x, 0x%03x, 0x%03x, 0x%03x) /* 0x%04x: 0x%08x%08x */\n",
309 (high >> 24) & 0x0f,
310 (high >> 12) & 0x7ff,
311 (high >> 0) & 0x7ff,
312 (low >> 12) & 0x7ff,
313 (low >> 0) & 0x7ff,
315 high, low);
316 else
317 snd_iprintf(buffer, " OP(0x%02x, 0x%03x, 0x%03x, 0x%03x, 0x%03x) /* 0x%04x: 0x%08x%08x */\n",
318 (high >> 20) & 0x0f,
319 (high >> 10) & 0x3ff,
320 (high >> 0) & 0x3ff,
321 (low >> 10) & 0x3ff,
322 (low >> 0) & 0x3ff,
324 high, low);
328 #define TOTAL_SIZE_GPR (0x100*4)
329 #define A_TOTAL_SIZE_GPR (0x200*4)
330 #define TOTAL_SIZE_TANKMEM_DATA (0xa0*4)
331 #define TOTAL_SIZE_TANKMEM_ADDR (0xa0*4)
332 #define A_TOTAL_SIZE_TANKMEM_DATA (0x100*4)
333 #define A_TOTAL_SIZE_TANKMEM_ADDR (0x100*4)
334 #define TOTAL_SIZE_CODE (0x200*8)
335 #define A_TOTAL_SIZE_CODE (0x400*8)
337 static ssize_t snd_emu10k1_fx8010_read(struct snd_info_entry *entry,
338 void *file_private_data,
339 struct file *file, char __user *buf,
340 size_t count, loff_t pos)
342 struct snd_emu10k1 *emu = entry->private_data;
343 unsigned int offset;
344 int tram_addr = 0;
345 unsigned int *tmp;
346 long res;
347 unsigned int idx;
349 if (!strcmp(entry->name, "fx8010_tram_addr")) {
350 offset = TANKMEMADDRREGBASE;
351 tram_addr = 1;
352 } else if (!strcmp(entry->name, "fx8010_tram_data")) {
353 offset = TANKMEMDATAREGBASE;
354 } else if (!strcmp(entry->name, "fx8010_code")) {
355 offset = emu->audigy ? A_MICROCODEBASE : MICROCODEBASE;
356 } else {
357 offset = emu->audigy ? A_FXGPREGBASE : FXGPREGBASE;
360 tmp = kmalloc(count + 8, GFP_KERNEL);
361 if (!tmp)
362 return -ENOMEM;
363 for (idx = 0; idx < ((pos & 3) + count + 3) >> 2; idx++) {
364 unsigned int val;
365 val = snd_emu10k1_ptr_read(emu, offset + idx + (pos >> 2), 0);
366 if (tram_addr && emu->audigy) {
367 val >>= 11;
368 val |= snd_emu10k1_ptr_read(emu, 0x100 + idx + (pos >> 2), 0) << 20;
370 tmp[idx] = val;
372 if (copy_to_user(buf, ((char *)tmp) + (pos & 3), count))
373 res = -EFAULT;
374 else
375 res = count;
376 kfree(tmp);
377 return res;
380 static void snd_emu10k1_proc_voices_read(struct snd_info_entry *entry,
381 struct snd_info_buffer *buffer)
383 struct snd_emu10k1 *emu = entry->private_data;
384 struct snd_emu10k1_voice *voice;
385 int idx;
387 snd_iprintf(buffer, "ch\tuse\tpcm\tefx\tsynth\tmidi\n");
388 for (idx = 0; idx < NUM_G; idx++) {
389 voice = &emu->voices[idx];
390 snd_iprintf(buffer, "%i\t%i\t%i\t%i\t%i\t%i\n",
391 idx,
392 voice->use,
393 voice->pcm,
394 voice->efx,
395 voice->synth,
396 voice->midi);
400 #ifdef CONFIG_SND_DEBUG
401 static void snd_emu_proc_emu1010_reg_read(struct snd_info_entry *entry,
402 struct snd_info_buffer *buffer)
404 struct snd_emu10k1 *emu = entry->private_data;
405 u32 value;
406 unsigned long flags;
407 int i;
408 snd_iprintf(buffer, "EMU1010 Registers:\n\n");
410 for(i = 0; i < 0x40; i+=1) {
411 spin_lock_irqsave(&emu->emu_lock, flags);
412 snd_emu1010_fpga_read(emu, i, &value);
413 spin_unlock_irqrestore(&emu->emu_lock, flags);
414 snd_iprintf(buffer, "%02X: %08X, %02X\n", i, value, (value >> 8) & 0x7f);
418 static void snd_emu_proc_io_reg_read(struct snd_info_entry *entry,
419 struct snd_info_buffer *buffer)
421 struct snd_emu10k1 *emu = entry->private_data;
422 unsigned long value;
423 unsigned long flags;
424 int i;
425 snd_iprintf(buffer, "IO Registers:\n\n");
426 for(i = 0; i < 0x40; i+=4) {
427 spin_lock_irqsave(&emu->emu_lock, flags);
428 value = inl(emu->port + i);
429 spin_unlock_irqrestore(&emu->emu_lock, flags);
430 snd_iprintf(buffer, "%02X: %08lX\n", i, value);
434 static void snd_emu_proc_io_reg_write(struct snd_info_entry *entry,
435 struct snd_info_buffer *buffer)
437 struct snd_emu10k1 *emu = entry->private_data;
438 unsigned long flags;
439 char line[64];
440 u32 reg, val;
441 while (!snd_info_get_line(buffer, line, sizeof(line))) {
442 if (sscanf(line, "%x %x", &reg, &val) != 2)
443 continue;
444 if (reg < 0x40 && val <= 0xffffffff) {
445 spin_lock_irqsave(&emu->emu_lock, flags);
446 outl(val, emu->port + (reg & 0xfffffffc));
447 spin_unlock_irqrestore(&emu->emu_lock, flags);
452 static unsigned int snd_ptr_read(struct snd_emu10k1 * emu,
453 unsigned int iobase,
454 unsigned int reg,
455 unsigned int chn)
457 unsigned long flags;
458 unsigned int regptr, val;
460 regptr = (reg << 16) | chn;
462 spin_lock_irqsave(&emu->emu_lock, flags);
463 outl(regptr, emu->port + iobase + PTR);
464 val = inl(emu->port + iobase + DATA);
465 spin_unlock_irqrestore(&emu->emu_lock, flags);
466 return val;
469 static void snd_ptr_write(struct snd_emu10k1 *emu,
470 unsigned int iobase,
471 unsigned int reg,
472 unsigned int chn,
473 unsigned int data)
475 unsigned int regptr;
476 unsigned long flags;
478 regptr = (reg << 16) | chn;
480 spin_lock_irqsave(&emu->emu_lock, flags);
481 outl(regptr, emu->port + iobase + PTR);
482 outl(data, emu->port + iobase + DATA);
483 spin_unlock_irqrestore(&emu->emu_lock, flags);
487 static void snd_emu_proc_ptr_reg_read(struct snd_info_entry *entry,
488 struct snd_info_buffer *buffer, int iobase, int offset, int length, int voices)
490 struct snd_emu10k1 *emu = entry->private_data;
491 unsigned long value;
492 int i,j;
493 if (offset+length > 0xa0) {
494 snd_iprintf(buffer, "Input values out of range\n");
495 return;
497 snd_iprintf(buffer, "Registers 0x%x\n", iobase);
498 for(i = offset; i < offset+length; i++) {
499 snd_iprintf(buffer, "%02X: ",i);
500 for (j = 0; j < voices; j++) {
501 if(iobase == 0)
502 value = snd_ptr_read(emu, 0, i, j);
503 else
504 value = snd_ptr_read(emu, 0x20, i, j);
505 snd_iprintf(buffer, "%08lX ", value);
507 snd_iprintf(buffer, "\n");
511 static void snd_emu_proc_ptr_reg_write(struct snd_info_entry *entry,
512 struct snd_info_buffer *buffer, int iobase)
514 struct snd_emu10k1 *emu = entry->private_data;
515 char line[64];
516 unsigned int reg, channel_id , val;
517 while (!snd_info_get_line(buffer, line, sizeof(line))) {
518 if (sscanf(line, "%x %x %x", &reg, &channel_id, &val) != 3)
519 continue;
520 if (reg < 0xa0 && val <= 0xffffffff && channel_id <= 3)
521 snd_ptr_write(emu, iobase, reg, channel_id, val);
525 static void snd_emu_proc_ptr_reg_write00(struct snd_info_entry *entry,
526 struct snd_info_buffer *buffer)
528 snd_emu_proc_ptr_reg_write(entry, buffer, 0);
531 static void snd_emu_proc_ptr_reg_write20(struct snd_info_entry *entry,
532 struct snd_info_buffer *buffer)
534 snd_emu_proc_ptr_reg_write(entry, buffer, 0x20);
538 static void snd_emu_proc_ptr_reg_read00a(struct snd_info_entry *entry,
539 struct snd_info_buffer *buffer)
541 snd_emu_proc_ptr_reg_read(entry, buffer, 0, 0, 0x40, 64);
544 static void snd_emu_proc_ptr_reg_read00b(struct snd_info_entry *entry,
545 struct snd_info_buffer *buffer)
547 snd_emu_proc_ptr_reg_read(entry, buffer, 0, 0x40, 0x40, 64);
550 static void snd_emu_proc_ptr_reg_read20a(struct snd_info_entry *entry,
551 struct snd_info_buffer *buffer)
553 snd_emu_proc_ptr_reg_read(entry, buffer, 0x20, 0, 0x40, 4);
556 static void snd_emu_proc_ptr_reg_read20b(struct snd_info_entry *entry,
557 struct snd_info_buffer *buffer)
559 snd_emu_proc_ptr_reg_read(entry, buffer, 0x20, 0x40, 0x40, 4);
562 static void snd_emu_proc_ptr_reg_read20c(struct snd_info_entry *entry,
563 struct snd_info_buffer * buffer)
565 snd_emu_proc_ptr_reg_read(entry, buffer, 0x20, 0x80, 0x20, 4);
567 #endif
569 static struct snd_info_entry_ops snd_emu10k1_proc_ops_fx8010 = {
570 .read = snd_emu10k1_fx8010_read,
573 int __devinit snd_emu10k1_proc_init(struct snd_emu10k1 * emu)
575 struct snd_info_entry *entry;
576 #ifdef CONFIG_SND_DEBUG
577 if (emu->card_capabilities->emu_model) {
578 if (! snd_card_proc_new(emu->card, "emu1010_regs", &entry))
579 snd_info_set_text_ops(entry, emu, snd_emu_proc_emu1010_reg_read);
581 if (! snd_card_proc_new(emu->card, "io_regs", &entry)) {
582 snd_info_set_text_ops(entry, emu, snd_emu_proc_io_reg_read);
583 entry->c.text.write = snd_emu_proc_io_reg_write;
584 entry->mode |= S_IWUSR;
586 if (! snd_card_proc_new(emu->card, "ptr_regs00a", &entry)) {
587 snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read00a);
588 entry->c.text.write = snd_emu_proc_ptr_reg_write00;
589 entry->mode |= S_IWUSR;
591 if (! snd_card_proc_new(emu->card, "ptr_regs00b", &entry)) {
592 snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read00b);
593 entry->c.text.write = snd_emu_proc_ptr_reg_write00;
594 entry->mode |= S_IWUSR;
596 if (! snd_card_proc_new(emu->card, "ptr_regs20a", &entry)) {
597 snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read20a);
598 entry->c.text.write = snd_emu_proc_ptr_reg_write20;
599 entry->mode |= S_IWUSR;
601 if (! snd_card_proc_new(emu->card, "ptr_regs20b", &entry)) {
602 snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read20b);
603 entry->c.text.write = snd_emu_proc_ptr_reg_write20;
604 entry->mode |= S_IWUSR;
606 if (! snd_card_proc_new(emu->card, "ptr_regs20c", &entry)) {
607 snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read20c);
608 entry->c.text.write = snd_emu_proc_ptr_reg_write20;
609 entry->mode |= S_IWUSR;
611 #endif
613 if (! snd_card_proc_new(emu->card, "emu10k1", &entry))
614 snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_read);
616 if (emu->card_capabilities->emu10k2_chip) {
617 if (! snd_card_proc_new(emu->card, "spdif-in", &entry))
618 snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_spdif_read);
620 if (emu->card_capabilities->ca0151_chip) {
621 if (! snd_card_proc_new(emu->card, "capture-rates", &entry))
622 snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_rates_read);
625 if (! snd_card_proc_new(emu->card, "voices", &entry))
626 snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_voices_read);
628 if (! snd_card_proc_new(emu->card, "fx8010_gpr", &entry)) {
629 entry->content = SNDRV_INFO_CONTENT_DATA;
630 entry->private_data = emu;
631 entry->mode = S_IFREG | S_IRUGO /*| S_IWUSR*/;
632 entry->size = emu->audigy ? A_TOTAL_SIZE_GPR : TOTAL_SIZE_GPR;
633 entry->c.ops = &snd_emu10k1_proc_ops_fx8010;
635 if (! snd_card_proc_new(emu->card, "fx8010_tram_data", &entry)) {
636 entry->content = SNDRV_INFO_CONTENT_DATA;
637 entry->private_data = emu;
638 entry->mode = S_IFREG | S_IRUGO /*| S_IWUSR*/;
639 entry->size = emu->audigy ? A_TOTAL_SIZE_TANKMEM_DATA : TOTAL_SIZE_TANKMEM_DATA ;
640 entry->c.ops = &snd_emu10k1_proc_ops_fx8010;
642 if (! snd_card_proc_new(emu->card, "fx8010_tram_addr", &entry)) {
643 entry->content = SNDRV_INFO_CONTENT_DATA;
644 entry->private_data = emu;
645 entry->mode = S_IFREG | S_IRUGO /*| S_IWUSR*/;
646 entry->size = emu->audigy ? A_TOTAL_SIZE_TANKMEM_ADDR : TOTAL_SIZE_TANKMEM_ADDR ;
647 entry->c.ops = &snd_emu10k1_proc_ops_fx8010;
649 if (! snd_card_proc_new(emu->card, "fx8010_code", &entry)) {
650 entry->content = SNDRV_INFO_CONTENT_DATA;
651 entry->private_data = emu;
652 entry->mode = S_IFREG | S_IRUGO /*| S_IWUSR*/;
653 entry->size = emu->audigy ? A_TOTAL_SIZE_CODE : TOTAL_SIZE_CODE;
654 entry->c.ops = &snd_emu10k1_proc_ops_fx8010;
656 if (! snd_card_proc_new(emu->card, "fx8010_acode", &entry)) {
657 entry->content = SNDRV_INFO_CONTENT_TEXT;
658 entry->private_data = emu;
659 entry->mode = S_IFREG | S_IRUGO /*| S_IWUSR*/;
660 entry->c.text.read = snd_emu10k1_proc_acode_read;
662 return 0;
664 #endif /* CONFIG_PROC_FS */