2 * ALSA driver for ICEnsemble VT1724 (Envy24HT)
4 * Lowlevel functions for Terratec Aureon cards
6 * Copyright (c) 2003 Takashi Iwai <tiwai@suse.de>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 * - we reuse the akm4xxx_t record for storing the wm8770 codec data.
26 * both wm and akm codecs are pretty similar, so we can integrate
27 * both controls in the future, once if wm codecs are reused in
30 * - writing over SPI is implemented but reading is not yet.
31 * the SPDIF-in channel status, etc. can be read from CS chip.
33 * - DAC digital volumes are not implemented in the mixer.
34 * if they show better response than DAC analog volumes, we can use them
37 * - Aureon boards are equipped with AC97 codec, too. it's used to do
38 * the analog mixing but not easily controllable (it's not connected
39 * directly from envy24ht chip). so let's leave it as it is.
42 * Lowlevel functions for AudioTrak Prodigy 7.1 (and possibly 192) cards
43 * Copyright (c) 2003 Dimitromanolakis Apostolos <apostol@cs.utoronto.ca>
45 * version 0.82: Stable / not all features work yet (no communication with AC97 secondary)
46 * added 64x/128x oversampling switch (should be 64x only for 96khz)
47 * fixed some recording labels (still need to check the rest)
48 * recording is working probably thanks to correct wm8770 initialization
50 * version 0.5: Initial release:
51 * working: analog output, mixer, headphone amplifier switch
52 * not working: prety much everything else, at least i could verify that
53 * we have no digital output, no capture, pretty bad clicks and poops
54 * on mixer switch and other coll stuff.
56 * - Prodigy boards are equipped with AC97 STAC9744 chip , too. it's used to do
57 * the analog mixing but not easily controllable (it's not connected
58 * directly from envy24ht chip). so let's leave it as it is.
62 #include <sound/driver.h>
64 #include <linux/delay.h>
65 #include <linux/interrupt.h>
66 #include <linux/init.h>
67 #include <linux/slab.h>
68 #include <sound/core.h>
74 /* WM8770 registers */
75 #define WM_DAC_ATTEN 0x00 /* DAC1-8 analog attenuation */
76 #define WM_DAC_MASTER_ATTEN 0x08 /* DAC master analog attenuation */
77 #define WM_DAC_DIG_ATTEN 0x09 /* DAC1-8 digital attenuation */
78 #define WM_DAC_DIG_MATER_ATTEN 0x11 /* DAC master digital attenuation */
79 #define WM_PHASE_SWAP 0x12 /* DAC phase */
80 #define WM_DAC_CTRL1 0x13 /* DAC control bits */
81 #define WM_MUTE 0x14 /* mute controls */
82 #define WM_DAC_CTRL2 0x15 /* de-emphasis and zefo-flag */
83 #define WM_INT_CTRL 0x16 /* interface control */
84 #define WM_MASTER 0x17 /* master clock and mode */
85 #define WM_POWERDOWN 0x18 /* power-down controls */
86 #define WM_ADC_GAIN 0x19 /* ADC gain L(19)/R(1a) */
87 #define WM_ADC_MUX 0x1b /* input MUX */
88 #define WM_OUT_MUX1 0x1c /* output MUX */
89 #define WM_OUT_MUX2 0x1e /* output MUX */
90 #define WM_RESET 0x1f /* software reset */
94 * write data in the SPI mode
96 static void aureon_spi_write(ice1712_t *ice, unsigned int cs, unsigned int data, int bits)
102 tmp = snd_ice1712_gpio_read(ice);
104 if (ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71)
105 cscs = PRODIGY_CS8415_CS;
107 cscs = AUREON_CS8415_CS;
109 snd_ice1712_gpio_set_mask(ice, ~(AUREON_WM_RW|AUREON_WM_DATA|AUREON_WM_CLK|
113 snd_ice1712_gpio_write(ice, tmp);
116 for (i = bits - 1; i >= 0; i--) {
117 tmp &= ~AUREON_WM_CLK;
118 snd_ice1712_gpio_write(ice, tmp);
121 tmp |= AUREON_WM_DATA;
123 tmp &= ~AUREON_WM_DATA;
124 snd_ice1712_gpio_write(ice, tmp);
126 tmp |= AUREON_WM_CLK;
127 snd_ice1712_gpio_write(ice, tmp);
131 tmp &= ~AUREON_WM_CLK;
133 snd_ice1712_gpio_write(ice, tmp);
135 tmp |= AUREON_WM_CLK;
136 snd_ice1712_gpio_write(ice, tmp);
142 * get the current register value of WM codec
144 static unsigned short wm_get(ice1712_t *ice, int reg)
147 return ((unsigned short)ice->akm[0].images[reg] << 8) |
148 ice->akm[0].images[reg + 1];
152 * set the register value of WM codec and remember it
154 static void wm_put(ice1712_t *ice, int reg, unsigned short val)
156 aureon_spi_write(ice, AUREON_WM_CS, (reg << 9) | (val & 0x1ff), 16);
158 ice->akm[0].images[reg] = val >> 8;
159 ice->akm[0].images[reg + 1] = val;
165 static int wm_dac_mute_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
167 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
169 uinfo->value.integer.min = 0;
170 uinfo->value.integer.max = 1;
174 static int wm_dac_mute_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
176 ice1712_t *ice = snd_kcontrol_chip(kcontrol);
179 down(&ice->gpio_mutex);
180 val = wm_get(ice, snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)+WM_MUTE);
181 ucontrol->value.integer.value[0] = ~val>>4 & 0x1;
182 up(&ice->gpio_mutex);
186 static int wm_dac_mute_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
188 ice1712_t *ice = snd_kcontrol_chip(kcontrol);
189 unsigned short new, old;
192 snd_ice1712_save_gpio_status(ice);
193 old = wm_get(ice, snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)+WM_MUTE);
194 new = (~ucontrol->value.integer.value[0]<<4&0x10) | (old&~0x10);
195 change = (new != old);
197 wm_put(ice, snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)+WM_MUTE, new);
198 snd_ice1712_restore_gpio_status(ice);
204 * DAC volume attenuation mixer control
206 static int wm_dac_vol_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
208 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
210 uinfo->value.integer.min = 0; /* mute */
211 uinfo->value.integer.max = 101; /* 0dB */
215 static int wm_dac_vol_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
217 ice1712_t *ice = snd_kcontrol_chip(kcontrol);
221 down(&ice->gpio_mutex);
222 if (kcontrol->private_value)
223 idx = WM_DAC_MASTER_ATTEN;
225 idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + WM_DAC_ATTEN;
226 vol = wm_get(ice, idx) & 0x7f;
228 ucontrol->value.integer.value[0] = 0;
230 ucontrol->value.integer.value[0] = vol - 0x1a;
231 up(&ice->gpio_mutex);
235 static int wm_dac_vol_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
237 ice1712_t *ice = snd_kcontrol_chip(kcontrol);
239 unsigned short ovol, nvol;
242 snd_ice1712_save_gpio_status(ice);
243 if (kcontrol->private_value)
244 idx = WM_DAC_MASTER_ATTEN;
246 idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + WM_DAC_ATTEN;
247 nvol = ucontrol->value.integer.value[0] + 0x1a;
248 ovol = wm_get(ice, idx) & 0x7f;
249 change = (ovol != nvol);
251 if (nvol <= 0x1a && ovol <= 0x1a)
254 wm_put(ice, idx, nvol | 0x180); /* update on zero detect */
256 snd_ice1712_restore_gpio_status(ice);
263 static int wm_adc_mute_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
265 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
267 uinfo->value.integer.min = 0;
268 uinfo->value.integer.max = 1;
272 static int wm_adc_mute_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
274 ice1712_t *ice = snd_kcontrol_chip(kcontrol);
277 down(&ice->gpio_mutex);
278 val = wm_get(ice, snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)+WM_ADC_GAIN);
279 ucontrol->value.integer.value[0] = ~val>>5 & 0x1;
280 up(&ice->gpio_mutex);
284 static int wm_adc_mute_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
286 ice1712_t *ice = snd_kcontrol_chip(kcontrol);
287 unsigned short new, old;
290 snd_ice1712_save_gpio_status(ice);
291 old = wm_get(ice, snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)+WM_ADC_GAIN);
292 new = (~ucontrol->value.integer.value[0]<<5&0x20) | (old&~0x20);
293 change = (new != old);
295 wm_put(ice, snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)+WM_ADC_GAIN, new);
296 snd_ice1712_restore_gpio_status(ice);
302 * ADC gain mixer control
304 static int wm_adc_vol_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
306 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
308 uinfo->value.integer.min = 0; /* -12dB */
309 uinfo->value.integer.max = 0x1f; /* 19dB */
313 static int wm_adc_vol_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
315 ice1712_t *ice = snd_kcontrol_chip(kcontrol);
319 down(&ice->gpio_mutex);
320 idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + WM_ADC_GAIN;
321 vol = wm_get(ice, idx) & 0x1f;
322 ucontrol->value.integer.value[0] = vol;
323 up(&ice->gpio_mutex);
327 static int wm_adc_vol_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
329 ice1712_t *ice = snd_kcontrol_chip(kcontrol);
331 unsigned short ovol, nvol;
334 snd_ice1712_save_gpio_status(ice);
335 idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + WM_ADC_GAIN;
336 nvol = ucontrol->value.integer.value[0];
337 ovol = wm_get(ice, idx);
338 change = ((ovol & 0x1f) != nvol);
340 wm_put(ice, idx, nvol | (ovol & ~0x1f));
341 snd_ice1712_restore_gpio_status(ice);
346 * ADC input mux mixer control
348 static int wm_adc_mux_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
350 static char *texts[] = {
357 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
359 uinfo->value.enumerated.items = 5;
360 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
361 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
362 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
366 static int wm_adc_mux_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *ucontrol)
368 ice1712_t *ice = snd_kcontrol_chip(kcontrol);
371 down(&ice->gpio_mutex);
372 val = wm_get(ice, WM_ADC_MUX);
373 ucontrol->value.integer.value[0] = val & 7;
374 ucontrol->value.integer.value[1] = (val >> 4) & 7;
375 up(&ice->gpio_mutex);
379 static int wm_adc_mux_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *ucontrol)
381 ice1712_t *ice = snd_kcontrol_chip(kcontrol);
382 unsigned short oval, nval;
385 snd_ice1712_save_gpio_status(ice);
386 oval = wm_get(ice, WM_ADC_MUX);
388 nval |= ucontrol->value.integer.value[0] & 7;
389 nval |= (ucontrol->value.integer.value[1] & 7) << 4;
390 change = (oval != nval);
392 wm_put(ice, WM_ADC_MUX, nval);
393 snd_ice1712_restore_gpio_status(ice);
398 * Headphone Amplifier
400 static int aureon_set_headphone_amp(ice1712_t *ice, int enable)
402 unsigned int tmp, tmp2;
404 tmp2 = tmp = snd_ice1712_gpio_read(ice);
406 tmp |= AUREON_HP_SEL;
408 tmp &= ~ AUREON_HP_SEL;
410 snd_ice1712_gpio_write(ice, tmp);
416 static int aureon_get_headphone_amp(ice1712_t *ice)
418 unsigned int tmp = snd_ice1712_gpio_read(ice);
420 return ( tmp & AUREON_HP_SEL )!= 0;
423 static int aureon_bool_info(snd_kcontrol_t *k, snd_ctl_elem_info_t *uinfo)
425 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
427 uinfo->value.integer.min = 0;
428 uinfo->value.integer.max = 1;
432 static int aureon_hpamp_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
434 ice1712_t *ice = snd_kcontrol_chip(kcontrol);
436 ucontrol->value.integer.value[0] = aureon_get_headphone_amp(ice);
441 static int aureon_hpamp_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
443 ice1712_t *ice = snd_kcontrol_chip(kcontrol);
445 return aureon_set_headphone_amp(ice,ucontrol->value.integer.value[0]);
451 static int aureon_deemp_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
453 ice1712_t *ice = snd_kcontrol_chip(kcontrol);
454 ucontrol->value.integer.value[0] = (wm_get(ice, WM_DAC_CTRL2) & 0xf) == 0xf;
458 static int aureon_deemp_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
460 ice1712_t *ice = snd_kcontrol_chip(kcontrol);
462 temp2 = temp = wm_get(ice, WM_DAC_CTRL2);
463 if (ucontrol->value.integer.value[0])
468 wm_put(ice, WM_DAC_CTRL2, temp);
477 static int aureon_oversampling_info(snd_kcontrol_t *k, snd_ctl_elem_info_t *uinfo)
479 static char *texts[2] = { "128x", "64x" };
481 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
483 uinfo->value.enumerated.items = 2;
485 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
486 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
487 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
492 static int aureon_oversampling_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
494 ice1712_t *ice = snd_kcontrol_chip(kcontrol);
495 ucontrol->value.enumerated.item[0] = (wm_get(ice, WM_MASTER) & 0x8) == 0x8;
499 static int aureon_oversampling_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
502 ice1712_t *ice = snd_kcontrol_chip(kcontrol);
504 temp2 = temp = wm_get(ice, WM_MASTER);
506 if (ucontrol->value.enumerated.item[0])
512 wm_put(ice, WM_MASTER, temp);
522 static snd_kcontrol_new_t aureon51_dac_control __devinitdata = {
523 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
524 .name = "DAC Volume",
526 .info = wm_dac_vol_info,
527 .get = wm_dac_vol_get,
528 .put = wm_dac_vol_put,
531 static snd_kcontrol_new_t aureon71_dac_control __devinitdata = {
532 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
533 .name = "DAC Volume",
535 .info = wm_dac_vol_info,
536 .get = wm_dac_vol_get,
537 .put = wm_dac_vol_put,
540 static snd_kcontrol_new_t wm_controls[] __devinitdata = {
542 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
543 .name = "Master Playback Switch",
544 .info = wm_dac_mute_info,
545 .get = wm_dac_mute_get,
546 .put = wm_dac_mute_put,
549 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
550 .name = "Master Playback Volume",
551 .info = wm_dac_vol_info,
552 .get = wm_dac_vol_get,
553 .put = wm_dac_vol_put,
557 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
558 .name = "ADC Switch",
560 .info = wm_adc_mute_info,
561 .get = wm_adc_mute_get,
562 .put = wm_adc_mute_put,
566 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
567 .name = "ADC Volume",
569 .info = wm_adc_vol_info,
570 .get = wm_adc_vol_get,
571 .put = wm_adc_vol_put,
574 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
575 .name = "Capture Route",
576 .info = wm_adc_mux_info,
577 .get = wm_adc_mux_get,
578 .put = wm_adc_mux_put,
581 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
582 .name = "Headphone Amplifier Switch",
583 .info = aureon_bool_info,
584 .get = aureon_hpamp_get,
585 .put = aureon_hpamp_put
588 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
589 .name = "DAC Deemphasis Switch",
590 .info = aureon_bool_info,
591 .get = aureon_deemp_get,
592 .put = aureon_deemp_put
595 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
596 .name = "ADC Oversampling",
597 .info = aureon_oversampling_info,
598 .get = aureon_oversampling_get,
599 .put = aureon_oversampling_put
604 static int __devinit aureon_add_controls(ice1712_t *ice)
609 if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AUREON51_SKY)
610 err = snd_ctl_add(ice->card, snd_ctl_new1(&aureon51_dac_control, ice));
612 err = snd_ctl_add(ice->card, snd_ctl_new1(&aureon71_dac_control, ice));
616 for (i = 0; i < ARRAY_SIZE(wm_controls); i++) {
617 err = snd_ctl_add(ice->card, snd_ctl_new1(&wm_controls[i], ice));
626 * initialize the chip
628 static int __devinit aureon_init(ice1712_t *ice)
630 static unsigned short wm_inits_aureon[] = {
631 /* These come first to reduce init pop noise */
632 0x1b, 0x000, /* ADC Mux */
633 0x1c, 0x009, /* Out Mux1 */
634 0x1d, 0x009, /* Out Mux2 */
636 0x18, 0x000, /* All power-up */
638 0x16, 0x122, /* I2S, normal polarity, 24bit */
639 0x17, 0x022, /* 256fs, slave mode */
640 0x00, 0, /* DAC1 analog mute */
641 0x01, 0, /* DAC2 analog mute */
642 0x02, 0, /* DAC3 analog mute */
643 0x03, 0, /* DAC4 analog mute */
644 0x04, 0, /* DAC5 analog mute */
645 0x05, 0, /* DAC6 analog mute */
646 0x06, 0, /* DAC7 analog mute */
647 0x07, 0, /* DAC8 analog mute */
648 0x08, 0x100, /* master analog mute */
649 0x09, 0xff, /* DAC1 digital full */
650 0x0a, 0xff, /* DAC2 digital full */
651 0x0b, 0xff, /* DAC3 digital full */
652 0x0c, 0xff, /* DAC4 digital full */
653 0x0d, 0xff, /* DAC5 digital full */
654 0x0e, 0xff, /* DAC6 digital full */
655 0x0f, 0xff, /* DAC7 digital full */
656 0x10, 0xff, /* DAC8 digital full */
657 0x11, 0x1ff, /* master digital full */
658 0x12, 0x000, /* phase normal */
659 0x13, 0x090, /* unmute DAC L/R */
660 0x14, 0x000, /* all unmute */
661 0x15, 0x000, /* no deemphasis, no ZFLG */
662 0x19, 0x000, /* -12dB ADC/L */
663 0x1a, 0x000, /* -12dB ADC/R */
666 static unsigned short wm_inits_prodigy[] = {
668 /* These come first to reduce init pop noise */
669 0x1b, 0x000, /* ADC Mux */
670 0x1c, 0x009, /* Out Mux1 */
671 0x1d, 0x009, /* Out Mux2 */
673 0x18, 0x000, /* All power-up */
675 0x16, 0x022, /* I2S, normal polarity, 24bit, high-pass on */
676 0x17, 0x006, /* 128fs, slave mode */
678 0x00, 0, /* DAC1 analog mute */
679 0x01, 0, /* DAC2 analog mute */
680 0x02, 0, /* DAC3 analog mute */
681 0x03, 0, /* DAC4 analog mute */
682 0x04, 0, /* DAC5 analog mute */
683 0x05, 0, /* DAC6 analog mute */
684 0x06, 0, /* DAC7 analog mute */
685 0x07, 0, /* DAC8 analog mute */
686 0x08, 0x100, /* master analog mute */
688 0x09, 0x7f, /* DAC1 digital full */
689 0x0a, 0x7f, /* DAC2 digital full */
690 0x0b, 0x7f, /* DAC3 digital full */
691 0x0c, 0x7f, /* DAC4 digital full */
692 0x0d, 0x7f, /* DAC5 digital full */
693 0x0e, 0x7f, /* DAC6 digital full */
694 0x0f, 0x7f, /* DAC7 digital full */
695 0x10, 0x7f, /* DAC8 digital full */
696 0x11, 0x1FF, /* master digital full */
698 0x12, 0x000, /* phase normal */
699 0x13, 0x090, /* unmute DAC L/R */
700 0x14, 0x000, /* all unmute */
701 0x15, 0x000, /* no deemphasis, no ZFLG */
703 0x19, 0x000, /* -12dB ADC/L */
704 0x1a, 0x000, /* -12dB ADC/R */
708 static unsigned short cs_inits[] = {
710 0x0100, /* no mute */
712 0x0600, /* slave, 24bit */
719 if (ice->eeprom.subvendor == VT1724_SUBDEVICE_AUREON51_SKY) {
720 ice->num_total_dacs = 6;
721 ice->num_total_adcs = 6;
723 /* aureon 7.1 and prodigy 7.1 */
724 ice->num_total_dacs = 8;
725 ice->num_total_adcs = 8;
728 /* to remeber the register values */
729 ice->akm = snd_kcalloc(sizeof(akm4xxx_t), GFP_KERNEL);
734 if (ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71)
735 cscs = PRODIGY_CS8415_CS;
737 cscs = AUREON_CS8415_CS;
739 snd_ice1712_gpio_set_dir(ice, 0xbfffff); /* fix this for the time being */
741 /* reset the wm codec as the SPI mode */
742 snd_ice1712_save_gpio_status(ice);
743 snd_ice1712_gpio_set_mask(ice, ~(AUREON_WM_RESET|AUREON_WM_CS|
744 cscs|AUREON_HP_SEL));
745 tmp = snd_ice1712_gpio_read(ice);
746 tmp &= ~AUREON_WM_RESET;
747 snd_ice1712_gpio_write(ice, tmp);
749 tmp |= AUREON_WM_CS | cscs;
750 snd_ice1712_gpio_write(ice, tmp);
752 tmp |= AUREON_WM_RESET;
753 snd_ice1712_gpio_write(ice, tmp);
756 /* initialize WM8770 codec */
757 if (ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71)
758 p = wm_inits_prodigy;
761 for (; *p != (unsigned short)-1; p += 2)
762 wm_put(ice, p[0], p[1]);
764 /* initialize CS8415A codec */
765 for (p = cs_inits; *p != (unsigned short)-1; p++)
766 aureon_spi_write(ice, cscs,
769 aureon_set_headphone_amp(ice, 1);
771 snd_ice1712_restore_gpio_status(ice);
778 * Aureon boards don't provide the EEPROM data except for the vendor IDs.
779 * hence the driver needs to sets up it properly.
782 static unsigned char aureon51_eeprom[] __devinitdata = {
783 0x2a, /* SYSCONF: clock 512, mpu401, spdif-in/ADC, 3DACs */
784 0x80, /* ACLINK: I2S */
785 0xf8, /* I2S: vol, 96k, 24bit, 192k */
786 0xc3, /* SPDIF: out-en, out-int, spdif-in */
788 0xff, /* GPIO_DIR1 */
789 0xbf, /* GPIO_DIR2 */
790 0xff, /* GPIO_MASK */
791 0xff, /* GPIO_MASK1 */
792 0xff, /* GPIO_MASK2 */
793 0x00, /* GPIO_STATE */
794 0x00, /* GPIO_STATE1 */
795 0x00, /* GPIO_STATE2 */
798 static unsigned char aureon71_eeprom[] __devinitdata = {
799 0x2b, /* SYSCONF: clock 512, mpu401, spdif-in/ADC, 4DACs */
800 0x80, /* ACLINK: I2S */
801 0xf8, /* I2S: vol, 96k, 24bit, 192k */
802 0xc3, /* SPDIF: out-en, out-int, spdif-in */
804 0xff, /* GPIO_DIR1 */
805 0xbf, /* GPIO_DIR2 */
806 0x00, /* GPIO_MASK */
807 0x00, /* GPIO_MASK1 */
808 0x00, /* GPIO_MASK2 */
809 0x00, /* GPIO_STATE */
810 0x00, /* GPIO_STATE1 */
811 0x00, /* GPIO_STATE2 */
814 static unsigned char prodigy71_eeprom[] __devinitdata = {
815 0x2b, /* SYSCONF: clock 512, mpu401, spdif-in/ADC, 4DACs */
816 0x80, /* ACLINK: I2S */
817 0xf8, /* I2S: vol, 96k, 24bit, 192k */
818 0xc3, /* SPDIF: out-en, out-int, spdif-in */
820 0xff, /* GPIO_DIR1 */
821 0xbf, /* GPIO_DIR2 */
822 0x00, /* GPIO_MASK */
823 0x00, /* GPIO_MASK1 */
824 0x00, /* GPIO_MASK2 */
825 0x00, /* GPIO_STATE */
826 0x00, /* GPIO_STATE1 */
827 0x00, /* GPIO_STATE2 */
831 struct snd_ice1712_card_info snd_vt1724_aureon_cards[] __devinitdata = {
833 .subvendor = VT1724_SUBDEVICE_AUREON51_SKY,
834 .name = "Terratec Aureon 5.1-Sky",
836 .chip_init = aureon_init,
837 .build_controls = aureon_add_controls,
838 .eeprom_size = sizeof(aureon51_eeprom),
839 .eeprom_data = aureon51_eeprom,
842 .subvendor = VT1724_SUBDEVICE_AUREON71_SPACE,
843 .name = "Terratec Aureon 7.1-Space",
845 .chip_init = aureon_init,
846 .build_controls = aureon_add_controls,
847 .eeprom_size = sizeof(aureon71_eeprom),
848 .eeprom_data = aureon71_eeprom,
851 .subvendor = VT1724_SUBDEVICE_AUREON71_UNIVERSE,
852 .name = "Terratec Aureon 7.1-Universe",
853 /* model not needed - identical with 7.1-Space */
854 .chip_init = aureon_init,
855 .build_controls = aureon_add_controls,
856 .eeprom_size = sizeof(aureon71_eeprom),
857 .eeprom_data = aureon71_eeprom,
860 .subvendor = VT1724_SUBDEVICE_PRODIGY71,
861 .name = "Audiotrak Prodigy 7.1",
862 .model = "prodigy71",
863 .chip_init = aureon_init,
864 .build_controls = aureon_add_controls,
865 .eeprom_size = sizeof(prodigy71_eeprom),
866 .eeprom_data = prodigy71_eeprom,