[ALSA] ac97 - procfs - print PCI subsystem vendor/device values
[pandora-kernel.git] / sound / pci / ac97 / ac97_proc.c
1 /*
2  *  Copyright (c) by Jaroslav Kysela <perex@suse.cz>
3  *  Universal interface for Audio Codec '97
4  *
5  *  For more details look to AC '97 component specification revision 2.2
6  *  by Intel Corporation (http://developer.intel.com).
7  *
8  *
9  *   This program is free software; you can redistribute it and/or modify
10  *   it under the terms of the GNU General Public License as published by
11  *   the Free Software Foundation; either version 2 of the License, or
12  *   (at your option) any later version.
13  *
14  *   This program is distributed in the hope that it will be useful,
15  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *   GNU General Public License for more details.
18  *
19  *   You should have received a copy of the GNU General Public License
20  *   along with this program; if not, write to the Free Software
21  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
22  *
23  */
24
25 #include <sound/driver.h>
26 #include <linux/slab.h>
27 #include <sound/core.h>
28 #include <sound/ac97_codec.h>
29 #include <sound/asoundef.h>
30 #include "ac97_local.h"
31 #include "ac97_id.h"
32
33 /*
34  * proc interface
35  */
36
37 static void snd_ac97_proc_read_functions(ac97_t *ac97, snd_info_buffer_t *buffer)
38 {
39         int header = 0, function;
40         unsigned short info, sense_info;
41         static const char *function_names[12] = {
42                 "Master Out", "AUX Out", "Center/LFE Out", "SPDIF Out",
43                 "Phone In", "Mic 1", "Mic 2", "Line In", "CD In", "Video In",
44                 "Aux In", "Mono Out"
45         };
46         static const char *locations[8] = {
47                 "Rear I/O Panel", "Front Panel", "Motherboard", "Dock/External",
48                 "reserved", "reserved", "reserved", "NC/unused"
49         };
50
51         for (function = 0; function < 12; ++function) {
52                 snd_ac97_write(ac97, AC97_FUNC_SELECT, function << 1);
53                 info = snd_ac97_read(ac97, AC97_FUNC_INFO);
54                 if (!(info & 0x0001))
55                         continue;
56                 if (!header) {
57                         snd_iprintf(buffer, "\n                    Gain     Inverted  Buffer delay  Location\n");
58                         header = 1;
59                 }
60                 sense_info = snd_ac97_read(ac97, AC97_SENSE_INFO);
61                 snd_iprintf(buffer, "%-17s: %3d.%d dBV    %c      %2d/fs         %s\n",
62                             function_names[function],
63                             (info & 0x8000 ? -1 : 1) * ((info & 0x7000) >> 12) * 3 / 2,
64                             ((info & 0x0800) >> 11) * 5,
65                             info & 0x0400 ? 'X' : '-',
66                             (info & 0x03e0) >> 5,
67                             locations[sense_info >> 13]);
68         }
69 }
70
71 static void snd_ac97_proc_read_main(ac97_t *ac97, snd_info_buffer_t * buffer, int subidx)
72 {
73         char name[64];
74         unsigned short val, tmp, ext, mext;
75         static const char *spdif_slots[4] = { " SPDIF=3/4", " SPDIF=7/8", " SPDIF=6/9", " SPDIF=10/11" };
76         static const char *spdif_rates[4] = { " Rate=44.1kHz", " Rate=res", " Rate=48kHz", " Rate=32kHz" };
77         static const char *spdif_rates_cs4205[4] = { " Rate=48kHz", " Rate=44.1kHz", " Rate=res", " Rate=res" };
78         static const char *double_rate_slots[4] = { "10/11", "7/8", "reserved", "reserved" };
79
80         snd_ac97_get_name(NULL, ac97->id, name, 0);
81         snd_iprintf(buffer, "%d-%d/%d: %s\n\n", ac97->addr, ac97->num, subidx, name);
82
83
84         if ((ac97->scaps & AC97_SCAP_AUDIO) == 0)
85                 goto __modem;
86
87         snd_iprintf(buffer, "PCI Subsys Vendor: 0x%04x\n",
88                     ac97->subsystem_vendor);
89         snd_iprintf(buffer, "PCI Subsys Device: 0x%04x\n\n",
90                     ac97->subsystem_device);
91
92         if ((ac97->ext_id & AC97_EI_REV_MASK) >= AC97_EI_REV_23) {
93                 val = snd_ac97_read(ac97, AC97_INT_PAGING);
94                 snd_ac97_update_bits(ac97, AC97_INT_PAGING,
95                                      AC97_PAGE_MASK, AC97_PAGE_1);
96                 tmp = snd_ac97_read(ac97, AC97_CODEC_CLASS_REV);
97                 snd_iprintf(buffer, "Revision         : 0x%02x\n", tmp & 0xff);
98                 snd_iprintf(buffer, "Compat. Class    : 0x%02x\n", (tmp >> 8) & 0x1f);
99                 snd_iprintf(buffer, "Subsys. Vendor ID: 0x%04x\n",
100                             snd_ac97_read(ac97, AC97_PCI_SVID));
101                 snd_iprintf(buffer, "Subsys. ID       : 0x%04x\n\n",
102                             snd_ac97_read(ac97, AC97_PCI_SID));
103                 snd_ac97_update_bits(ac97, AC97_INT_PAGING,
104                                      AC97_PAGE_MASK, val & AC97_PAGE_MASK);
105         }
106
107         // val = snd_ac97_read(ac97, AC97_RESET);
108         val = ac97->caps;
109         snd_iprintf(buffer, "Capabilities     :%s%s%s%s%s%s\n",
110                     val & AC97_BC_DEDICATED_MIC ? " -dedicated MIC PCM IN channel-" : "",
111                     val & AC97_BC_RESERVED1 ? " -reserved1-" : "",
112                     val & AC97_BC_BASS_TREBLE ? " -bass & treble-" : "",
113                     val & AC97_BC_SIM_STEREO ? " -simulated stereo-" : "",
114                     val & AC97_BC_HEADPHONE ? " -headphone out-" : "",
115                     val & AC97_BC_LOUDNESS ? " -loudness-" : "");
116         tmp = ac97->caps & AC97_BC_DAC_MASK;
117         snd_iprintf(buffer, "DAC resolution   : %s%s%s%s\n",
118                     tmp == AC97_BC_16BIT_DAC ? "16-bit" : "",
119                     tmp == AC97_BC_18BIT_DAC ? "18-bit" : "",
120                     tmp == AC97_BC_20BIT_DAC ? "20-bit" : "",
121                     tmp == AC97_BC_DAC_MASK ? "???" : "");
122         tmp = ac97->caps & AC97_BC_ADC_MASK;
123         snd_iprintf(buffer, "ADC resolution   : %s%s%s%s\n",
124                     tmp == AC97_BC_16BIT_ADC ? "16-bit" : "",
125                     tmp == AC97_BC_18BIT_ADC ? "18-bit" : "",
126                     tmp == AC97_BC_20BIT_ADC ? "20-bit" : "",
127                     tmp == AC97_BC_ADC_MASK ? "???" : "");
128         snd_iprintf(buffer, "3D enhancement   : %s\n",
129                 snd_ac97_stereo_enhancements[(val >> 10) & 0x1f]);
130         snd_iprintf(buffer, "\nCurrent setup\n");
131         val = snd_ac97_read(ac97, AC97_MIC);
132         snd_iprintf(buffer, "Mic gain         : %s [%s]\n", val & 0x0040 ? "+20dB" : "+0dB", ac97->regs[AC97_MIC] & 0x0040 ? "+20dB" : "+0dB");
133         val = snd_ac97_read(ac97, AC97_GENERAL_PURPOSE);
134         snd_iprintf(buffer, "POP path         : %s 3D\n"
135                     "Sim. stereo      : %s\n"
136                     "3D enhancement   : %s\n"
137                     "Loudness         : %s\n"
138                     "Mono output      : %s\n"
139                     "Mic select       : %s\n"
140                     "ADC/DAC loopback : %s\n",
141                     val & 0x8000 ? "post" : "pre",
142                     val & 0x4000 ? "on" : "off",
143                     val & 0x2000 ? "on" : "off",
144                     val & 0x1000 ? "on" : "off",
145                     val & 0x0200 ? "Mic" : "MIX",
146                     val & 0x0100 ? "Mic2" : "Mic1",
147                     val & 0x0080 ? "on" : "off");
148         if (ac97->ext_id & AC97_EI_DRA)
149                 snd_iprintf(buffer, "Double rate slots: %s\n",
150                             double_rate_slots[(val >> 10) & 3]);
151
152         ext = snd_ac97_read(ac97, AC97_EXTENDED_ID);
153         if (ext == 0)
154                 goto __modem;
155                 
156         snd_iprintf(buffer, "Extended ID      : codec=%i rev=%i%s%s%s%s DSA=%i%s%s%s%s\n",
157                         (ext & AC97_EI_ADDR_MASK) >> AC97_EI_ADDR_SHIFT,
158                         (ext & AC97_EI_REV_MASK) >> AC97_EI_REV_SHIFT,
159                         ext & AC97_EI_AMAP ? " AMAP" : "",
160                         ext & AC97_EI_LDAC ? " LDAC" : "",
161                         ext & AC97_EI_SDAC ? " SDAC" : "",
162                         ext & AC97_EI_CDAC ? " CDAC" : "",
163                         (ext & AC97_EI_DACS_SLOT_MASK) >> AC97_EI_DACS_SLOT_SHIFT,
164                         ext & AC97_EI_VRM ? " VRM" : "",
165                         ext & AC97_EI_SPDIF ? " SPDIF" : "",
166                         ext & AC97_EI_DRA ? " DRA" : "",
167                         ext & AC97_EI_VRA ? " VRA" : "");
168         val = snd_ac97_read(ac97, AC97_EXTENDED_STATUS);
169         snd_iprintf(buffer, "Extended status  :%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
170                         val & AC97_EA_PRL ? " PRL" : "",
171                         val & AC97_EA_PRK ? " PRK" : "",
172                         val & AC97_EA_PRJ ? " PRJ" : "",
173                         val & AC97_EA_PRI ? " PRI" : "",
174                         val & AC97_EA_SPCV ? " SPCV" : "",
175                         val & AC97_EA_MDAC ? " MADC" : "",
176                         val & AC97_EA_LDAC ? " LDAC" : "",
177                         val & AC97_EA_SDAC ? " SDAC" : "",
178                         val & AC97_EA_CDAC ? " CDAC" : "",
179                         ext & AC97_EI_SPDIF ? spdif_slots[(val & AC97_EA_SPSA_SLOT_MASK) >> AC97_EA_SPSA_SLOT_SHIFT] : "",
180                         val & AC97_EA_VRM ? " VRM" : "",
181                         val & AC97_EA_SPDIF ? " SPDIF" : "",
182                         val & AC97_EA_DRA ? " DRA" : "",
183                         val & AC97_EA_VRA ? " VRA" : "");
184         if (ext & AC97_EI_VRA) {        /* VRA */
185                 val = snd_ac97_read(ac97, AC97_PCM_FRONT_DAC_RATE);
186                 snd_iprintf(buffer, "PCM front DAC    : %iHz\n", val);
187                 if (ext & AC97_EI_SDAC) {
188                         val = snd_ac97_read(ac97, AC97_PCM_SURR_DAC_RATE);
189                         snd_iprintf(buffer, "PCM Surr DAC     : %iHz\n", val);
190                 }
191                 if (ext & AC97_EI_LDAC) {
192                         val = snd_ac97_read(ac97, AC97_PCM_LFE_DAC_RATE);
193                         snd_iprintf(buffer, "PCM LFE DAC      : %iHz\n", val);
194                 }
195                 val = snd_ac97_read(ac97, AC97_PCM_LR_ADC_RATE);
196                 snd_iprintf(buffer, "PCM ADC          : %iHz\n", val);
197         }
198         if (ext & AC97_EI_VRM) {
199                 val = snd_ac97_read(ac97, AC97_PCM_MIC_ADC_RATE);
200                 snd_iprintf(buffer, "PCM MIC ADC      : %iHz\n", val);
201         }
202         if ((ext & AC97_EI_SPDIF) || (ac97->flags & AC97_CS_SPDIF)) {
203                 if (ac97->flags & AC97_CS_SPDIF)
204                         val = snd_ac97_read(ac97, AC97_CSR_SPDIF);
205                 else
206                         val = snd_ac97_read(ac97, AC97_SPDIF);
207
208                 snd_iprintf(buffer, "SPDIF Control    :%s%s%s%s Category=0x%x Generation=%i%s%s%s\n",
209                         val & AC97_SC_PRO ? " PRO" : " Consumer",
210                         val & AC97_SC_NAUDIO ? " Non-audio" : " PCM",
211                         val & AC97_SC_COPY ? "" : " Copyright",
212                         val & AC97_SC_PRE ? " Preemph50/15" : "",
213                         (val & AC97_SC_CC_MASK) >> AC97_SC_CC_SHIFT,
214                         (val & AC97_SC_L) >> 11,
215                         (ac97->flags & AC97_CS_SPDIF) ?
216                             spdif_rates_cs4205[(val & AC97_SC_SPSR_MASK) >> AC97_SC_SPSR_SHIFT] :
217                             spdif_rates[(val & AC97_SC_SPSR_MASK) >> AC97_SC_SPSR_SHIFT],
218                         (ac97->flags & AC97_CS_SPDIF) ?
219                             (val & AC97_SC_DRS ? " Validity" : "") :
220                             (val & AC97_SC_DRS ? " DRS" : ""),
221                         (ac97->flags & AC97_CS_SPDIF) ?
222                             (val & AC97_SC_V ? " Enabled" : "") :
223                             (val & AC97_SC_V ? " Validity" : ""));
224                 /* ALC650 specific*/
225                 if ((ac97->id & 0xfffffff0) == 0x414c4720 &&
226                     (snd_ac97_read(ac97, AC97_ALC650_CLOCK) & 0x01)) {
227                         val = snd_ac97_read(ac97, AC97_ALC650_SPDIF_INPUT_STATUS2);
228                         if (val & AC97_ALC650_CLOCK_LOCK) {
229                                 val = snd_ac97_read(ac97, AC97_ALC650_SPDIF_INPUT_STATUS1);
230                                 snd_iprintf(buffer, "SPDIF In Status  :%s%s%s%s Category=0x%x Generation=%i",
231                                             val & AC97_ALC650_PRO ? " PRO" : " Consumer",
232                                             val & AC97_ALC650_NAUDIO ? " Non-audio" : " PCM",
233                                             val & AC97_ALC650_COPY ? "" : " Copyright",
234                                             val & AC97_ALC650_PRE ? " Preemph50/15" : "",
235                                             (val & AC97_ALC650_CC_MASK) >> AC97_ALC650_CC_SHIFT,
236                                             (val & AC97_ALC650_L) >> 15);
237                                 val = snd_ac97_read(ac97, AC97_ALC650_SPDIF_INPUT_STATUS2);
238                                 snd_iprintf(buffer, "%s Accuracy=%i%s%s\n",
239                                             spdif_rates[(val & AC97_ALC650_SPSR_MASK) >> AC97_ALC650_SPSR_SHIFT],
240                                             (val & AC97_ALC650_CLOCK_ACCURACY) >> AC97_ALC650_CLOCK_SHIFT,
241                                             (val & AC97_ALC650_CLOCK_LOCK ? " Locked" : " Unlocked"),
242                                             (val & AC97_ALC650_V ? " Validity?" : ""));
243                         } else {
244                                 snd_iprintf(buffer, "SPDIF In Status  : Not Locked\n");
245                         }
246                 }
247         }
248         if ((ac97->ext_id & AC97_EI_REV_MASK) >= AC97_EI_REV_23) {
249                 val = snd_ac97_read(ac97, AC97_INT_PAGING);
250                 snd_ac97_update_bits(ac97, AC97_INT_PAGING,
251                                      AC97_PAGE_MASK, AC97_PAGE_1);
252                 snd_ac97_proc_read_functions(ac97, buffer);
253                 snd_ac97_update_bits(ac97, AC97_INT_PAGING,
254                                      AC97_PAGE_MASK, val & AC97_PAGE_MASK);
255         }
256
257
258       __modem:
259         mext = snd_ac97_read(ac97, AC97_EXTENDED_MID);
260         if (mext == 0)
261                 return;
262         
263         snd_iprintf(buffer, "Extended modem ID: codec=%i%s%s%s%s%s\n",
264                         (mext & AC97_MEI_ADDR_MASK) >> AC97_MEI_ADDR_SHIFT,
265                         mext & AC97_MEI_CID2 ? " CID2" : "",
266                         mext & AC97_MEI_CID1 ? " CID1" : "",
267                         mext & AC97_MEI_HANDSET ? " HSET" : "",
268                         mext & AC97_MEI_LINE2 ? " LIN2" : "",
269                         mext & AC97_MEI_LINE1 ? " LIN1" : "");
270         val = snd_ac97_read(ac97, AC97_EXTENDED_MSTATUS);
271         snd_iprintf(buffer, "Modem status     :%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
272                         val & AC97_MEA_GPIO ? " GPIO" : "",
273                         val & AC97_MEA_MREF ? " MREF" : "",
274                         val & AC97_MEA_ADC1 ? " ADC1" : "",
275                         val & AC97_MEA_DAC1 ? " DAC1" : "",
276                         val & AC97_MEA_ADC2 ? " ADC2" : "",
277                         val & AC97_MEA_DAC2 ? " DAC2" : "",
278                         val & AC97_MEA_HADC ? " HADC" : "",
279                         val & AC97_MEA_HDAC ? " HDAC" : "",
280                         val & AC97_MEA_PRA ? " PRA(GPIO)" : "",
281                         val & AC97_MEA_PRB ? " PRB(res)" : "",
282                         val & AC97_MEA_PRC ? " PRC(ADC1)" : "",
283                         val & AC97_MEA_PRD ? " PRD(DAC1)" : "",
284                         val & AC97_MEA_PRE ? " PRE(ADC2)" : "",
285                         val & AC97_MEA_PRF ? " PRF(DAC2)" : "",
286                         val & AC97_MEA_PRG ? " PRG(HADC)" : "",
287                         val & AC97_MEA_PRH ? " PRH(HDAC)" : "");
288         if (mext & AC97_MEI_LINE1) {
289                 val = snd_ac97_read(ac97, AC97_LINE1_RATE);
290                 snd_iprintf(buffer, "Line1 rate       : %iHz\n", val);
291         }
292         if (mext & AC97_MEI_LINE2) {
293                 val = snd_ac97_read(ac97, AC97_LINE2_RATE);
294                 snd_iprintf(buffer, "Line2 rate       : %iHz\n", val);
295         }
296         if (mext & AC97_MEI_HANDSET) {
297                 val = snd_ac97_read(ac97, AC97_HANDSET_RATE);
298                 snd_iprintf(buffer, "Headset rate     : %iHz\n", val);
299         }
300 }
301
302 static void snd_ac97_proc_read(snd_info_entry_t *entry, snd_info_buffer_t * buffer)
303 {
304         ac97_t *ac97 = entry->private_data;
305         
306         down(&ac97->page_mutex);
307         if ((ac97->id & 0xffffff40) == AC97_ID_AD1881) {        // Analog Devices AD1881/85/86
308                 int idx;
309                 for (idx = 0; idx < 3; idx++)
310                         if (ac97->spec.ad18xx.id[idx]) {
311                                 /* select single codec */
312                                 snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 0x7000,
313                                                      ac97->spec.ad18xx.unchained[idx] | ac97->spec.ad18xx.chained[idx]);
314                                 snd_ac97_proc_read_main(ac97, buffer, idx);
315                                 snd_iprintf(buffer, "\n\n");
316                         }
317                 /* select all codecs */
318                 snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 0x7000, 0x7000);
319                 
320                 snd_iprintf(buffer, "\nAD18XX configuration\n");
321                 snd_iprintf(buffer, "Unchained        : 0x%04x,0x%04x,0x%04x\n",
322                         ac97->spec.ad18xx.unchained[0],
323                         ac97->spec.ad18xx.unchained[1],
324                         ac97->spec.ad18xx.unchained[2]);
325                 snd_iprintf(buffer, "Chained          : 0x%04x,0x%04x,0x%04x\n",
326                         ac97->spec.ad18xx.chained[0],
327                         ac97->spec.ad18xx.chained[1],
328                         ac97->spec.ad18xx.chained[2]);
329         } else {
330                 snd_ac97_proc_read_main(ac97, buffer, 0);
331         }
332         up(&ac97->page_mutex);
333 }
334
335 #ifdef CONFIG_SND_DEBUG
336 /* direct register write for debugging */
337 static void snd_ac97_proc_regs_write(snd_info_entry_t *entry, snd_info_buffer_t *buffer)
338 {
339         ac97_t *ac97 = entry->private_data;
340         char line[64];
341         unsigned int reg, val;
342         down(&ac97->page_mutex);
343         while (!snd_info_get_line(buffer, line, sizeof(line))) {
344                 if (sscanf(line, "%x %x", &reg, &val) != 2)
345                         continue;
346                 /* register must be even */
347                 if (reg < 0x80 && (reg & 1) == 0 && val <= 0xffff)
348                         snd_ac97_write_cache(ac97, reg, val);
349         }
350         up(&ac97->page_mutex);
351 }
352 #endif
353
354 static void snd_ac97_proc_regs_read_main(ac97_t *ac97, snd_info_buffer_t * buffer, int subidx)
355 {
356         int reg, val;
357
358         for (reg = 0; reg < 0x80; reg += 2) {
359                 val = snd_ac97_read(ac97, reg);
360                 snd_iprintf(buffer, "%i:%02x = %04x\n", subidx, reg, val);
361         }
362 }
363
364 static void snd_ac97_proc_regs_read(snd_info_entry_t *entry, 
365                                     snd_info_buffer_t * buffer)
366 {
367         ac97_t *ac97 = entry->private_data;
368
369         down(&ac97->page_mutex);
370         if ((ac97->id & 0xffffff40) == AC97_ID_AD1881) {        // Analog Devices AD1881/85/86
371
372                 int idx;
373                 for (idx = 0; idx < 3; idx++)
374                         if (ac97->spec.ad18xx.id[idx]) {
375                                 /* select single codec */
376                                 snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 0x7000,
377                                                      ac97->spec.ad18xx.unchained[idx] | ac97->spec.ad18xx.chained[idx]);
378                                 snd_ac97_proc_regs_read_main(ac97, buffer, idx);
379                         }
380                 /* select all codecs */
381                 snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 0x7000, 0x7000);
382         } else {
383                 snd_ac97_proc_regs_read_main(ac97, buffer, 0);
384         }       
385         up(&ac97->page_mutex);
386 }
387
388 void snd_ac97_proc_init(ac97_t * ac97)
389 {
390         snd_info_entry_t *entry;
391         char name[32];
392         const char *prefix;
393
394         if (ac97->bus->proc == NULL)
395                 return;
396         prefix = ac97_is_audio(ac97) ? "ac97" : "mc97";
397         sprintf(name, "%s#%d-%d", prefix, ac97->addr, ac97->num);
398         if ((entry = snd_info_create_card_entry(ac97->bus->card, name, ac97->bus->proc)) != NULL) {
399                 snd_info_set_text_ops(entry, ac97, 1024, snd_ac97_proc_read);
400                 if (snd_info_register(entry) < 0) {
401                         snd_info_free_entry(entry);
402                         entry = NULL;
403                 }
404         }
405         ac97->proc = entry;
406         sprintf(name, "%s#%d-%d+regs", prefix, ac97->addr, ac97->num);
407         if ((entry = snd_info_create_card_entry(ac97->bus->card, name, ac97->bus->proc)) != NULL) {
408                 snd_info_set_text_ops(entry, ac97, 1024, snd_ac97_proc_regs_read);
409 #ifdef CONFIG_SND_DEBUG
410                 entry->mode |= S_IWUSR;
411                 entry->c.text.write_size = 1024;
412                 entry->c.text.write = snd_ac97_proc_regs_write;
413 #endif
414                 if (snd_info_register(entry) < 0) {
415                         snd_info_free_entry(entry);
416                         entry = NULL;
417                 }
418         }
419         ac97->proc_regs = entry;
420 }
421
422 void snd_ac97_proc_done(ac97_t * ac97)
423 {
424         if (ac97->proc_regs) {
425                 snd_info_unregister(ac97->proc_regs);
426                 ac97->proc_regs = NULL;
427         }
428         if (ac97->proc) {
429                 snd_info_unregister(ac97->proc);
430                 ac97->proc = NULL;
431         }
432 }
433
434 void snd_ac97_bus_proc_init(ac97_bus_t * bus)
435 {
436         snd_info_entry_t *entry;
437         char name[32];
438
439         sprintf(name, "codec97#%d", bus->num);
440         if ((entry = snd_info_create_card_entry(bus->card, name, bus->card->proc_root)) != NULL) {
441                 entry->mode = S_IFDIR | S_IRUGO | S_IXUGO;
442                 if (snd_info_register(entry) < 0) {
443                         snd_info_free_entry(entry);
444                         entry = NULL;
445                 }
446         }
447         bus->proc = entry;
448 }
449
450 void snd_ac97_bus_proc_done(ac97_bus_t * bus)
451 {
452         if (bus->proc) {
453                 snd_info_unregister(bus->proc);
454                 bus->proc = NULL;
455         }
456 }