~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/sound/pci/ca0106/ca0106_proc.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /sound/pci/ca0106/ca0106_proc.c (Architecture alpha) and /sound/pci/ca0106/ca0106_proc.c (Architecture ppc)


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

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php