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