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