2 * ALSA driver for ICEnsemble ICE1712 (Envy24)
4 * Lowlevel functions for M-Audio Delta 1010, 44, 66, Dio2496, Audiophile
7 * Copyright (c) 2000 Jaroslav Kysela <perex@perex.cz>
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.
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.
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
26 #include <linux/delay.h>
27 #include <linux/interrupt.h>
28 #include <linux/init.h>
29 #include <linux/slab.h>
30 #include <linux/mutex.h>
32 #include <sound/core.h>
33 #include <sound/cs8427.h>
34 #include <sound/asoundef.h>
40 #include <sound/cs8403.h>
44 * CS8427 via SPI mode (for Audiophile), emulated I2C
48 static void ap_cs8427_write_byte(struct snd_ice1712
*ice
, unsigned char data
, unsigned char tmp
)
52 for (idx
= 7; idx
>= 0; idx
--) {
53 tmp
&= ~(ICE1712_DELTA_AP_DOUT
|ICE1712_DELTA_AP_CCLK
);
54 if (data
& (1 << idx
))
55 tmp
|= ICE1712_DELTA_AP_DOUT
;
56 snd_ice1712_write(ice
, ICE1712_IREG_GPIO_DATA
, tmp
);
58 tmp
|= ICE1712_DELTA_AP_CCLK
;
59 snd_ice1712_write(ice
, ICE1712_IREG_GPIO_DATA
, tmp
);
65 static unsigned char ap_cs8427_read_byte(struct snd_ice1712
*ice
, unsigned char tmp
)
67 unsigned char data
= 0;
70 for (idx
= 7; idx
>= 0; idx
--) {
71 tmp
&= ~ICE1712_DELTA_AP_CCLK
;
72 snd_ice1712_write(ice
, ICE1712_IREG_GPIO_DATA
, tmp
);
74 if (snd_ice1712_read(ice
, ICE1712_IREG_GPIO_DATA
) & ICE1712_DELTA_AP_DIN
)
76 tmp
|= ICE1712_DELTA_AP_CCLK
;
77 snd_ice1712_write(ice
, ICE1712_IREG_GPIO_DATA
, tmp
);
83 /* assert chip select */
84 static unsigned char ap_cs8427_codec_select(struct snd_ice1712
*ice
)
87 tmp
= snd_ice1712_read(ice
, ICE1712_IREG_GPIO_DATA
);
88 switch (ice
->eeprom
.subvendor
) {
89 case ICE1712_SUBDEVICE_DELTA1010LT
:
90 tmp
&= ~ICE1712_DELTA_1010LT_CS
;
91 tmp
|= ICE1712_DELTA_1010LT_CCLK
| ICE1712_DELTA_1010LT_CS_CS8427
;
93 case ICE1712_SUBDEVICE_AUDIOPHILE
:
94 case ICE1712_SUBDEVICE_DELTA410
:
95 tmp
|= ICE1712_DELTA_AP_CCLK
| ICE1712_DELTA_AP_CS_CODEC
;
96 tmp
&= ~ICE1712_DELTA_AP_CS_DIGITAL
;
98 case ICE1712_SUBDEVICE_VX442
:
99 tmp
|= ICE1712_VX442_CCLK
| ICE1712_VX442_CODEC_CHIP_A
| ICE1712_VX442_CODEC_CHIP_B
;
100 tmp
&= ~ICE1712_VX442_CS_DIGITAL
;
103 snd_ice1712_write(ice
, ICE1712_IREG_GPIO_DATA
, tmp
);
108 /* deassert chip select */
109 static void ap_cs8427_codec_deassert(struct snd_ice1712
*ice
, unsigned char tmp
)
111 switch (ice
->eeprom
.subvendor
) {
112 case ICE1712_SUBDEVICE_DELTA1010LT
:
113 tmp
&= ~ICE1712_DELTA_1010LT_CS
;
114 tmp
|= ICE1712_DELTA_1010LT_CS_NONE
;
116 case ICE1712_SUBDEVICE_AUDIOPHILE
:
117 case ICE1712_SUBDEVICE_DELTA410
:
118 tmp
|= ICE1712_DELTA_AP_CS_DIGITAL
;
120 case ICE1712_SUBDEVICE_VX442
:
121 tmp
|= ICE1712_VX442_CS_DIGITAL
;
124 snd_ice1712_write(ice
, ICE1712_IREG_GPIO_DATA
, tmp
);
127 /* sequential write */
128 static int ap_cs8427_sendbytes(struct snd_i2c_device
*device
, unsigned char *bytes
, int count
)
130 struct snd_ice1712
*ice
= device
->bus
->private_data
;
134 mutex_lock(&ice
->gpio_mutex
);
135 tmp
= ap_cs8427_codec_select(ice
);
136 ap_cs8427_write_byte(ice
, (device
->addr
<< 1) | 0, tmp
); /* address + write mode */
138 ap_cs8427_write_byte(ice
, *bytes
++, tmp
);
139 ap_cs8427_codec_deassert(ice
, tmp
);
140 mutex_unlock(&ice
->gpio_mutex
);
144 /* sequential read */
145 static int ap_cs8427_readbytes(struct snd_i2c_device
*device
, unsigned char *bytes
, int count
)
147 struct snd_ice1712
*ice
= device
->bus
->private_data
;
151 mutex_lock(&ice
->gpio_mutex
);
152 tmp
= ap_cs8427_codec_select(ice
);
153 ap_cs8427_write_byte(ice
, (device
->addr
<< 1) | 1, tmp
); /* address + read mode */
155 *bytes
++ = ap_cs8427_read_byte(ice
, tmp
);
156 ap_cs8427_codec_deassert(ice
, tmp
);
157 mutex_unlock(&ice
->gpio_mutex
);
161 static int ap_cs8427_probeaddr(struct snd_i2c_bus
*bus
, unsigned short addr
)
168 static struct snd_i2c_ops ap_cs8427_i2c_ops
= {
169 .sendbytes
= ap_cs8427_sendbytes
,
170 .readbytes
= ap_cs8427_readbytes
,
171 .probeaddr
= ap_cs8427_probeaddr
,
177 static void snd_ice1712_delta_cs8403_spdif_write(struct snd_ice1712
*ice
, unsigned char bits
)
179 unsigned char tmp
, mask1
, mask2
;
181 /* send byte to transmitter */
182 mask1
= ICE1712_DELTA_SPDIF_OUT_STAT_CLOCK
;
183 mask2
= ICE1712_DELTA_SPDIF_OUT_STAT_DATA
;
184 mutex_lock(&ice
->gpio_mutex
);
185 tmp
= snd_ice1712_read(ice
, ICE1712_IREG_GPIO_DATA
);
186 for (idx
= 7; idx
>= 0; idx
--) {
187 tmp
&= ~(mask1
| mask2
);
188 if (bits
& (1 << idx
))
190 snd_ice1712_write(ice
, ICE1712_IREG_GPIO_DATA
, tmp
);
193 snd_ice1712_write(ice
, ICE1712_IREG_GPIO_DATA
, tmp
);
197 snd_ice1712_write(ice
, ICE1712_IREG_GPIO_DATA
, tmp
);
198 mutex_unlock(&ice
->gpio_mutex
);
202 static void delta_spdif_default_get(struct snd_ice1712
*ice
, struct snd_ctl_elem_value
*ucontrol
)
204 snd_cs8403_decode_spdif_bits(&ucontrol
->value
.iec958
, ice
->spdif
.cs8403_bits
);
207 static int delta_spdif_default_put(struct snd_ice1712
*ice
, struct snd_ctl_elem_value
*ucontrol
)
212 val
= snd_cs8403_encode_spdif_bits(&ucontrol
->value
.iec958
);
213 spin_lock_irq(&ice
->reg_lock
);
214 change
= ice
->spdif
.cs8403_bits
!= val
;
215 ice
->spdif
.cs8403_bits
= val
;
216 if (change
&& ice
->playback_pro_substream
== NULL
) {
217 spin_unlock_irq(&ice
->reg_lock
);
218 snd_ice1712_delta_cs8403_spdif_write(ice
, val
);
220 spin_unlock_irq(&ice
->reg_lock
);
225 static void delta_spdif_stream_get(struct snd_ice1712
*ice
, struct snd_ctl_elem_value
*ucontrol
)
227 snd_cs8403_decode_spdif_bits(&ucontrol
->value
.iec958
, ice
->spdif
.cs8403_stream_bits
);
230 static int delta_spdif_stream_put(struct snd_ice1712
*ice
, struct snd_ctl_elem_value
*ucontrol
)
235 val
= snd_cs8403_encode_spdif_bits(&ucontrol
->value
.iec958
);
236 spin_lock_irq(&ice
->reg_lock
);
237 change
= ice
->spdif
.cs8403_stream_bits
!= val
;
238 ice
->spdif
.cs8403_stream_bits
= val
;
239 if (change
&& ice
->playback_pro_substream
!= NULL
) {
240 spin_unlock_irq(&ice
->reg_lock
);
241 snd_ice1712_delta_cs8403_spdif_write(ice
, val
);
243 spin_unlock_irq(&ice
->reg_lock
);
250 * AK4524 on Delta 44 and 66 to choose the chip mask
252 static void delta_ak4524_lock(struct snd_akm4xxx
*ak
, int chip
)
254 struct snd_ak4xxx_private
*priv
= (void *)ak
->private_value
[0];
255 struct snd_ice1712
*ice
= ak
->private_data
[0];
257 snd_ice1712_save_gpio_status(ice
);
259 priv
->cs_addr
= chip
== 0 ? ICE1712_DELTA_CODEC_CHIP_A
:
260 ICE1712_DELTA_CODEC_CHIP_B
;
264 * AK4524 on Delta1010LT to choose the chip address
266 static void delta1010lt_ak4524_lock(struct snd_akm4xxx
*ak
, int chip
)
268 struct snd_ak4xxx_private
*priv
= (void *)ak
->private_value
[0];
269 struct snd_ice1712
*ice
= ak
->private_data
[0];
271 snd_ice1712_save_gpio_status(ice
);
272 priv
->cs_mask
= ICE1712_DELTA_1010LT_CS
;
273 priv
->cs_addr
= chip
<< 4;
277 * AK4528 on VX442 to choose the chip mask
279 static void vx442_ak4524_lock(struct snd_akm4xxx
*ak
, int chip
)
281 struct snd_ak4xxx_private
*priv
= (void *)ak
->private_value
[0];
282 struct snd_ice1712
*ice
= ak
->private_data
[0];
284 snd_ice1712_save_gpio_status(ice
);
286 priv
->cs_addr
= chip
== 0 ? ICE1712_VX442_CODEC_CHIP_A
:
287 ICE1712_VX442_CODEC_CHIP_B
;
291 * change the DFS bit according rate for Delta1010
293 static void delta_1010_set_rate_val(struct snd_ice1712
*ice
, unsigned int rate
)
295 unsigned char tmp
, tmp2
;
297 if (rate
== 0) /* no hint - S/PDIF input is master, simply return */
300 mutex_lock(&ice
->gpio_mutex
);
301 tmp
= snd_ice1712_read(ice
, ICE1712_IREG_GPIO_DATA
);
302 tmp2
= tmp
& ~ICE1712_DELTA_DFS
;
304 tmp2
|= ICE1712_DELTA_DFS
;
306 snd_ice1712_write(ice
, ICE1712_IREG_GPIO_DATA
, tmp2
);
307 mutex_unlock(&ice
->gpio_mutex
);
311 * change the rate of AK4524 on Delta 44/66, AP, 1010LT
313 static void delta_ak4524_set_rate_val(struct snd_akm4xxx
*ak
, unsigned int rate
)
315 unsigned char tmp
, tmp2
;
316 struct snd_ice1712
*ice
= ak
->private_data
[0];
318 if (rate
== 0) /* no hint - S/PDIF input is master, simply return */
321 /* check before reset ak4524 to avoid unnecessary clicks */
322 mutex_lock(&ice
->gpio_mutex
);
323 tmp
= snd_ice1712_read(ice
, ICE1712_IREG_GPIO_DATA
);
324 mutex_unlock(&ice
->gpio_mutex
);
325 tmp2
= tmp
& ~ICE1712_DELTA_DFS
;
327 tmp2
|= ICE1712_DELTA_DFS
;
332 snd_akm4xxx_reset(ak
, 1);
333 mutex_lock(&ice
->gpio_mutex
);
334 tmp
= snd_ice1712_read(ice
, ICE1712_IREG_GPIO_DATA
) & ~ICE1712_DELTA_DFS
;
336 tmp
|= ICE1712_DELTA_DFS
;
337 snd_ice1712_write(ice
, ICE1712_IREG_GPIO_DATA
, tmp
);
338 mutex_unlock(&ice
->gpio_mutex
);
339 snd_akm4xxx_reset(ak
, 0);
343 * change the rate of AK4524 on VX442
345 static void vx442_ak4524_set_rate_val(struct snd_akm4xxx
*ak
, unsigned int rate
)
349 val
= (rate
> 48000) ? 0x65 : 0x60;
350 if (snd_akm4xxx_get(ak
, 0, 0x02) != val
||
351 snd_akm4xxx_get(ak
, 1, 0x02) != val
) {
352 snd_akm4xxx_reset(ak
, 1);
353 snd_akm4xxx_write(ak
, 0, 0x02, val
);
354 snd_akm4xxx_write(ak
, 1, 0x02, val
);
355 snd_akm4xxx_reset(ak
, 0);
361 * SPDIF ops for Delta 1010, Dio, 66
365 static void delta_open_spdif(struct snd_ice1712
*ice
, struct snd_pcm_substream
*substream
)
367 ice
->spdif
.cs8403_stream_bits
= ice
->spdif
.cs8403_bits
;
371 static void delta_setup_spdif(struct snd_ice1712
*ice
, int rate
)
377 spin_lock_irqsave(&ice
->reg_lock
, flags
);
378 tmp
= ice
->spdif
.cs8403_stream_bits
;
379 if (tmp
& 0x01) /* consumer */
380 tmp
&= (tmp
& 0x01) ? ~0x06 : ~0x18;
382 case 32000: tmp
|= (tmp
& 0x01) ? 0x04 : 0x00; break;
383 case 44100: tmp
|= (tmp
& 0x01) ? 0x00 : 0x10; break;
384 case 48000: tmp
|= (tmp
& 0x01) ? 0x02 : 0x08; break;
385 default: tmp
|= (tmp
& 0x01) ? 0x00 : 0x18; break;
387 change
= ice
->spdif
.cs8403_stream_bits
!= tmp
;
388 ice
->spdif
.cs8403_stream_bits
= tmp
;
389 spin_unlock_irqrestore(&ice
->reg_lock
, flags
);
391 snd_ctl_notify(ice
->card
, SNDRV_CTL_EVENT_MASK_VALUE
, &ice
->spdif
.stream_ctl
->id
);
392 snd_ice1712_delta_cs8403_spdif_write(ice
, tmp
);
395 #define snd_ice1712_delta1010lt_wordclock_status_info \
396 snd_ctl_boolean_mono_info
398 static int snd_ice1712_delta1010lt_wordclock_status_get(struct snd_kcontrol
*kcontrol
,
399 struct snd_ctl_elem_value
*ucontrol
)
401 char reg
= 0x10; // cs8427 receiver error register
402 struct snd_ice1712
*ice
= snd_kcontrol_chip(kcontrol
);
404 if (snd_i2c_sendbytes(ice
->cs8427
, ®
, 1) != 1)
405 snd_printk(KERN_ERR
"unable to send register 0x%x byte to CS8427\n", reg
);
406 snd_i2c_readbytes(ice
->cs8427
, ®
, 1);
407 ucontrol
->value
.integer
.value
[0] = (reg
& CS8427_UNLOCK
) ? 1 : 0;
411 static struct snd_kcontrol_new snd_ice1712_delta1010lt_wordclock_status __devinitdata
=
413 .access
= (SNDRV_CTL_ELEM_ACCESS_READ
),
414 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
415 .name
= "Word Clock Status",
416 .info
= snd_ice1712_delta1010lt_wordclock_status_info
,
417 .get
= snd_ice1712_delta1010lt_wordclock_status_get
,
421 * initialize the chips on M-Audio cards
424 static struct snd_akm4xxx akm_audiophile __devinitdata
= {
429 .set_rate_val
= delta_ak4524_set_rate_val
433 static struct snd_ak4xxx_private akm_audiophile_priv __devinitdata
= {
436 .data_mask
= ICE1712_DELTA_AP_DOUT
,
437 .clk_mask
= ICE1712_DELTA_AP_CCLK
,
438 .cs_mask
= ICE1712_DELTA_AP_CS_CODEC
,
439 .cs_addr
= ICE1712_DELTA_AP_CS_CODEC
,
441 .add_flags
= ICE1712_DELTA_AP_CS_DIGITAL
,
445 static struct snd_akm4xxx akm_delta410 __devinitdata
= {
450 .set_rate_val
= delta_ak4524_set_rate_val
454 static struct snd_ak4xxx_private akm_delta410_priv __devinitdata
= {
457 .data_mask
= ICE1712_DELTA_AP_DOUT
,
458 .clk_mask
= ICE1712_DELTA_AP_CCLK
,
459 .cs_mask
= ICE1712_DELTA_AP_CS_CODEC
,
460 .cs_addr
= ICE1712_DELTA_AP_CS_CODEC
,
462 .add_flags
= ICE1712_DELTA_AP_CS_DIGITAL
,
466 static struct snd_akm4xxx akm_delta1010lt __devinitdata
= {
471 .lock
= delta1010lt_ak4524_lock
,
472 .set_rate_val
= delta_ak4524_set_rate_val
476 static struct snd_ak4xxx_private akm_delta1010lt_priv __devinitdata
= {
478 .cif
= 0, /* the default level of the CIF pin from AK4524 */
479 .data_mask
= ICE1712_DELTA_1010LT_DOUT
,
480 .clk_mask
= ICE1712_DELTA_1010LT_CCLK
,
482 .cs_addr
= 0, /* set later */
483 .cs_none
= ICE1712_DELTA_1010LT_CS_NONE
,
488 static struct snd_akm4xxx akm_delta44 __devinitdata
= {
493 .lock
= delta_ak4524_lock
,
494 .set_rate_val
= delta_ak4524_set_rate_val
498 static struct snd_ak4xxx_private akm_delta44_priv __devinitdata
= {
500 .cif
= 0, /* the default level of the CIF pin from AK4524 */
501 .data_mask
= ICE1712_DELTA_CODEC_SERIAL_DATA
,
502 .clk_mask
= ICE1712_DELTA_CODEC_SERIAL_CLOCK
,
504 .cs_addr
= 0, /* set later */
510 static struct snd_akm4xxx akm_vx442 __devinitdata
= {
515 .lock
= vx442_ak4524_lock
,
516 .set_rate_val
= vx442_ak4524_set_rate_val
520 static struct snd_ak4xxx_private akm_vx442_priv __devinitdata
= {
523 .data_mask
= ICE1712_VX442_DOUT
,
524 .clk_mask
= ICE1712_VX442_CCLK
,
526 .cs_addr
= 0, /* set later */
532 static int __devinit
snd_ice1712_delta_init(struct snd_ice1712
*ice
)
535 struct snd_akm4xxx
*ak
;
537 /* determine I2C, DACs and ADCs */
538 switch (ice
->eeprom
.subvendor
) {
539 case ICE1712_SUBDEVICE_AUDIOPHILE
:
540 ice
->num_total_dacs
= 2;
541 ice
->num_total_adcs
= 2;
543 case ICE1712_SUBDEVICE_DELTA410
:
544 ice
->num_total_dacs
= 8;
545 ice
->num_total_adcs
= 2;
547 case ICE1712_SUBDEVICE_DELTA44
:
548 case ICE1712_SUBDEVICE_DELTA66
:
549 ice
->num_total_dacs
= ice
->omni
? 8 : 4;
550 ice
->num_total_adcs
= ice
->omni
? 8 : 4;
552 case ICE1712_SUBDEVICE_DELTA1010
:
553 case ICE1712_SUBDEVICE_DELTA1010LT
:
554 case ICE1712_SUBDEVICE_MEDIASTATION
:
555 ice
->num_total_dacs
= 8;
556 ice
->num_total_adcs
= 8;
558 case ICE1712_SUBDEVICE_DELTADIO2496
:
559 ice
->num_total_dacs
= 4; /* two AK4324 codecs */
561 case ICE1712_SUBDEVICE_VX442
:
562 ice
->num_total_dacs
= 4;
563 ice
->num_total_adcs
= 4;
567 /* initialize spdif */
568 switch (ice
->eeprom
.subvendor
) {
569 case ICE1712_SUBDEVICE_AUDIOPHILE
:
570 case ICE1712_SUBDEVICE_DELTA410
:
571 case ICE1712_SUBDEVICE_DELTA1010LT
:
572 case ICE1712_SUBDEVICE_VX442
:
573 if ((err
= snd_i2c_bus_create(ice
->card
, "ICE1712 GPIO 1", NULL
, &ice
->i2c
)) < 0) {
574 snd_printk(KERN_ERR
"unable to create I2C bus\n");
577 ice
->i2c
->private_data
= ice
;
578 ice
->i2c
->ops
= &ap_cs8427_i2c_ops
;
579 if ((err
= snd_ice1712_init_cs8427(ice
, CS8427_BASE_ADDR
)) < 0)
582 case ICE1712_SUBDEVICE_DELTA1010
:
583 case ICE1712_SUBDEVICE_MEDIASTATION
:
584 ice
->gpio
.set_pro_rate
= delta_1010_set_rate_val
;
586 case ICE1712_SUBDEVICE_DELTADIO2496
:
587 ice
->gpio
.set_pro_rate
= delta_1010_set_rate_val
;
589 case ICE1712_SUBDEVICE_DELTA66
:
590 ice
->spdif
.ops
.open
= delta_open_spdif
;
591 ice
->spdif
.ops
.setup_rate
= delta_setup_spdif
;
592 ice
->spdif
.ops
.default_get
= delta_spdif_default_get
;
593 ice
->spdif
.ops
.default_put
= delta_spdif_default_put
;
594 ice
->spdif
.ops
.stream_get
= delta_spdif_stream_get
;
595 ice
->spdif
.ops
.stream_put
= delta_spdif_stream_put
;
596 /* Set spdif defaults */
597 snd_ice1712_delta_cs8403_spdif_write(ice
, ice
->spdif
.cs8403_bits
);
602 switch (ice
->eeprom
.subvendor
) {
603 case ICE1712_SUBDEVICE_DELTA1010
:
604 case ICE1712_SUBDEVICE_DELTADIO2496
:
605 case ICE1712_SUBDEVICE_MEDIASTATION
:
609 /* second stage of initialization, analog parts and others */
610 ak
= ice
->akm
= kmalloc(sizeof(struct snd_akm4xxx
), GFP_KERNEL
);
615 switch (ice
->eeprom
.subvendor
) {
616 case ICE1712_SUBDEVICE_AUDIOPHILE
:
617 err
= snd_ice1712_akm4xxx_init(ak
, &akm_audiophile
, &akm_audiophile_priv
, ice
);
619 case ICE1712_SUBDEVICE_DELTA410
:
620 err
= snd_ice1712_akm4xxx_init(ak
, &akm_delta410
, &akm_delta410_priv
, ice
);
622 case ICE1712_SUBDEVICE_DELTA1010LT
:
623 err
= snd_ice1712_akm4xxx_init(ak
, &akm_delta1010lt
, &akm_delta1010lt_priv
, ice
);
625 case ICE1712_SUBDEVICE_DELTA66
:
626 case ICE1712_SUBDEVICE_DELTA44
:
627 err
= snd_ice1712_akm4xxx_init(ak
, &akm_delta44
, &akm_delta44_priv
, ice
);
629 case ICE1712_SUBDEVICE_VX442
:
630 err
= snd_ice1712_akm4xxx_init(ak
, &akm_vx442
, &akm_vx442_priv
, ice
);
642 * additional controls for M-Audio cards
645 static struct snd_kcontrol_new snd_ice1712_delta1010_wordclock_select __devinitdata
=
646 ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER
, "Word Clock Sync", 0, ICE1712_DELTA_WORD_CLOCK_SELECT
, 1, 0);
647 static struct snd_kcontrol_new snd_ice1712_delta1010lt_wordclock_select __devinitdata
=
648 ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER
, "Word Clock Sync", 0, ICE1712_DELTA_1010LT_WORDCLOCK
, 0, 0);
649 static struct snd_kcontrol_new snd_ice1712_delta1010_wordclock_status __devinitdata
=
650 ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER
, "Word Clock Status", 0, ICE1712_DELTA_WORD_CLOCK_STATUS
, 1, SNDRV_CTL_ELEM_ACCESS_READ
| SNDRV_CTL_ELEM_ACCESS_VOLATILE
);
651 static struct snd_kcontrol_new snd_ice1712_deltadio2496_spdif_in_select __devinitdata
=
652 ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER
, "IEC958 Input Optical", 0, ICE1712_DELTA_SPDIF_INPUT_SELECT
, 0, 0);
653 static struct snd_kcontrol_new snd_ice1712_delta_spdif_in_status __devinitdata
=
654 ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER
, "Delta IEC958 Input Status", 0, ICE1712_DELTA_SPDIF_IN_STAT
, 1, SNDRV_CTL_ELEM_ACCESS_READ
| SNDRV_CTL_ELEM_ACCESS_VOLATILE
);
657 static int __devinit
snd_ice1712_delta_add_controls(struct snd_ice1712
*ice
)
661 /* 1010 and dio specific controls */
662 switch (ice
->eeprom
.subvendor
) {
663 case ICE1712_SUBDEVICE_DELTA1010
:
664 case ICE1712_SUBDEVICE_MEDIASTATION
:
665 err
= snd_ctl_add(ice
->card
, snd_ctl_new1(&snd_ice1712_delta1010_wordclock_select
, ice
));
668 err
= snd_ctl_add(ice
->card
, snd_ctl_new1(&snd_ice1712_delta1010_wordclock_status
, ice
));
672 case ICE1712_SUBDEVICE_DELTADIO2496
:
673 err
= snd_ctl_add(ice
->card
, snd_ctl_new1(&snd_ice1712_deltadio2496_spdif_in_select
, ice
));
677 case ICE1712_SUBDEVICE_DELTA1010LT
:
678 err
= snd_ctl_add(ice
->card
, snd_ctl_new1(&snd_ice1712_delta1010lt_wordclock_select
, ice
));
681 err
= snd_ctl_add(ice
->card
, snd_ctl_new1(&snd_ice1712_delta1010lt_wordclock_status
, ice
));
687 /* normal spdif controls */
688 switch (ice
->eeprom
.subvendor
) {
689 case ICE1712_SUBDEVICE_DELTA1010
:
690 case ICE1712_SUBDEVICE_DELTADIO2496
:
691 case ICE1712_SUBDEVICE_DELTA66
:
692 case ICE1712_SUBDEVICE_MEDIASTATION
:
693 err
= snd_ice1712_spdif_build_controls(ice
);
699 /* spdif status in */
700 switch (ice
->eeprom
.subvendor
) {
701 case ICE1712_SUBDEVICE_DELTA1010
:
702 case ICE1712_SUBDEVICE_DELTADIO2496
:
703 case ICE1712_SUBDEVICE_DELTA66
:
704 case ICE1712_SUBDEVICE_MEDIASTATION
:
705 err
= snd_ctl_add(ice
->card
, snd_ctl_new1(&snd_ice1712_delta_spdif_in_status
, ice
));
711 /* ak4524 controls */
712 switch (ice
->eeprom
.subvendor
) {
713 case ICE1712_SUBDEVICE_DELTA1010LT
:
714 case ICE1712_SUBDEVICE_AUDIOPHILE
:
715 case ICE1712_SUBDEVICE_DELTA410
:
716 case ICE1712_SUBDEVICE_DELTA44
:
717 case ICE1712_SUBDEVICE_DELTA66
:
718 case ICE1712_SUBDEVICE_VX442
:
719 err
= snd_ice1712_akm4xxx_build_controls(ice
);
730 struct snd_ice1712_card_info snd_ice1712_delta_cards
[] __devinitdata
= {
732 .subvendor
= ICE1712_SUBDEVICE_DELTA1010
,
733 .name
= "M Audio Delta 1010",
734 .model
= "delta1010",
735 .chip_init
= snd_ice1712_delta_init
,
736 .build_controls
= snd_ice1712_delta_add_controls
,
739 .subvendor
= ICE1712_SUBDEVICE_DELTADIO2496
,
740 .name
= "M Audio Delta DiO 2496",
742 .chip_init
= snd_ice1712_delta_init
,
743 .build_controls
= snd_ice1712_delta_add_controls
,
747 .subvendor
= ICE1712_SUBDEVICE_DELTA66
,
748 .name
= "M Audio Delta 66",
750 .chip_init
= snd_ice1712_delta_init
,
751 .build_controls
= snd_ice1712_delta_add_controls
,
755 .subvendor
= ICE1712_SUBDEVICE_DELTA44
,
756 .name
= "M Audio Delta 44",
758 .chip_init
= snd_ice1712_delta_init
,
759 .build_controls
= snd_ice1712_delta_add_controls
,
763 .subvendor
= ICE1712_SUBDEVICE_AUDIOPHILE
,
764 .name
= "M Audio Audiophile 24/96",
765 .model
= "audiophile",
766 .chip_init
= snd_ice1712_delta_init
,
767 .build_controls
= snd_ice1712_delta_add_controls
,
770 .subvendor
= ICE1712_SUBDEVICE_DELTA410
,
771 .name
= "M Audio Delta 410",
773 .chip_init
= snd_ice1712_delta_init
,
774 .build_controls
= snd_ice1712_delta_add_controls
,
777 .subvendor
= ICE1712_SUBDEVICE_DELTA1010LT
,
778 .name
= "M Audio Delta 1010LT",
779 .model
= "delta1010lt",
780 .chip_init
= snd_ice1712_delta_init
,
781 .build_controls
= snd_ice1712_delta_add_controls
,
784 .subvendor
= ICE1712_SUBDEVICE_VX442
,
785 .name
= "Digigram VX442",
787 .chip_init
= snd_ice1712_delta_init
,
788 .build_controls
= snd_ice1712_delta_add_controls
,
792 .subvendor
= ICE1712_SUBDEVICE_MEDIASTATION
,
793 .name
= "Lionstracs Mediastation",
794 .model
= "mediastation",
795 .chip_init
= snd_ice1712_delta_init
,
796 .build_controls
= snd_ice1712_delta_add_controls
,