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