Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *  Copyright (c) 2004 James Courtier-Dutton <James@superbug.demon.co.uk>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *  Driver CA0106 chips. e.g. Sound Blaster Audigy LS and Live 24bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *  Version: 0.0.18
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *  FEATURES currently supported:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *    See ca0106_main.c for features.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  *  Changelog:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  *    Support interrupts per period.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  *    Removed noise from Center/LFE channel when in Analog mode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  *    Rename and remove mixer controls.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  *  0.0.6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  *    Use separate card based DMA buffer for periods table list.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  *  0.0.7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  *    Change remove and rename ctrls into lists.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  *  0.0.8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  *    Try to fix capture sources.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  *  0.0.9
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  *    Fix AC3 output.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  *    Enable S32_LE format support.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  *  0.0.10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  *    Enable playback 48000 and 96000 rates. (Rates other that these do not work, even with "plug:front".)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  *  0.0.11
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  *    Add Model name recognition.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  *  0.0.12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  *    Correct interrupt timing. interrupt at end of period, instead of in the middle of a playback period.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  *    Remove redundent "voice" handling.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  *  0.0.13
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  *    Single trigger call for multi channels.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  *  0.0.14
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  *    Set limits based on what the sound card hardware can do.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)  *    playback periods_min=2, periods_max=8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)  *    capture hw constraints require period_size = n * 64 bytes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)  *    playback hw constraints require period_size = n * 64 bytes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)  *  0.0.15
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38)  *    Separate ca0106.c into separate functional .c files.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)  *  0.0.16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  *    Modified Copyright message.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)  *  0.0.17
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42)  *    Add iec958 file in proc file system to show status of SPDIF in.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43)  *  0.0.18
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44)  *    Implement support for Line-in capture on SB Live 24bit.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46)  *  This code was initially based on code from ALSA's emu10k1x.c which is:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47)  *  Copyright (c) by Francisco Moraes <fmoraes@nc.rr.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) #include <linux/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) #include <linux/moduleparam.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) #include <sound/core.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) #include <sound/initval.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) #include <sound/pcm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) #include <sound/ac97_codec.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) #include <sound/info.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) #include <sound/asoundef.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) #include "ca0106.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) struct snd_ca0106_category_str {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	int val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	const char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) static const struct snd_ca0106_category_str snd_ca0106_con_category[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	{ IEC958_AES1_CON_DAT, "DAT" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	{ IEC958_AES1_CON_VCR, "VCR" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	{ IEC958_AES1_CON_MICROPHONE, "microphone" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	{ IEC958_AES1_CON_SYNTHESIZER, "synthesizer" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	{ IEC958_AES1_CON_RATE_CONVERTER, "rate converter" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	{ IEC958_AES1_CON_MIXER, "mixer" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	{ IEC958_AES1_CON_SAMPLER, "sampler" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	{ IEC958_AES1_CON_PCM_CODER, "PCM coder" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	{ IEC958_AES1_CON_IEC908_CD, "CD" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	{ IEC958_AES1_CON_NON_IEC908_CD, "non-IEC908 CD" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	{ IEC958_AES1_CON_GENERAL, "general" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) static void snd_ca0106_proc_dump_iec958( struct snd_info_buffer *buffer, u32 value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	u32 status[4];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	status[0] = value & 0xff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	status[1] = (value >> 8) & 0xff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	status[2] = (value >> 16)  & 0xff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	status[3] = (value >> 24)  & 0xff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	if (! (status[0] & IEC958_AES0_PROFESSIONAL)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 		/* consumer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 		snd_iprintf(buffer, "Mode: consumer\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 		snd_iprintf(buffer, "Data: ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 		if (!(status[0] & IEC958_AES0_NONAUDIO)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 			snd_iprintf(buffer, "audio\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 			snd_iprintf(buffer, "non-audio\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 		snd_iprintf(buffer, "Rate: ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 		switch (status[3] & IEC958_AES3_CON_FS) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 		case IEC958_AES3_CON_FS_44100:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 			snd_iprintf(buffer, "44100 Hz\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 		case IEC958_AES3_CON_FS_48000:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 			snd_iprintf(buffer, "48000 Hz\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 		case IEC958_AES3_CON_FS_32000:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 			snd_iprintf(buffer, "32000 Hz\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 		default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 			snd_iprintf(buffer, "unknown\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 		snd_iprintf(buffer, "Copyright: ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 		if (status[0] & IEC958_AES0_CON_NOT_COPYRIGHT) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 			snd_iprintf(buffer, "permitted\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 			snd_iprintf(buffer, "protected\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 		snd_iprintf(buffer, "Emphasis: ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 		if ((status[0] & IEC958_AES0_CON_EMPHASIS) != IEC958_AES0_CON_EMPHASIS_5015) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 			snd_iprintf(buffer, "none\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 			snd_iprintf(buffer, "50/15us\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 		snd_iprintf(buffer, "Category: ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 		for (i = 0; i < ARRAY_SIZE(snd_ca0106_con_category); i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 			if ((status[1] & IEC958_AES1_CON_CATEGORY) == snd_ca0106_con_category[i].val) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 				snd_iprintf(buffer, "%s\n", snd_ca0106_con_category[i].name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 		if (i >= ARRAY_SIZE(snd_ca0106_con_category)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 			snd_iprintf(buffer, "unknown 0x%x\n", status[1] & IEC958_AES1_CON_CATEGORY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 		snd_iprintf(buffer, "Original: ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 		if (status[1] & IEC958_AES1_CON_ORIGINAL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 			snd_iprintf(buffer, "original\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 			snd_iprintf(buffer, "1st generation\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 		snd_iprintf(buffer, "Clock: ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 		switch (status[3] & IEC958_AES3_CON_CLOCK) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 		case IEC958_AES3_CON_CLOCK_1000PPM:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 			snd_iprintf(buffer, "1000 ppm\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 		case IEC958_AES3_CON_CLOCK_50PPM:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 			snd_iprintf(buffer, "50 ppm\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 		case IEC958_AES3_CON_CLOCK_VARIABLE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 			snd_iprintf(buffer, "variable pitch\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 		default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 			snd_iprintf(buffer, "unknown\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 		snd_iprintf(buffer, "Mode: professional\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 		snd_iprintf(buffer, "Data: ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 		if (!(status[0] & IEC958_AES0_NONAUDIO)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 			snd_iprintf(buffer, "audio\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 			snd_iprintf(buffer, "non-audio\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 		snd_iprintf(buffer, "Rate: ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 		switch (status[0] & IEC958_AES0_PRO_FS) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 		case IEC958_AES0_PRO_FS_44100:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 			snd_iprintf(buffer, "44100 Hz\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 		case IEC958_AES0_PRO_FS_48000:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 			snd_iprintf(buffer, "48000 Hz\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 		case IEC958_AES0_PRO_FS_32000:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 			snd_iprintf(buffer, "32000 Hz\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 		default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 			snd_iprintf(buffer, "unknown\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 		snd_iprintf(buffer, "Rate Locked: ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 		if (status[0] & IEC958_AES0_PRO_FREQ_UNLOCKED)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 			snd_iprintf(buffer, "no\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 		else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 			snd_iprintf(buffer, "yes\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 		snd_iprintf(buffer, "Emphasis: ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 		switch (status[0] & IEC958_AES0_PRO_EMPHASIS) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 		case IEC958_AES0_PRO_EMPHASIS_CCITT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 			snd_iprintf(buffer, "CCITT J.17\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 		case IEC958_AES0_PRO_EMPHASIS_NONE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 			snd_iprintf(buffer, "none\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 		case IEC958_AES0_PRO_EMPHASIS_5015:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 			snd_iprintf(buffer, "50/15us\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 		case IEC958_AES0_PRO_EMPHASIS_NOTID:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 		default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 			snd_iprintf(buffer, "unknown\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 		snd_iprintf(buffer, "Stereophonic: ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 		if ((status[1] & IEC958_AES1_PRO_MODE) == IEC958_AES1_PRO_MODE_STEREOPHONIC) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 			snd_iprintf(buffer, "stereo\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 			snd_iprintf(buffer, "not indicated\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 		snd_iprintf(buffer, "Userbits: ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 		switch (status[1] & IEC958_AES1_PRO_USERBITS) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 		case IEC958_AES1_PRO_USERBITS_192:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 			snd_iprintf(buffer, "192bit\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 		case IEC958_AES1_PRO_USERBITS_UDEF:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 			snd_iprintf(buffer, "user-defined\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 		default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 			snd_iprintf(buffer, "unknown\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 		snd_iprintf(buffer, "Sample Bits: ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 		switch (status[2] & IEC958_AES2_PRO_SBITS) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 		case IEC958_AES2_PRO_SBITS_20:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 			snd_iprintf(buffer, "20 bit\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 		case IEC958_AES2_PRO_SBITS_24:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 			snd_iprintf(buffer, "24 bit\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 		case IEC958_AES2_PRO_SBITS_UDEF:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 			snd_iprintf(buffer, "user defined\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 		default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 			snd_iprintf(buffer, "unknown\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 		snd_iprintf(buffer, "Word Length: ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 		switch (status[2] & IEC958_AES2_PRO_WORDLEN) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 		case IEC958_AES2_PRO_WORDLEN_22_18:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 			snd_iprintf(buffer, "22 bit or 18 bit\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 		case IEC958_AES2_PRO_WORDLEN_23_19:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 			snd_iprintf(buffer, "23 bit or 19 bit\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 		case IEC958_AES2_PRO_WORDLEN_24_20:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 			snd_iprintf(buffer, "24 bit or 20 bit\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 		case IEC958_AES2_PRO_WORDLEN_20_16:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 			snd_iprintf(buffer, "20 bit or 16 bit\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 		default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 			snd_iprintf(buffer, "unknown\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) static void snd_ca0106_proc_iec958(struct snd_info_entry *entry, 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 				       struct snd_info_buffer *buffer)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	struct snd_ca0106 *emu = entry->private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 	u32 value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)         value = snd_ca0106_ptr_read(emu, SAMPLE_RATE_TRACKER_STATUS, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 	snd_iprintf(buffer, "Status: %s, %s, %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 		  (value & 0x100000) ? "Rate Locked" : "Not Rate Locked",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 		  (value & 0x200000) ? "SPDIF Locked" : "No SPDIF Lock",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 		  (value & 0x400000) ? "Audio Valid" : "No valid audio" );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 	snd_iprintf(buffer, "Estimated sample rate: %u\n", 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 		  ((value & 0xfffff) * 48000) / 0x8000 );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 	if (value & 0x200000) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 		snd_iprintf(buffer, "IEC958/SPDIF input status:\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273)         	value = snd_ca0106_ptr_read(emu, SPDIF_INPUT_STATUS, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 		snd_ca0106_proc_dump_iec958(buffer, value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 	snd_iprintf(buffer, "\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) static void snd_ca0106_proc_reg_write32(struct snd_info_entry *entry, 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 				       struct snd_info_buffer *buffer)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 	struct snd_ca0106 *emu = entry->private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 	unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)         char line[64];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286)         u32 reg, val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)         while (!snd_info_get_line(buffer, line, sizeof(line))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288)                 if (sscanf(line, "%x %x", &reg, &val) != 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289)                         continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 		if (reg < 0x40 && val <= 0xffffffff) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 			spin_lock_irqsave(&emu->emu_lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 			outl(val, emu->port + (reg & 0xfffffffc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 			spin_unlock_irqrestore(&emu->emu_lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295)         }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) static void snd_ca0106_proc_reg_read32(struct snd_info_entry *entry, 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 				       struct snd_info_buffer *buffer)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 	struct snd_ca0106 *emu = entry->private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 	unsigned long value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 	unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 	int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 	snd_iprintf(buffer, "Registers:\n\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 	for(i = 0; i < 0x20; i+=4) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 		spin_lock_irqsave(&emu->emu_lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 		value = inl(emu->port + i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 		spin_unlock_irqrestore(&emu->emu_lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 		snd_iprintf(buffer, "Register %02X: %08lX\n", i, value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) static void snd_ca0106_proc_reg_read16(struct snd_info_entry *entry, 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 				       struct snd_info_buffer *buffer)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 	struct snd_ca0106 *emu = entry->private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318)         unsigned int value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 	unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 	int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 	snd_iprintf(buffer, "Registers:\n\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 	for(i = 0; i < 0x20; i+=2) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 		spin_lock_irqsave(&emu->emu_lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 		value = inw(emu->port + i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 		spin_unlock_irqrestore(&emu->emu_lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 		snd_iprintf(buffer, "Register %02X: %04X\n", i, value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) static void snd_ca0106_proc_reg_read8(struct snd_info_entry *entry, 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 				       struct snd_info_buffer *buffer)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 	struct snd_ca0106 *emu = entry->private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 	unsigned int value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 	unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 	int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 	snd_iprintf(buffer, "Registers:\n\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 	for(i = 0; i < 0x20; i+=1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 		spin_lock_irqsave(&emu->emu_lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 		value = inb(emu->port + i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 		spin_unlock_irqrestore(&emu->emu_lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 		snd_iprintf(buffer, "Register %02X: %02X\n", i, value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) static void snd_ca0106_proc_reg_read1(struct snd_info_entry *entry, 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 				       struct snd_info_buffer *buffer)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 	struct snd_ca0106 *emu = entry->private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 	unsigned long value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 	int i,j;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 	snd_iprintf(buffer, "Registers\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 	for(i = 0; i < 0x40; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 		snd_iprintf(buffer, "%02X: ",i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 		for (j = 0; j < 4; j++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357)                   value = snd_ca0106_ptr_read(emu, i, j);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 		  snd_iprintf(buffer, "%08lX ", value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359)                 }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 	        snd_iprintf(buffer, "\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) static void snd_ca0106_proc_reg_read2(struct snd_info_entry *entry, 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 				       struct snd_info_buffer *buffer)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 	struct snd_ca0106 *emu = entry->private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 	unsigned long value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 	int i,j;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 	snd_iprintf(buffer, "Registers\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 	for(i = 0x40; i < 0x80; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 		snd_iprintf(buffer, "%02X: ",i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) 		for (j = 0; j < 4; j++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375)                   value = snd_ca0106_ptr_read(emu, i, j);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) 		  snd_iprintf(buffer, "%08lX ", value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377)                 }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) 	        snd_iprintf(buffer, "\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) static void snd_ca0106_proc_reg_write(struct snd_info_entry *entry, 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 				       struct snd_info_buffer *buffer)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 	struct snd_ca0106 *emu = entry->private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386)         char line[64];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387)         unsigned int reg, channel_id , val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388)         while (!snd_info_get_line(buffer, line, sizeof(line))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389)                 if (sscanf(line, "%x %x %x", &reg, &channel_id, &val) != 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390)                         continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 		if (reg < 0x80 && val <= 0xffffffff && channel_id <= 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392)                         snd_ca0106_ptr_write(emu, reg, channel_id, val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393)         }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) static void snd_ca0106_proc_i2c_write(struct snd_info_entry *entry, 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 				       struct snd_info_buffer *buffer)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) 	struct snd_ca0106 *emu = entry->private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400)         char line[64];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401)         unsigned int reg, val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402)         while (!snd_info_get_line(buffer, line, sizeof(line))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403)                 if (sscanf(line, "%x %x", &reg, &val) != 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404)                         continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405)                 if ((reg <= 0x7f) || (val <= 0x1ff)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406)                         snd_ca0106_i2c_write(emu, reg, val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408)         }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) int snd_ca0106_proc_init(struct snd_ca0106 *emu)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 	snd_card_ro_proc_new(emu->card, "iec958", emu, snd_ca0106_proc_iec958);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 	snd_card_rw_proc_new(emu->card, "ca0106_reg32", emu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 			     snd_ca0106_proc_reg_read32,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 			     snd_ca0106_proc_reg_write32);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 	snd_card_ro_proc_new(emu->card, "ca0106_reg16", emu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) 			     snd_ca0106_proc_reg_read16);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 	snd_card_ro_proc_new(emu->card, "ca0106_reg8", emu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) 			     snd_ca0106_proc_reg_read8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) 	snd_card_rw_proc_new(emu->card, "ca0106_regs1", emu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) 			     snd_ca0106_proc_reg_read1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) 			     snd_ca0106_proc_reg_write);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) 	snd_card_rw_proc_new(emu->card, "ca0106_i2c", emu, NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) 			     snd_ca0106_proc_i2c_write);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) 	snd_card_ro_proc_new(emu->card, "ca0106_regs2", emu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) 			     snd_ca0106_proc_reg_read2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) }