80 struct snd_ca0106_category_str {
85 static struct snd_ca0106_category_str snd_ca0106_con_category[] = {
104 status[0] = value & 0xff;
105 status[1] = (value >> 8) & 0xff;
106 status[2] = (value >> 16) & 0xff;
107 status[3] = (value >> 24) & 0xff;
111 snd_iprintf(buffer,
"Mode: consumer\n");
112 snd_iprintf(buffer,
"Data: ");
114 snd_iprintf(buffer,
"audio\n");
116 snd_iprintf(buffer,
"non-audio\n");
118 snd_iprintf(buffer,
"Rate: ");
121 snd_iprintf(buffer,
"44100 Hz\n");
124 snd_iprintf(buffer,
"48000 Hz\n");
127 snd_iprintf(buffer,
"32000 Hz\n");
130 snd_iprintf(buffer,
"unknown\n");
133 snd_iprintf(buffer,
"Copyright: ");
135 snd_iprintf(buffer,
"permitted\n");
137 snd_iprintf(buffer,
"protected\n");
139 snd_iprintf(buffer,
"Emphasis: ");
141 snd_iprintf(buffer,
"none\n");
143 snd_iprintf(buffer,
"50/15us\n");
145 snd_iprintf(buffer,
"Category: ");
146 for (i = 0; i <
ARRAY_SIZE(snd_ca0106_con_category); i++) {
148 snd_iprintf(buffer,
"%s\n", snd_ca0106_con_category[i].
name);
152 if (i >=
ARRAY_SIZE(snd_ca0106_con_category)) {
155 snd_iprintf(buffer,
"Original: ");
157 snd_iprintf(buffer,
"original\n");
159 snd_iprintf(buffer,
"1st generation\n");
161 snd_iprintf(buffer,
"Clock: ");
164 snd_iprintf(buffer,
"1000 ppm\n");
167 snd_iprintf(buffer,
"50 ppm\n");
170 snd_iprintf(buffer,
"variable pitch\n");
173 snd_iprintf(buffer,
"unknown\n");
177 snd_iprintf(buffer,
"Mode: professional\n");
178 snd_iprintf(buffer,
"Data: ");
179 if (!(status[0] & IEC958_AES0_NONAUDIO)) {
180 snd_iprintf(buffer,
"audio\n");
182 snd_iprintf(buffer,
"non-audio\n");
184 snd_iprintf(buffer,
"Rate: ");
187 snd_iprintf(buffer,
"44100 Hz\n");
190 snd_iprintf(buffer,
"48000 Hz\n");
193 snd_iprintf(buffer,
"32000 Hz\n");
196 snd_iprintf(buffer,
"unknown\n");
199 snd_iprintf(buffer,
"Rate Locked: ");
201 snd_iprintf(buffer,
"no\n");
203 snd_iprintf(buffer,
"yes\n");
204 snd_iprintf(buffer,
"Emphasis: ");
207 snd_iprintf(buffer,
"CCITT J.17\n");
210 snd_iprintf(buffer,
"none\n");
213 snd_iprintf(buffer,
"50/15us\n");
217 snd_iprintf(buffer,
"unknown\n");
220 snd_iprintf(buffer,
"Stereophonic: ");
222 snd_iprintf(buffer,
"stereo\n");
224 snd_iprintf(buffer,
"not indicated\n");
226 snd_iprintf(buffer,
"Userbits: ");
229 snd_iprintf(buffer,
"192bit\n");
232 snd_iprintf(buffer,
"user-defined\n");
235 snd_iprintf(buffer,
"unknown\n");
238 snd_iprintf(buffer,
"Sample Bits: ");
241 snd_iprintf(buffer,
"20 bit\n");
244 snd_iprintf(buffer,
"24 bit\n");
247 snd_iprintf(buffer,
"user defined\n");
250 snd_iprintf(buffer,
"unknown\n");
253 snd_iprintf(buffer,
"Word Length: ");
256 snd_iprintf(buffer,
"22 bit or 18 bit\n");
259 snd_iprintf(buffer,
"23 bit or 19 bit\n");
262 snd_iprintf(buffer,
"24 bit or 20 bit\n");
265 snd_iprintf(buffer,
"20 bit or 16 bit\n");
268 snd_iprintf(buffer,
"unknown\n");
281 snd_iprintf(buffer,
"Status: %s, %s, %s\n",
282 (value & 0x100000) ?
"Rate Locked" :
"Not Rate Locked",
283 (value & 0x200000) ?
"SPDIF Locked" :
"No SPDIF Lock",
284 (value & 0x400000) ?
"Audio Valid" :
"No valid audio" );
285 snd_iprintf(buffer,
"Estimated sample rate: %u\n",
286 ((value & 0xfffff) * 48000) / 0x8000 );
287 if (value & 0x200000) {
288 snd_iprintf(buffer,
"IEC958/SPDIF input status:\n");
290 snd_ca0106_proc_dump_iec958(buffer, value);
293 snd_iprintf(buffer,
"\n");
296 static void snd_ca0106_proc_reg_write32(
struct snd_info_entry *entry,
303 while (!snd_info_get_line(buffer, line,
sizeof(line))) {
304 if (
sscanf(line,
"%x %x", ®, &val) != 2)
306 if (reg < 0x40 && val <= 0xffffffff) {
308 outl(val, emu->
port + (reg & 0xfffffffc));
309 spin_unlock_irqrestore(&emu->
emu_lock, flags);
314 static void snd_ca0106_proc_reg_read32(
struct snd_info_entry *entry,
321 snd_iprintf(buffer,
"Registers:\n\n");
322 for(i = 0; i < 0x20; i+=4) {
325 spin_unlock_irqrestore(&emu->
emu_lock, flags);
326 snd_iprintf(buffer,
"Register %02X: %08lX\n", i, value);
330 static void snd_ca0106_proc_reg_read16(
struct snd_info_entry *entry,
337 snd_iprintf(buffer,
"Registers:\n\n");
338 for(i = 0; i < 0x20; i+=2) {
341 spin_unlock_irqrestore(&emu->
emu_lock, flags);
342 snd_iprintf(buffer,
"Register %02X: %04X\n", i, value);
346 static void snd_ca0106_proc_reg_read8(
struct snd_info_entry *entry,
353 snd_iprintf(buffer,
"Registers:\n\n");
354 for(i = 0; i < 0x20; i+=1) {
357 spin_unlock_irqrestore(&emu->
emu_lock, flags);
358 snd_iprintf(buffer,
"Register %02X: %02X\n", i, value);
362 static void snd_ca0106_proc_reg_read1(
struct snd_info_entry *entry,
369 snd_iprintf(buffer,
"Registers\n");
370 for(i = 0; i < 0x40; i++) {
371 snd_iprintf(buffer,
"%02X: ",i);
372 for (j = 0; j < 4; j++) {
374 snd_iprintf(buffer,
"%08lX ", value);
376 snd_iprintf(buffer,
"\n");
380 static void snd_ca0106_proc_reg_read2(
struct snd_info_entry *entry,
387 snd_iprintf(buffer,
"Registers\n");
388 for(i = 0x40; i < 0x80; i++) {
389 snd_iprintf(buffer,
"%02X: ",i);
390 for (j = 0; j < 4; j++) {
392 snd_iprintf(buffer,
"%08lX ", value);
394 snd_iprintf(buffer,
"\n");
398 static void snd_ca0106_proc_reg_write(
struct snd_info_entry *entry,
403 unsigned int reg, channel_id ,
val;
404 while (!snd_info_get_line(buffer, line,
sizeof(line))) {
405 if (
sscanf(line,
"%x %x %x", ®, &channel_id, &val) != 3)
407 if (reg < 0x80 && val <= 0xffffffff && channel_id <= 3)
412 static void snd_ca0106_proc_i2c_write(
struct snd_info_entry *entry,
418 while (!snd_info_get_line(buffer, line,
sizeof(line))) {
419 if (
sscanf(line,
"%x %x", ®, &val) != 2)
421 if ((reg <= 0x7f) || (val <= 0x1ff)) {
431 if(! snd_card_proc_new(emu->
card,
"iec958", &entry))
432 snd_info_set_text_ops(entry, emu, snd_ca0106_proc_iec958);
433 if(! snd_card_proc_new(emu->
card,
"ca0106_reg32", &entry)) {
434 snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read32);
435 entry->
c.
text.write = snd_ca0106_proc_reg_write32;
438 if(! snd_card_proc_new(emu->
card,
"ca0106_reg16", &entry))
439 snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read16);
440 if(! snd_card_proc_new(emu->
card,
"ca0106_reg8", &entry))
441 snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read8);
442 if(! snd_card_proc_new(emu->
card,
"ca0106_regs1", &entry)) {
443 snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read1);
444 entry->
c.
text.write = snd_ca0106_proc_reg_write;
447 if(! snd_card_proc_new(emu->
card,
"ca0106_i2c", &entry)) {
448 entry->
c.
text.write = snd_ca0106_proc_i2c_write;
452 if(! snd_card_proc_new(emu->
card,
"ca0106_regs2", &entry))
453 snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read2);