This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / sound / pci / ice1712 / prodigy.c
1 /*
2  *   ALSA driver for ICEnsemble VT1724 (Envy24HT)
3  *
4  *   Lowlevel functions for AudioTrak Prodigy 7.1 (and possibly 192) cards
5  *      Copyright (c) 2003 Dimitromanolakis Apostolos <apostol@cs.utoronto.ca>
6  *      based on the aureon.c code (c) 2003 by Takashi Iwai <tiwai@suse.de>
7  *
8  *   version 0.82: Stable / not all features work yet (no communication with AC97 secondary)
9  *       added 64x/128x oversampling switch (should be 64x only for 96khz)
10  *       fixed some recording labels (still need to check the rest)
11  *       recording is working probably thanks to correct wm8770 initialization
12  *
13  *   version 0.5: Initial release:
14  *           working: analog output, mixer, headphone amplifier switch
15  *       not working: prety much everything else, at least i could verify that
16  *                    we have no digital output, no capture, pretty bad clicks and poops
17  *                    on mixer switch and other coll stuff.
18  *
19  *   This program is free software; you can redistribute it and/or modify
20  *   it under the terms of the GNU General Public License as published by
21  *   the Free Software Foundation; either version 2 of the License, or
22  *   (at your option) any later version.
23  *
24  *   This program is distributed in the hope that it will be useful,
25  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
26  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27  *   GNU General Public License for more details.
28  *
29  *   You should have received a copy of the GNU General Public License
30  *   along with this program; if not, write to the Free Software
31  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
32  *
33  *
34  * NOTES:
35  *
36  *
37  *
38  * - we reuse the akm4xxx_t record for storing the wm8770 codec data.
39  *   both wm and akm codecs are pretty similar, so we can integrate
40  *   both controls in the future, once if wm codecs are reused in
41  *   many boards.
42  *
43  * - writing over SPI is implemented but reading is not yet.
44  *   the SPDIF-in channel status, etc. can be read from CS chip.
45  *
46  * - DAC digital volumes are not implemented in the mixer.
47  *   if they show better response than DAC analog volumes, we can use them
48  *   instead.
49  *
50  * - Prodigy boards are equipped with AC97 STAC9744 chip , too.  it's used to do
51  *   the analog mixing but not easily controllable (it's not connected
52  *   directly from envy24ht chip).  so let's leave it as it is.
53  *
54  */
55
56 #define REVISION 0.82b
57
58 #include <sound/driver.h>
59 #include <asm/io.h>
60 #include <linux/delay.h>
61 #include <linux/interrupt.h>
62 #include <linux/init.h>
63 #include <linux/slab.h>
64 #include <sound/core.h>
65
66 #include "ice1712.h"
67 #include "envy24ht.h"
68 #include "prodigy.h"
69
70
71 static int prodigy_set_headphone_amp(ice1712_t *ice, int enable)
72 {
73         unsigned int tmp, tmp2;
74
75         tmp2 = tmp = snd_ice1712_gpio_read(ice);
76         if (enable)
77                 tmp |= PRODIGY_HP_AMP_EN;
78         else
79                 tmp &= ~ PRODIGY_HP_AMP_EN;
80         if (tmp != tmp2) {
81                 snd_ice1712_gpio_write(ice, tmp);
82                 return 1;
83         }
84         return 0;
85 }
86
87
88 static int prodigy_get_headphone_amp(ice1712_t *ice)
89 {
90         unsigned int tmp = snd_ice1712_gpio_read(ice);
91
92         return ( tmp & PRODIGY_HP_AMP_EN )!= 0;
93 }
94
95
96 /*
97  * write data in the SPI mode
98  */
99 static void prodigy_spi_write(ice1712_t *ice, unsigned int cs, unsigned int data, int bits)
100 {
101         unsigned int tmp;
102         int i;
103
104         tmp = snd_ice1712_gpio_read(ice);
105
106         snd_ice1712_gpio_set_mask(ice, ~(PRODIGY_WM_RW|PRODIGY_WM_DATA|PRODIGY_WM_CLK|
107                                          PRODIGY_WM_CS|PRODIGY_CS8415_CS|PRODIGY_HP_AMP_EN));
108         tmp |= PRODIGY_WM_RW;
109         tmp &= ~cs;
110         snd_ice1712_gpio_write(ice, tmp);
111         udelay(1);
112
113         for (i = bits - 1; i >= 0; i--) {
114                 tmp &= ~PRODIGY_WM_CLK;
115                 snd_ice1712_gpio_write(ice, tmp);
116                 udelay(1);
117                 if (data & (1 << i))
118                         tmp |= PRODIGY_WM_DATA;
119                 else
120                         tmp &= ~PRODIGY_WM_DATA;
121                 snd_ice1712_gpio_write(ice, tmp);
122                 udelay(1);
123                 tmp |= PRODIGY_WM_CLK;
124                 snd_ice1712_gpio_write(ice, tmp);
125                 udelay(1);
126         }
127
128         tmp &= ~PRODIGY_WM_CLK;
129         tmp |= cs;
130         snd_ice1712_gpio_write(ice, tmp);
131         udelay(1);
132         tmp |= PRODIGY_WM_CLK;
133         snd_ice1712_gpio_write(ice, tmp);
134         udelay(1);
135 }
136
137
138 /*
139  * get the current register value of WM codec
140  */
141 static unsigned short wm_get(ice1712_t *ice, int reg)
142 {
143         reg <<= 1;
144         return ((unsigned short)ice->akm[0].images[reg] << 8) |
145                 ice->akm[0].images[reg + 1];
146 }
147
148 /*
149  * set the register value of WM codec and remember it
150  */
151 static void wm_put(ice1712_t *ice, int reg, unsigned short val)
152 {
153         prodigy_spi_write(ice, PRODIGY_WM_CS, (reg << 9) | (val & 0x1ff), 16);
154         reg <<= 1;
155         ice->akm[0].images[reg] = val >> 8;
156         ice->akm[0].images[reg + 1] = val;
157 }
158
159
160 /*********************************
161  ********* Controls section ******
162  *********************************/
163
164 #define PRODIGY_CON_HPAMP \
165         {                                            \
166                 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,      \
167                 .name =  "Headphone Amplifier", \
168                 .info =  prodigy_hpamp_info,         \
169                 .get =   prodigy_hpamp_get, \
170                 .put =   prodigy_hpamp_put  \
171         }
172
173 static int prodigy_hpamp_info(snd_kcontrol_t *k, snd_ctl_elem_info_t *uinfo)
174 {
175         static char *texts[2] = {
176                 "Off", "On"
177         };
178
179         uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
180         uinfo->count = 1;
181         uinfo->value.enumerated.items = 2;
182
183         if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
184                 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
185         strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
186
187         return 0;
188 }
189
190
191 static int prodigy_hpamp_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
192 {
193         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
194
195         ucontrol->value.integer.value[0] = prodigy_get_headphone_amp(ice);
196         return 0;
197 }
198
199
200 static int prodigy_hpamp_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
201 {
202         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
203
204         return prodigy_set_headphone_amp(ice,ucontrol->value.integer.value[0]);
205 }
206
207
208
209 #define PRODIGY_CON_DEEMP \
210         {                                            \
211                 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,      \
212                 .name =  "DAC De-emphasis", \
213                 .info =  prodigy_deemp_info,         \
214                 .get =   prodigy_deemp_get, \
215                 .put =   prodigy_deemp_put  \
216         }
217
218 static int prodigy_deemp_info(snd_kcontrol_t *k, snd_ctl_elem_info_t *uinfo)
219 {
220         static char *texts[2] = { "Off", "On" };
221
222         uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
223         uinfo->count = 1;
224         uinfo->value.enumerated.items = 2;
225
226         if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
227                 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
228         strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
229
230         return 0;
231 }
232
233 static int prodigy_deemp_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
234 {
235         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
236         ucontrol->value.integer.value[0] = (wm_get(ice, 0x15) & 0xf) == 0xf;
237         return 0;
238 }
239
240 static int prodigy_deemp_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
241 {
242         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
243         int temp, temp2;
244         temp2 = temp = wm_get(ice, 0x15);
245         temp = (temp & ~0xf) | ((ucontrol->value.integer.value[0])*0xf);
246         if (temp != temp2) {
247                 wm_put(ice,0x15,temp);
248                 return 1;
249         }
250         return 0;
251 }
252
253
254 #define PRODIGY_CON_OVERSAMPLING \
255         {                                            \
256                 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,      \
257                 .name =  "ADC Oversampling", \
258                 .info =  prodigy_oversampling_info,         \
259                 .get =   prodigy_oversampling_get, \
260                 .put =   prodigy_oversampling_put  \
261         }
262
263 static int prodigy_oversampling_info(snd_kcontrol_t *k, snd_ctl_elem_info_t *uinfo)
264 {
265         static char *texts[2] = { "128x", "64x" };
266
267         uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
268         uinfo->count = 1;
269         uinfo->value.enumerated.items = 2;
270
271         if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
272                 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
273         strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
274
275         return 0;
276 }
277
278 static int prodigy_oversampling_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
279 {
280         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
281         ucontrol->value.integer.value[0] = (wm_get(ice, 0x17) & 0x8) == 0x8;
282         return 0;
283 }
284
285 static int prodigy_oversampling_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
286 {
287         int temp, temp2;
288         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
289
290         temp2 = temp = wm_get(ice, 0x17);
291
292         if( ucontrol->value.integer.value[0] ) {
293                 temp |= 0x8;
294         } else {
295                 temp &= ~0x8;
296         }
297
298         if (temp != temp2) {
299                 wm_put(ice,0x17,temp);
300                 return 1;
301         }
302         return 0;
303 }
304
305
306
307
308 /*
309  * DAC volume attenuation mixer control
310  */
311 static int wm_dac_vol_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
312 {
313         uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
314         uinfo->count = 1;
315         uinfo->value.integer.min = 0;           /* mute */
316         uinfo->value.integer.max = 101;         /* 0dB */
317         return 0;
318 }
319
320 static int wm_dac_vol_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
321 {
322         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
323         int idx;
324         unsigned short vol;
325
326         down(&ice->gpio_mutex);
327         if (kcontrol->private_value)
328                 idx = WM_DAC_MASTER_ATTEN;
329         else
330                 idx  = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + WM_DAC_ATTEN;
331         vol = wm_get(ice, idx) & 0x7f;
332         if (vol <= 0x1a)
333                 ucontrol->value.integer.value[0] = 0;
334         else
335                 ucontrol->value.integer.value[0] = vol - 0x1a;
336         up(&ice->gpio_mutex);
337
338         return 0;
339 }
340
341 static int wm_dac_vol_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
342 {
343         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
344         int idx;
345         unsigned short ovol, nvol;
346         int change;
347
348         snd_ice1712_save_gpio_status(ice);
349         if (kcontrol->private_value)
350                 idx = WM_DAC_MASTER_ATTEN;
351         else
352                 idx  = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + WM_DAC_ATTEN;
353         nvol = ucontrol->value.integer.value[0] + 0x1a;
354         ovol = wm_get(ice, idx) & 0x7f;
355         change = (ovol != nvol);
356         if (change) {
357                 if (nvol <= 0x1a && ovol <= 0x1a)
358                         change = 0;
359                 else
360                         wm_put(ice, idx, nvol | 0x180); /* update on zero detect */
361         }
362         snd_ice1712_restore_gpio_status(ice);
363         return change;
364 }
365
366 /*
367  * ADC gain mixer control
368  */
369 static int wm_adc_vol_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
370 {
371         uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
372         uinfo->count = 1;
373         uinfo->value.integer.min = 0;           /* -12dB */
374         uinfo->value.integer.max = 0x1f;        /* 19dB */
375         return 0;
376 }
377
378 static int wm_adc_vol_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
379 {
380         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
381         int idx;
382         unsigned short vol;
383
384         down(&ice->gpio_mutex);
385         idx  = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + WM_ADC_GAIN;
386         vol = wm_get(ice, idx) & 0x1f;
387         ucontrol->value.integer.value[0] = vol;
388         up(&ice->gpio_mutex);
389         return 0;
390 }
391
392 static int wm_adc_vol_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
393 {
394         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
395         int idx;
396         unsigned short ovol, nvol;
397         int change;
398
399         snd_ice1712_save_gpio_status(ice);
400         idx  = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + WM_ADC_GAIN;
401         nvol = ucontrol->value.integer.value[0];
402         ovol = wm_get(ice, idx) & 0x1f;
403         change = (ovol != nvol);
404         if (change)
405                 wm_put(ice, idx, nvol);
406         snd_ice1712_restore_gpio_status(ice);
407         return change;
408 }
409
410 /*
411  * ADC input mux mixer control
412  */
413 static int wm_adc_mux_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
414 {
415         static char *texts[] = {
416                 "CD Left",
417                 "CD Right",
418                 "Line Left",
419                 "Line Right",
420                 "Aux Left",
421                 "Aux Right",
422                 "Mic Left",
423                 "Mic Right",
424         };
425         uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
426         uinfo->count = 2;
427         uinfo->value.enumerated.items = 8;
428         if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
429                 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
430         strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
431         return 0;
432 }
433
434 static int wm_adc_mux_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *ucontrol)
435 {
436         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
437         unsigned short val;
438
439         down(&ice->gpio_mutex);
440         val = wm_get(ice, WM_ADC_MUX);
441         ucontrol->value.integer.value[0] = val & 7;
442         ucontrol->value.integer.value[1] = (val >> 4) & 7;
443         up(&ice->gpio_mutex);
444         return 0;
445 }
446
447 static int wm_adc_mux_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *ucontrol)
448 {
449         ice1712_t *ice = snd_kcontrol_chip(kcontrol);
450         unsigned short oval, nval;
451         int change;
452
453         snd_ice1712_save_gpio_status(ice);
454         oval = wm_get(ice, WM_ADC_MUX);
455         nval = oval & ~0x77;
456         nval |= ucontrol->value.integer.value[0] & 7;
457         nval |= (ucontrol->value.integer.value[1] & 7) << 4;
458         change = (oval != nval);
459         if (change)
460                 wm_put(ice, WM_ADC_MUX, nval);
461         snd_ice1712_restore_gpio_status(ice);
462         return 0;
463 }
464
465 /*
466  * mixers
467  */
468
469 static snd_kcontrol_new_t prodigy71_dac_control __devinitdata = {
470         .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
471         .name = "DAC Volume",
472         .count = 8,
473         .info = wm_dac_vol_info,
474         .get = wm_dac_vol_get,
475         .put = wm_dac_vol_put,
476 };
477
478 static snd_kcontrol_new_t wm_controls[] __devinitdata = {
479         {
480                 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
481                 .name = "Master Playback Volume",
482                 .info = wm_dac_vol_info,
483                 .get = wm_dac_vol_get,
484                 .put = wm_dac_vol_put,
485                 .private_value = 1,
486         },
487         {
488                 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
489                 .name = "ADC Volume",
490                 .count = 2,
491                 .info = wm_adc_vol_info,
492                 .get = wm_adc_vol_get,
493                 .put = wm_adc_vol_put,
494         },
495         {
496                 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
497                 .name = "Capture Route",
498                 .info = wm_adc_mux_info,
499                 .get = wm_adc_mux_get,
500                 .put = wm_adc_mux_put,
501         },
502         PRODIGY_CON_HPAMP ,
503         PRODIGY_CON_DEEMP ,
504         PRODIGY_CON_OVERSAMPLING
505 };
506
507
508 static int __devinit prodigy_add_controls(ice1712_t *ice)
509 {
510         unsigned int i;
511         int err;
512
513         err = snd_ctl_add(ice->card, snd_ctl_new1(&prodigy71_dac_control, ice));
514         if (err < 0)
515                 return err;
516
517         for (i = 0; i < ARRAY_SIZE(wm_controls); i++) {
518                 err = snd_ctl_add(ice->card, snd_ctl_new1(&wm_controls[i], ice));
519                 if (err < 0)
520                         return err;
521         }
522         return 0;
523 }
524
525
526 /*
527  * initialize the chip
528  */
529 static int __devinit prodigy_init(ice1712_t *ice)
530 {
531         static unsigned short wm_inits[] = {
532
533                 /* These come first to reduce init pop noise */
534                 0x1b, 0x000,            /* ADC Mux */
535                 0x1c, 0x009,            /* Out Mux1 */
536                 0x1d, 0x009,            /* Out Mux2 */
537
538                 0x18, 0x000,            /* All power-up */
539
540                 0x16, 0x022,            /* I2S, normal polarity, 24bit, high-pass on */
541                 0x17, 0x006,            /* 128fs, slave mode */
542
543                 0x00, 0,                /* DAC1 analog mute */
544                 0x01, 0,                /* DAC2 analog mute */
545                 0x02, 0,                /* DAC3 analog mute */
546                 0x03, 0,                /* DAC4 analog mute */
547                 0x04, 0,                /* DAC5 analog mute */
548                 0x05, 0,                /* DAC6 analog mute */
549                 0x06, 0,                /* DAC7 analog mute */
550                 0x07, 0,                /* DAC8 analog mute */
551                 0x08, 0x100,            /* master analog mute */
552
553                 0x09, 0x7f,             /* DAC1 digital full */
554                 0x0a, 0x7f,             /* DAC2 digital full */
555                 0x0b, 0x7f,             /* DAC3 digital full */
556                 0x0c, 0x7f,             /* DAC4 digital full */
557                 0x0d, 0x7f,             /* DAC5 digital full */
558                 0x0e, 0x7f,             /* DAC6 digital full */
559                 0x0f, 0x7f,             /* DAC7 digital full */
560                 0x10, 0x7f,             /* DAC8 digital full */
561                 0x11, 0x1FF,            /* master digital full */
562
563                 0x12, 0x000,            /* phase normal */
564                 0x13, 0x090,            /* unmute DAC L/R */
565                 0x14, 0x000,            /* all unmute */
566                 0x15, 0x000,            /* no deemphasis, no ZFLG */
567
568                 0x19, 0x000,            /* -12dB ADC/L */
569                 0x1a, 0x000             /* -12dB ADC/R */
570
571         };
572
573         static unsigned short cs_inits[] = {
574                 0x0441, /* RUN */
575                 0x0100, /* no mute */
576                 0x0200, /* */
577                 0x0600, /* slave, 24bit */
578         };
579
580         unsigned int tmp;
581         unsigned int i;
582
583         printk(KERN_INFO "ice1724: AudioTrak Prodigy 7.1 driver rev. 0.82b\n");
584         printk(KERN_INFO "ice1724:   This driver is in beta stage. Forsuccess/failure reporting contact\n");
585         printk(KERN_INFO "ice1724:   Apostolos Dimitromanolakis <apostol@cs.utoronto.ca>\n");
586
587         ice->num_total_dacs = 8;
588         ice->num_total_adcs = 8;
589
590         /* to remeber the register values */
591         ice->akm = snd_kcalloc(sizeof(akm4xxx_t), GFP_KERNEL);
592         if (! ice->akm)
593                 return -ENOMEM;
594         ice->akm_codecs = 1;
595
596         snd_ice1712_gpio_set_dir(ice, 0xbfffff); /* fix this for the time being */
597
598         /* reset the wm codec as the SPI mode */
599         snd_ice1712_save_gpio_status(ice);
600         snd_ice1712_gpio_set_mask(ice,~( PRODIGY_WM_RESET|PRODIGY_WM_CS|
601                 PRODIGY_CS8415_CS|PRODIGY_HP_AMP_EN ));
602
603         tmp = snd_ice1712_gpio_read(ice);
604         tmp &= ~PRODIGY_WM_RESET;
605         snd_ice1712_gpio_write(ice, tmp);
606         udelay(1);
607         tmp |= PRODIGY_WM_CS | PRODIGY_CS8415_CS;
608         snd_ice1712_gpio_write(ice, tmp);
609         udelay(1);
610         tmp |= PRODIGY_WM_RESET;
611         snd_ice1712_gpio_write(ice, tmp);
612         udelay(1);
613
614         /* initialize WM8770 codec */
615         for (i = 0; i < ARRAY_SIZE(wm_inits); i += 2)
616                 wm_put(ice, wm_inits[i], wm_inits[i+1]);
617
618         /* initialize CS8415A codec */
619         for (i = 0; i < ARRAY_SIZE(cs_inits); i++)
620                 prodigy_spi_write(ice, PRODIGY_CS8415_CS,
621                                  cs_inits[i] | 0x200000, 24);
622
623
624         prodigy_set_headphone_amp(ice, 1);
625
626         snd_ice1712_restore_gpio_status(ice);
627
628         return 0;
629 }
630
631 /*
632  * Prodigy boards don't provide the EEPROM data except for the vendor IDs.
633  * hence the driver needs to sets up it properly.
634  */
635
636 static unsigned char prodigy71_eeprom[] __devinitdata = {
637         0x2b,   /* SYSCONF: clock 512, mpu401, spdif-in/ADC, 4DACs */
638         0x80,   /* ACLINK: I2S */
639         0xf8,   /* I2S: vol, 96k, 24bit, 192k */
640         0xc3,   /* SPDIF: out-en, out-int, spdif-in */
641         0xff,   /* GPIO_DIR */
642         0xff,   /* GPIO_DIR1 */
643         0xbf,   /* GPIO_DIR2 */
644         0x00,   /* GPIO_MASK */
645         0x00,   /* GPIO_MASK1 */
646         0x00,   /* GPIO_MASK2 */
647         0x00,   /* GPIO_STATE */
648         0x00,   /* GPIO_STATE1 */
649         0x00,   /* GPIO_STATE2 */
650 };
651
652 /* entry point */
653 struct snd_ice1712_card_info snd_vt1724_prodigy_cards[] __devinitdata = {
654         {
655                 .subvendor = VT1724_SUBDEVICE_PRODIGY71,
656                 .name = "Audiotrak Prodigy 7.1",
657                 .chip_init = prodigy_init,
658                 .build_controls = prodigy_add_controls,
659                 .eeprom_size = sizeof(prodigy71_eeprom),
660                 .eeprom_data = prodigy71_eeprom,
661         },
662         { } /* terminator */
663 };