| 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 | df34140 | 2005-04-09 16:57:09 +0200 | [diff] [blame] | 243 | 	snd_emu10k1_proc_spdif_status(emu, buffer, "CD-ROM S/PDIF In", CDCS, CDSRCS); | 
 | 244 | 	snd_emu10k1_proc_spdif_status(emu, buffer, "Optical or Coax S/PDIF In", GPSCS, GPSRCS); | 
 | 245 | #if 0 | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 246 | 	val = snd_emu10k1_ptr_read(emu, ZVSRCS, 0); | 
 | 247 | 	snd_iprintf(buffer, "\nZoomed Video\n"); | 
 | 248 | 	snd_iprintf(buffer, "Rate Locked           : %s\n", val & SRCS_RATELOCKED ? "on" : "off"); | 
 | 249 | 	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] | 250 | #endif | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 251 | } | 
 | 252 |  | 
| Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 253 | static void snd_emu10k1_proc_rates_read(struct snd_info_entry *entry,  | 
 | 254 | 				  struct snd_info_buffer *buffer) | 
| James Courtier-Dutton | 001f758 | 2005-04-09 23:38:25 +0200 | [diff] [blame] | 255 | { | 
 | 256 | 	static int samplerate[8] = { 44100, 48000, 96000, 192000, 4, 5, 6, 7 }; | 
| Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 257 | 	struct snd_emu10k1 *emu = entry->private_data; | 
| James Courtier-Dutton | 001f758 | 2005-04-09 23:38:25 +0200 | [diff] [blame] | 258 | 	unsigned int val, tmp, n; | 
 | 259 | 	val = snd_emu10k1_ptr20_read(emu, CAPTURE_RATE_STATUS, 0); | 
 | 260 | 	tmp = (val >> 16) & 0x8; | 
| James Courtier-Dutton | 9f4bd5d | 2006-10-01 10:48:04 +0100 | [diff] [blame] | 261 | 	for (n = 0; n < 4; n++) { | 
| James Courtier-Dutton | 001f758 | 2005-04-09 23:38:25 +0200 | [diff] [blame] | 262 | 		tmp = val >> (16 + (n*4)); | 
 | 263 | 		if (tmp & 0x8) snd_iprintf(buffer, "Channel %d: Rate=%d\n", n, samplerate[tmp & 0x7]); | 
 | 264 | 		else snd_iprintf(buffer, "Channel %d: No input\n", n); | 
 | 265 | 	} | 
 | 266 | } | 
 | 267 |  | 
| Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 268 | static void snd_emu10k1_proc_acode_read(struct snd_info_entry *entry,  | 
 | 269 | 				        struct snd_info_buffer *buffer) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 270 | { | 
 | 271 | 	u32 pc; | 
| Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 272 | 	struct snd_emu10k1 *emu = entry->private_data; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 273 |  | 
 | 274 | 	snd_iprintf(buffer, "FX8010 Instruction List '%s'\n", emu->fx8010.name); | 
 | 275 | 	snd_iprintf(buffer, "  Code dump      :\n"); | 
 | 276 | 	for (pc = 0; pc < (emu->audigy ? 1024 : 512); pc++) { | 
 | 277 | 		u32 low, high; | 
 | 278 | 			 | 
 | 279 | 		low = snd_emu10k1_efx_read(emu, pc * 2); | 
 | 280 | 		high = snd_emu10k1_efx_read(emu, pc * 2 + 1); | 
 | 281 | 		if (emu->audigy) | 
 | 282 | 			snd_iprintf(buffer, "    OP(0x%02x, 0x%03x, 0x%03x, 0x%03x, 0x%03x) /* 0x%04x: 0x%08x%08x */\n", | 
 | 283 | 				    (high >> 24) & 0x0f, | 
 | 284 | 				    (high >> 12) & 0x7ff, | 
 | 285 | 				    (high >> 0) & 0x7ff, | 
 | 286 | 				    (low >> 12) & 0x7ff, | 
 | 287 | 				    (low >> 0) & 0x7ff, | 
 | 288 | 				    pc, | 
 | 289 | 				    high, low); | 
 | 290 | 		else | 
 | 291 | 			snd_iprintf(buffer, "    OP(0x%02x, 0x%03x, 0x%03x, 0x%03x, 0x%03x) /* 0x%04x: 0x%08x%08x */\n", | 
 | 292 | 				    (high >> 20) & 0x0f, | 
 | 293 | 				    (high >> 10) & 0x3ff, | 
 | 294 | 				    (high >> 0) & 0x3ff, | 
 | 295 | 				    (low >> 10) & 0x3ff, | 
 | 296 | 				    (low >> 0) & 0x3ff, | 
 | 297 | 				    pc, | 
 | 298 | 				    high, low); | 
 | 299 | 	} | 
 | 300 | } | 
 | 301 |  | 
 | 302 | #define TOTAL_SIZE_GPR		(0x100*4) | 
 | 303 | #define A_TOTAL_SIZE_GPR	(0x200*4) | 
 | 304 | #define TOTAL_SIZE_TANKMEM_DATA	(0xa0*4) | 
 | 305 | #define TOTAL_SIZE_TANKMEM_ADDR (0xa0*4) | 
 | 306 | #define A_TOTAL_SIZE_TANKMEM_DATA (0x100*4) | 
 | 307 | #define A_TOTAL_SIZE_TANKMEM_ADDR (0x100*4) | 
 | 308 | #define TOTAL_SIZE_CODE		(0x200*8) | 
 | 309 | #define A_TOTAL_SIZE_CODE	(0x400*8) | 
 | 310 |  | 
| Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 311 | static long snd_emu10k1_fx8010_read(struct snd_info_entry *entry, | 
 | 312 | 				    void *file_private_data, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | 				    struct file *file, char __user *buf, | 
 | 314 | 				    unsigned long count, unsigned long pos) | 
 | 315 | { | 
 | 316 | 	long size; | 
| Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 317 | 	struct snd_emu10k1 *emu = entry->private_data; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 318 | 	unsigned int offset; | 
 | 319 | 	int tram_addr = 0; | 
 | 320 | 	 | 
 | 321 | 	if (!strcmp(entry->name, "fx8010_tram_addr")) { | 
 | 322 | 		offset = TANKMEMADDRREGBASE; | 
 | 323 | 		tram_addr = 1; | 
 | 324 | 	} else if (!strcmp(entry->name, "fx8010_tram_data")) { | 
 | 325 | 		offset = TANKMEMDATAREGBASE; | 
 | 326 | 	} else if (!strcmp(entry->name, "fx8010_code")) { | 
 | 327 | 		offset = emu->audigy ? A_MICROCODEBASE : MICROCODEBASE; | 
 | 328 | 	} else { | 
 | 329 | 		offset = emu->audigy ? A_FXGPREGBASE : FXGPREGBASE; | 
 | 330 | 	} | 
 | 331 | 	size = count; | 
 | 332 | 	if (pos + size > entry->size) | 
 | 333 | 		size = (long)entry->size - pos; | 
 | 334 | 	if (size > 0) { | 
 | 335 | 		unsigned int *tmp; | 
 | 336 | 		long res; | 
 | 337 | 		unsigned int idx; | 
 | 338 | 		if ((tmp = kmalloc(size + 8, GFP_KERNEL)) == NULL) | 
 | 339 | 			return -ENOMEM; | 
 | 340 | 		for (idx = 0; idx < ((pos & 3) + size + 3) >> 2; idx++) | 
 | 341 | 			if (tram_addr && emu->audigy) { | 
 | 342 | 				tmp[idx] = snd_emu10k1_ptr_read(emu, offset + idx + (pos >> 2), 0) >> 11; | 
 | 343 | 				tmp[idx] |= snd_emu10k1_ptr_read(emu, 0x100 + idx + (pos >> 2), 0) << 20; | 
 | 344 | 			} else  | 
 | 345 | 				tmp[idx] = snd_emu10k1_ptr_read(emu, offset + idx + (pos >> 2), 0); | 
 | 346 | 		if (copy_to_user(buf, ((char *)tmp) + (pos & 3), size)) | 
 | 347 | 			res = -EFAULT; | 
 | 348 | 		else { | 
 | 349 | 			res = size; | 
 | 350 | 		} | 
 | 351 | 		kfree(tmp); | 
 | 352 | 		return res; | 
 | 353 | 	} | 
 | 354 | 	return 0; | 
 | 355 | } | 
 | 356 |  | 
| Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 357 | static void snd_emu10k1_proc_voices_read(struct snd_info_entry *entry,  | 
 | 358 | 				  struct snd_info_buffer *buffer) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 359 | { | 
| Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 360 | 	struct snd_emu10k1 *emu = entry->private_data; | 
 | 361 | 	struct snd_emu10k1_voice *voice; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 362 | 	int idx; | 
 | 363 | 	 | 
 | 364 | 	snd_iprintf(buffer, "ch\tuse\tpcm\tefx\tsynth\tmidi\n"); | 
 | 365 | 	for (idx = 0; idx < NUM_G; idx++) { | 
 | 366 | 		voice = &emu->voices[idx]; | 
 | 367 | 		snd_iprintf(buffer, "%i\t%i\t%i\t%i\t%i\t%i\n", | 
 | 368 | 			idx, | 
 | 369 | 			voice->use, | 
 | 370 | 			voice->pcm, | 
 | 371 | 			voice->efx, | 
 | 372 | 			voice->synth, | 
 | 373 | 			voice->midi); | 
 | 374 | 	} | 
 | 375 | } | 
 | 376 |  | 
 | 377 | #ifdef CONFIG_SND_DEBUG | 
| James Courtier-Dutton | 9f4bd5d | 2006-10-01 10:48:04 +0100 | [diff] [blame] | 378 | static void snd_emu_proc_emu1010_reg_read(struct snd_info_entry *entry, | 
 | 379 | 				     struct snd_info_buffer *buffer) | 
 | 380 | { | 
 | 381 | 	struct snd_emu10k1 *emu = entry->private_data; | 
 | 382 | 	unsigned long value; | 
 | 383 | 	unsigned long flags; | 
 | 384 | 	unsigned long regs; | 
 | 385 | 	int i; | 
 | 386 | 	snd_iprintf(buffer, "EMU1010 Registers:\n\n"); | 
 | 387 |  | 
 | 388 | 	for(i = 0; i < 0x30; i+=1) { | 
 | 389 | 		spin_lock_irqsave(&emu->emu_lock, flags); | 
 | 390 | 		regs=i+0x40; /* 0x40 upwards are registers. */ | 
 | 391 | 		outl(regs, emu->port + A_IOCFG); | 
 | 392 | 		outl(regs | 0x80, emu->port + A_IOCFG);  /* High bit clocks the value into the fpga. */ | 
 | 393 | 		value = inl(emu->port + A_IOCFG); | 
 | 394 | 		spin_unlock_irqrestore(&emu->emu_lock, flags); | 
 | 395 | 		snd_iprintf(buffer, "%02X: %08lX, %02lX\n", i, value, (value >> 8) & 0x7f); | 
 | 396 | 	} | 
 | 397 | } | 
 | 398 |  | 
| Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 399 | static void snd_emu_proc_io_reg_read(struct snd_info_entry *entry, | 
 | 400 | 				     struct snd_info_buffer *buffer) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 401 | { | 
| Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 402 | 	struct snd_emu10k1 *emu = entry->private_data; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 403 | 	unsigned long value; | 
 | 404 | 	unsigned long flags; | 
 | 405 | 	int i; | 
 | 406 | 	snd_iprintf(buffer, "IO Registers:\n\n"); | 
 | 407 | 	for(i = 0; i < 0x40; i+=4) { | 
 | 408 | 		spin_lock_irqsave(&emu->emu_lock, flags); | 
 | 409 | 		value = inl(emu->port + i); | 
 | 410 | 		spin_unlock_irqrestore(&emu->emu_lock, flags); | 
 | 411 | 		snd_iprintf(buffer, "%02X: %08lX\n", i, value); | 
 | 412 | 	} | 
 | 413 | } | 
 | 414 |  | 
| Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 415 | static void snd_emu_proc_io_reg_write(struct snd_info_entry *entry, | 
 | 416 |                                       struct snd_info_buffer *buffer) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 417 | { | 
| Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 418 | 	struct snd_emu10k1 *emu = entry->private_data; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 419 | 	unsigned long flags; | 
 | 420 | 	char line[64]; | 
 | 421 | 	u32 reg, val; | 
 | 422 | 	while (!snd_info_get_line(buffer, line, sizeof(line))) { | 
 | 423 | 		if (sscanf(line, "%x %x", ®, &val) != 2) | 
 | 424 | 			continue; | 
| James Courtier-Dutton | 9f4bd5d | 2006-10-01 10:48:04 +0100 | [diff] [blame] | 425 | 		if ((reg < 0x40) && (reg >= 0) && (val <= 0xffffffff) ) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 426 | 			spin_lock_irqsave(&emu->emu_lock, flags); | 
 | 427 | 			outl(val, emu->port + (reg & 0xfffffffc)); | 
 | 428 | 			spin_unlock_irqrestore(&emu->emu_lock, flags); | 
 | 429 | 		} | 
 | 430 | 	} | 
 | 431 | } | 
 | 432 |  | 
| Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 433 | static unsigned int snd_ptr_read(struct snd_emu10k1 * emu, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 434 | 				 unsigned int iobase, | 
 | 435 | 				 unsigned int reg, | 
 | 436 | 				 unsigned int chn) | 
 | 437 | { | 
 | 438 | 	unsigned long flags; | 
 | 439 | 	unsigned int regptr, val; | 
 | 440 |  | 
 | 441 | 	regptr = (reg << 16) | chn; | 
 | 442 |  | 
 | 443 | 	spin_lock_irqsave(&emu->emu_lock, flags); | 
 | 444 | 	outl(regptr, emu->port + iobase + PTR); | 
 | 445 | 	val = inl(emu->port + iobase + DATA); | 
 | 446 | 	spin_unlock_irqrestore(&emu->emu_lock, flags); | 
 | 447 | 	return val; | 
 | 448 | } | 
 | 449 |  | 
| Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 450 | static void snd_ptr_write(struct snd_emu10k1 *emu, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 451 | 			  unsigned int iobase, | 
 | 452 | 			  unsigned int reg, | 
 | 453 | 			  unsigned int chn, | 
 | 454 | 			  unsigned int data) | 
 | 455 | { | 
 | 456 | 	unsigned int regptr; | 
 | 457 | 	unsigned long flags; | 
 | 458 |  | 
 | 459 | 	regptr = (reg << 16) | chn; | 
 | 460 |  | 
 | 461 | 	spin_lock_irqsave(&emu->emu_lock, flags); | 
 | 462 | 	outl(regptr, emu->port + iobase + PTR); | 
 | 463 | 	outl(data, emu->port + iobase + DATA); | 
 | 464 | 	spin_unlock_irqrestore(&emu->emu_lock, flags); | 
 | 465 | } | 
 | 466 |  | 
 | 467 |  | 
| Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 468 | static void snd_emu_proc_ptr_reg_read(struct snd_info_entry *entry, | 
 | 469 | 				      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] | 470 | { | 
| Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 471 | 	struct snd_emu10k1 *emu = entry->private_data; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 472 | 	unsigned long value; | 
 | 473 | 	int i,j; | 
| James Courtier-Dutton | 6ef7e86 | 2005-11-11 23:45:23 +0100 | [diff] [blame] | 474 | 	if (offset+length > 0xa0) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 475 | 		snd_iprintf(buffer, "Input values out of range\n"); | 
 | 476 | 		return; | 
 | 477 | 	} | 
 | 478 | 	snd_iprintf(buffer, "Registers 0x%x\n", iobase); | 
 | 479 | 	for(i = offset; i < offset+length; i++) { | 
 | 480 | 		snd_iprintf(buffer, "%02X: ",i); | 
 | 481 | 		for (j = 0; j < voices; j++) { | 
 | 482 | 			if(iobase == 0) | 
 | 483 |                 		value = snd_ptr_read(emu, 0, i, j); | 
 | 484 | 			else | 
 | 485 |                 		value = snd_ptr_read(emu, 0x20, i, j); | 
 | 486 | 			snd_iprintf(buffer, "%08lX ", value); | 
 | 487 | 		} | 
 | 488 | 		snd_iprintf(buffer, "\n"); | 
 | 489 | 	} | 
 | 490 | } | 
 | 491 |  | 
| Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 492 | static void snd_emu_proc_ptr_reg_write(struct snd_info_entry *entry, | 
 | 493 | 				       struct snd_info_buffer *buffer, int iobase) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 494 | { | 
| Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 495 | 	struct snd_emu10k1 *emu = entry->private_data; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 496 | 	char line[64]; | 
 | 497 | 	unsigned int reg, channel_id , val; | 
 | 498 | 	while (!snd_info_get_line(buffer, line, sizeof(line))) { | 
 | 499 | 		if (sscanf(line, "%x %x %x", ®, &channel_id, &val) != 3) | 
 | 500 | 			continue; | 
| James Courtier-Dutton | 9f4bd5d | 2006-10-01 10:48:04 +0100 | [diff] [blame] | 501 | 		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] | 502 | 			snd_ptr_write(emu, iobase, reg, channel_id, val); | 
 | 503 | 	} | 
 | 504 | } | 
 | 505 |  | 
| Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 506 | static void snd_emu_proc_ptr_reg_write00(struct snd_info_entry *entry, | 
 | 507 | 					 struct snd_info_buffer *buffer) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 508 | { | 
 | 509 | 	snd_emu_proc_ptr_reg_write(entry, buffer, 0); | 
 | 510 | } | 
 | 511 |  | 
| Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 512 | static void snd_emu_proc_ptr_reg_write20(struct snd_info_entry *entry, | 
 | 513 | 					 struct snd_info_buffer *buffer) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 514 | { | 
 | 515 | 	snd_emu_proc_ptr_reg_write(entry, buffer, 0x20); | 
 | 516 | } | 
 | 517 | 	 | 
 | 518 |  | 
| Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 519 | static void snd_emu_proc_ptr_reg_read00a(struct snd_info_entry *entry, | 
 | 520 | 					 struct snd_info_buffer *buffer) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 521 | { | 
 | 522 | 	snd_emu_proc_ptr_reg_read(entry, buffer, 0, 0, 0x40, 64); | 
 | 523 | } | 
 | 524 |  | 
| Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 525 | static void snd_emu_proc_ptr_reg_read00b(struct snd_info_entry *entry, | 
 | 526 | 					 struct snd_info_buffer *buffer) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 527 | { | 
 | 528 | 	snd_emu_proc_ptr_reg_read(entry, buffer, 0, 0x40, 0x40, 64); | 
 | 529 | } | 
 | 530 |  | 
| Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 531 | static void snd_emu_proc_ptr_reg_read20a(struct snd_info_entry *entry, | 
 | 532 | 					 struct snd_info_buffer *buffer) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 533 | { | 
 | 534 | 	snd_emu_proc_ptr_reg_read(entry, buffer, 0x20, 0, 0x40, 4); | 
 | 535 | } | 
 | 536 |  | 
| Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 537 | static void snd_emu_proc_ptr_reg_read20b(struct snd_info_entry *entry, | 
 | 538 | 					 struct snd_info_buffer *buffer) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 539 | { | 
 | 540 | 	snd_emu_proc_ptr_reg_read(entry, buffer, 0x20, 0x40, 0x40, 4); | 
 | 541 | } | 
| James Courtier-Dutton | 6ef7e86 | 2005-11-11 23:45:23 +0100 | [diff] [blame] | 542 |  | 
| Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 543 | static void snd_emu_proc_ptr_reg_read20c(struct snd_info_entry *entry, | 
 | 544 | 					 struct snd_info_buffer * buffer) | 
| James Courtier-Dutton | 6ef7e86 | 2005-11-11 23:45:23 +0100 | [diff] [blame] | 545 | { | 
 | 546 | 	snd_emu_proc_ptr_reg_read(entry, buffer, 0x20, 0x80, 0x20, 4); | 
 | 547 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 548 | #endif | 
 | 549 |  | 
 | 550 | static struct snd_info_entry_ops snd_emu10k1_proc_ops_fx8010 = { | 
 | 551 | 	.read = snd_emu10k1_fx8010_read, | 
 | 552 | }; | 
 | 553 |  | 
| Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 554 | int __devinit snd_emu10k1_proc_init(struct snd_emu10k1 * emu) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 555 | { | 
| Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 556 | 	struct snd_info_entry *entry; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 557 | #ifdef CONFIG_SND_DEBUG | 
| James Courtier-Dutton | 9f4bd5d | 2006-10-01 10:48:04 +0100 | [diff] [blame] | 558 | 	if ((emu->card_capabilities->emu1010) && | 
 | 559 | 	     snd_card_proc_new(emu->card, "emu1010_regs", &entry)) { | 
 | 560 | 		snd_info_set_text_ops(entry, emu, snd_emu_proc_emu1010_reg_read); | 
 | 561 | 	} | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 562 | 	if (! snd_card_proc_new(emu->card, "io_regs", &entry)) { | 
| Takashi Iwai | bf85020 | 2006-04-28 15:13:41 +0200 | [diff] [blame] | 563 | 		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] | 564 | 		entry->c.text.write = snd_emu_proc_io_reg_write; | 
| Takashi Iwai | bd7bf04 | 2005-04-12 16:27:28 +0200 | [diff] [blame] | 565 | 		entry->mode |= S_IWUSR; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 566 | 	} | 
 | 567 | 	if (! snd_card_proc_new(emu->card, "ptr_regs00a", &entry)) { | 
| Takashi Iwai | bf85020 | 2006-04-28 15:13:41 +0200 | [diff] [blame] | 568 | 		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] | 569 | 		entry->c.text.write = snd_emu_proc_ptr_reg_write00; | 
| Takashi Iwai | bd7bf04 | 2005-04-12 16:27:28 +0200 | [diff] [blame] | 570 | 		entry->mode |= S_IWUSR; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 571 | 	} | 
 | 572 | 	if (! snd_card_proc_new(emu->card, "ptr_regs00b", &entry)) { | 
| Takashi Iwai | bf85020 | 2006-04-28 15:13:41 +0200 | [diff] [blame] | 573 | 		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] | 574 | 		entry->c.text.write = snd_emu_proc_ptr_reg_write00; | 
| Takashi Iwai | bd7bf04 | 2005-04-12 16:27:28 +0200 | [diff] [blame] | 575 | 		entry->mode |= S_IWUSR; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 576 | 	} | 
 | 577 | 	if (! snd_card_proc_new(emu->card, "ptr_regs20a", &entry)) { | 
| Takashi Iwai | bf85020 | 2006-04-28 15:13:41 +0200 | [diff] [blame] | 578 | 		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] | 579 | 		entry->c.text.write = snd_emu_proc_ptr_reg_write20; | 
| Takashi Iwai | bd7bf04 | 2005-04-12 16:27:28 +0200 | [diff] [blame] | 580 | 		entry->mode |= S_IWUSR; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 581 | 	} | 
 | 582 | 	if (! snd_card_proc_new(emu->card, "ptr_regs20b", &entry)) { | 
| Takashi Iwai | bf85020 | 2006-04-28 15:13:41 +0200 | [diff] [blame] | 583 | 		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] | 584 | 		entry->c.text.write = snd_emu_proc_ptr_reg_write20; | 
| Takashi Iwai | bd7bf04 | 2005-04-12 16:27:28 +0200 | [diff] [blame] | 585 | 		entry->mode |= S_IWUSR; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 586 | 	} | 
| James Courtier-Dutton | 6ef7e86 | 2005-11-11 23:45:23 +0100 | [diff] [blame] | 587 | 	if (! snd_card_proc_new(emu->card, "ptr_regs20c", &entry)) { | 
| Takashi Iwai | bf85020 | 2006-04-28 15:13:41 +0200 | [diff] [blame] | 588 | 		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] | 589 | 		entry->c.text.write = snd_emu_proc_ptr_reg_write20; | 
 | 590 | 		entry->mode |= S_IWUSR; | 
 | 591 | 	} | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 592 | #endif | 
 | 593 | 	 | 
 | 594 | 	if (! snd_card_proc_new(emu->card, "emu10k1", &entry)) | 
| Takashi Iwai | bf85020 | 2006-04-28 15:13:41 +0200 | [diff] [blame] | 595 | 		snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_read); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 596 |  | 
| James Courtier-Dutton | df34140 | 2005-04-09 16:57:09 +0200 | [diff] [blame] | 597 | 	if (emu->card_capabilities->emu10k2_chip) { | 
 | 598 | 		if (! snd_card_proc_new(emu->card, "spdif-in", &entry)) | 
| Takashi Iwai | bf85020 | 2006-04-28 15:13:41 +0200 | [diff] [blame] | 599 | 			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] | 600 | 	} | 
| James Courtier-Dutton | 001f758 | 2005-04-09 23:38:25 +0200 | [diff] [blame] | 601 | 	if (emu->card_capabilities->ca0151_chip) { | 
 | 602 | 		if (! snd_card_proc_new(emu->card, "capture-rates", &entry)) | 
| Takashi Iwai | bf85020 | 2006-04-28 15:13:41 +0200 | [diff] [blame] | 603 | 			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] | 604 | 	} | 
| James Courtier-Dutton | df34140 | 2005-04-09 16:57:09 +0200 | [diff] [blame] | 605 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 606 | 	if (! snd_card_proc_new(emu->card, "voices", &entry)) | 
| Takashi Iwai | bf85020 | 2006-04-28 15:13:41 +0200 | [diff] [blame] | 607 | 		snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_voices_read); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 608 |  | 
 | 609 | 	if (! snd_card_proc_new(emu->card, "fx8010_gpr", &entry)) { | 
 | 610 | 		entry->content = SNDRV_INFO_CONTENT_DATA; | 
 | 611 | 		entry->private_data = emu; | 
 | 612 | 		entry->mode = S_IFREG | S_IRUGO /*| S_IWUSR*/; | 
 | 613 | 		entry->size = emu->audigy ? A_TOTAL_SIZE_GPR : TOTAL_SIZE_GPR; | 
 | 614 | 		entry->c.ops = &snd_emu10k1_proc_ops_fx8010; | 
 | 615 | 	} | 
 | 616 | 	if (! snd_card_proc_new(emu->card, "fx8010_tram_data", &entry)) { | 
 | 617 | 		entry->content = SNDRV_INFO_CONTENT_DATA; | 
 | 618 | 		entry->private_data = emu; | 
 | 619 | 		entry->mode = S_IFREG | S_IRUGO /*| S_IWUSR*/; | 
 | 620 | 		entry->size = emu->audigy ? A_TOTAL_SIZE_TANKMEM_DATA : TOTAL_SIZE_TANKMEM_DATA ; | 
 | 621 | 		entry->c.ops = &snd_emu10k1_proc_ops_fx8010; | 
 | 622 | 	} | 
 | 623 | 	if (! snd_card_proc_new(emu->card, "fx8010_tram_addr", &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_TANKMEM_ADDR : TOTAL_SIZE_TANKMEM_ADDR ; | 
 | 628 | 		entry->c.ops = &snd_emu10k1_proc_ops_fx8010; | 
 | 629 | 	} | 
 | 630 | 	if (! snd_card_proc_new(emu->card, "fx8010_code", &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_CODE : TOTAL_SIZE_CODE; | 
 | 635 | 		entry->c.ops = &snd_emu10k1_proc_ops_fx8010; | 
 | 636 | 	} | 
 | 637 | 	if (! snd_card_proc_new(emu->card, "fx8010_acode", &entry)) { | 
 | 638 | 		entry->content = SNDRV_INFO_CONTENT_TEXT; | 
 | 639 | 		entry->private_data = emu; | 
 | 640 | 		entry->mode = S_IFREG | S_IRUGO /*| S_IWUSR*/; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 641 | 		entry->c.text.read = snd_emu10k1_proc_acode_read; | 
 | 642 | 	} | 
 | 643 | 	return 0; | 
 | 644 | } | 
| Takashi Iwai | adf1b3d | 2005-12-01 10:49:58 +0100 | [diff] [blame] | 645 | #endif /* CONFIG_PROC_FS */ |