xref: /openbmc/linux/sound/pci/ice1712/ews.c (revision ca79522c)
1 /*
2  *   ALSA driver for ICEnsemble ICE1712 (Envy24)
3  *
4  *   Lowlevel functions for Terratec EWS88MT/D, EWX24/96, DMX 6Fire
5  *
6  *	Copyright (c) 2000 Jaroslav Kysela <perex@perex.cz>
7  *                    2002 Takashi Iwai <tiwai@suse.de>
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 <linux/delay.h>
26 #include <linux/interrupt.h>
27 #include <linux/init.h>
28 #include <linux/slab.h>
29 #include <sound/core.h>
30 #include <sound/cs8427.h>
31 #include <sound/asoundef.h>
32 
33 #include "ice1712.h"
34 #include "ews.h"
35 
36 #define SND_CS8404
37 #include <sound/cs8403.h>
38 
39 enum {
40 	EWS_I2C_CS8404 = 0, EWS_I2C_PCF1, EWS_I2C_PCF2,
41 	EWS_I2C_88D = 0,
42 	EWS_I2C_6FIRE = 0
43 };
44 
45 
46 /* additional i2c devices for EWS boards */
47 struct ews_spec {
48 	struct snd_i2c_device *i2cdevs[3];
49 };
50 
51 /*
52  * access via i2c mode (for EWX 24/96, EWS 88MT&D)
53  */
54 
55 /* send SDA and SCL */
56 static void ewx_i2c_setlines(struct snd_i2c_bus *bus, int clk, int data)
57 {
58 	struct snd_ice1712 *ice = bus->private_data;
59 	unsigned char tmp = 0;
60 	if (clk)
61 		tmp |= ICE1712_EWX2496_SERIAL_CLOCK;
62 	if (data)
63 		tmp |= ICE1712_EWX2496_SERIAL_DATA;
64 	snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, tmp);
65 	udelay(5);
66 }
67 
68 static int ewx_i2c_getclock(struct snd_i2c_bus *bus)
69 {
70 	struct snd_ice1712 *ice = bus->private_data;
71 	return snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA) & ICE1712_EWX2496_SERIAL_CLOCK ? 1 : 0;
72 }
73 
74 static int ewx_i2c_getdata(struct snd_i2c_bus *bus, int ack)
75 {
76 	struct snd_ice1712 *ice = bus->private_data;
77 	int bit;
78 	/* set RW pin to low */
79 	snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ~ICE1712_EWX2496_RW);
80 	snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, 0);
81 	if (ack)
82 		udelay(5);
83 	bit = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA) & ICE1712_EWX2496_SERIAL_DATA ? 1 : 0;
84 	/* set RW pin to high */
85 	snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, ICE1712_EWX2496_RW);
86 	/* reset write mask */
87 	snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ~ICE1712_EWX2496_SERIAL_CLOCK);
88 	return bit;
89 }
90 
91 static void ewx_i2c_start(struct snd_i2c_bus *bus)
92 {
93 	struct snd_ice1712 *ice = bus->private_data;
94 	unsigned char mask;
95 
96 	snd_ice1712_save_gpio_status(ice);
97 	/* set RW high */
98 	mask = ICE1712_EWX2496_RW;
99 	switch (ice->eeprom.subvendor) {
100 	case ICE1712_SUBDEVICE_EWX2496:
101 		mask |= ICE1712_EWX2496_AK4524_CS; /* CS high also */
102 		break;
103 	case ICE1712_SUBDEVICE_DMX6FIRE:
104 		mask |= ICE1712_6FIRE_AK4524_CS_MASK; /* CS high also */
105 		break;
106 	}
107 	snd_ice1712_gpio_write_bits(ice, mask, mask);
108 }
109 
110 static void ewx_i2c_stop(struct snd_i2c_bus *bus)
111 {
112 	struct snd_ice1712 *ice = bus->private_data;
113 	snd_ice1712_restore_gpio_status(ice);
114 }
115 
116 static void ewx_i2c_direction(struct snd_i2c_bus *bus, int clock, int data)
117 {
118 	struct snd_ice1712 *ice = bus->private_data;
119 	unsigned char mask = 0;
120 
121 	if (clock)
122 		mask |= ICE1712_EWX2496_SERIAL_CLOCK; /* write SCL */
123 	if (data)
124 		mask |= ICE1712_EWX2496_SERIAL_DATA; /* write SDA */
125 	ice->gpio.direction &= ~(ICE1712_EWX2496_SERIAL_CLOCK|ICE1712_EWX2496_SERIAL_DATA);
126 	ice->gpio.direction |= mask;
127 	snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION, ice->gpio.direction);
128 	snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ~mask);
129 }
130 
131 static struct snd_i2c_bit_ops snd_ice1712_ewx_cs8427_bit_ops = {
132 	.start = ewx_i2c_start,
133 	.stop = ewx_i2c_stop,
134 	.direction = ewx_i2c_direction,
135 	.setlines = ewx_i2c_setlines,
136 	.getclock = ewx_i2c_getclock,
137 	.getdata = ewx_i2c_getdata,
138 };
139 
140 
141 /*
142  * AK4524 access
143  */
144 
145 /* AK4524 chip select; address 0x48 bit 0-3 */
146 static int snd_ice1712_ews88mt_chip_select(struct snd_ice1712 *ice, int chip_mask)
147 {
148 	struct ews_spec *spec = ice->spec;
149 	unsigned char data, ndata;
150 
151 	if (snd_BUG_ON(chip_mask < 0 || chip_mask > 0x0f))
152 		return -EINVAL;
153 	snd_i2c_lock(ice->i2c);
154 	if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_PCF2], &data, 1) != 1)
155 		goto __error;
156 	ndata = (data & 0xf0) | chip_mask;
157 	if (ndata != data)
158 		if (snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_PCF2], &ndata, 1)
159 		    != 1)
160 			goto __error;
161 	snd_i2c_unlock(ice->i2c);
162 	return 0;
163 
164      __error:
165 	snd_i2c_unlock(ice->i2c);
166 	snd_printk(KERN_ERR "AK4524 chip select failed, check cable to the front module\n");
167 	return -EIO;
168 }
169 
170 /* start callback for EWS88MT, needs to select a certain chip mask */
171 static void ews88mt_ak4524_lock(struct snd_akm4xxx *ak, int chip)
172 {
173 	struct snd_ice1712 *ice = ak->private_data[0];
174 	unsigned char tmp;
175 	/* assert AK4524 CS */
176 	if (snd_ice1712_ews88mt_chip_select(ice, ~(1 << chip) & 0x0f) < 0)
177 		snd_printk(KERN_ERR "fatal error (ews88mt chip select)\n");
178 	snd_ice1712_save_gpio_status(ice);
179 	tmp = ICE1712_EWS88_SERIAL_DATA |
180 		ICE1712_EWS88_SERIAL_CLOCK |
181 		ICE1712_EWS88_RW;
182 	snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION,
183 			  ice->gpio.direction | tmp);
184 	snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ~tmp);
185 }
186 
187 /* stop callback for EWS88MT, needs to deselect chip mask */
188 static void ews88mt_ak4524_unlock(struct snd_akm4xxx *ak, int chip)
189 {
190 	struct snd_ice1712 *ice = ak->private_data[0];
191 	snd_ice1712_restore_gpio_status(ice);
192 	udelay(1);
193 	snd_ice1712_ews88mt_chip_select(ice, 0x0f);
194 }
195 
196 /* start callback for EWX24/96 */
197 static void ewx2496_ak4524_lock(struct snd_akm4xxx *ak, int chip)
198 {
199 	struct snd_ice1712 *ice = ak->private_data[0];
200 	unsigned char tmp;
201 	snd_ice1712_save_gpio_status(ice);
202 	tmp =  ICE1712_EWX2496_SERIAL_DATA |
203 		ICE1712_EWX2496_SERIAL_CLOCK |
204 		ICE1712_EWX2496_AK4524_CS |
205 		ICE1712_EWX2496_RW;
206 	snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION,
207 			  ice->gpio.direction | tmp);
208 	snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ~tmp);
209 }
210 
211 /* start callback for DMX 6fire */
212 static void dmx6fire_ak4524_lock(struct snd_akm4xxx *ak, int chip)
213 {
214 	struct snd_ak4xxx_private *priv = (void *)ak->private_value[0];
215 	struct snd_ice1712 *ice = ak->private_data[0];
216 	unsigned char tmp;
217 	snd_ice1712_save_gpio_status(ice);
218 	tmp = priv->cs_mask = priv->cs_addr = (1 << chip) & ICE1712_6FIRE_AK4524_CS_MASK;
219 	tmp |= ICE1712_6FIRE_SERIAL_DATA |
220 		ICE1712_6FIRE_SERIAL_CLOCK |
221 		ICE1712_6FIRE_RW;
222 	snd_ice1712_write(ice, ICE1712_IREG_GPIO_DIRECTION,
223 			  ice->gpio.direction | tmp);
224 	snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ~tmp);
225 }
226 
227 /*
228  * CS8404 interface on EWS88MT/D
229  */
230 
231 static void snd_ice1712_ews_cs8404_spdif_write(struct snd_ice1712 *ice, unsigned char bits)
232 {
233 	struct ews_spec *spec = ice->spec;
234 	unsigned char bytes[2];
235 
236 	snd_i2c_lock(ice->i2c);
237 	switch (ice->eeprom.subvendor) {
238 	case ICE1712_SUBDEVICE_EWS88MT:
239 	case ICE1712_SUBDEVICE_EWS88MT_NEW:
240 	case ICE1712_SUBDEVICE_PHASE88:
241 	case ICE1712_SUBDEVICE_TS88:
242 		if (snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_CS8404], &bits, 1)
243 		    != 1)
244 			goto _error;
245 		break;
246 	case ICE1712_SUBDEVICE_EWS88D:
247 		if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_88D], bytes, 2)
248 		    != 2)
249 			goto _error;
250 		if (bits != bytes[1]) {
251 			bytes[1] = bits;
252 			if (snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_88D],
253 					      bytes, 2) != 2)
254 				goto _error;
255 		}
256 		break;
257 	}
258  _error:
259 	snd_i2c_unlock(ice->i2c);
260 }
261 
262 /*
263  */
264 
265 static void ews88_spdif_default_get(struct snd_ice1712 *ice, struct snd_ctl_elem_value *ucontrol)
266 {
267 	snd_cs8404_decode_spdif_bits(&ucontrol->value.iec958, ice->spdif.cs8403_bits);
268 }
269 
270 static int ews88_spdif_default_put(struct snd_ice1712 *ice, struct snd_ctl_elem_value *ucontrol)
271 {
272 	unsigned int val;
273 	int change;
274 
275 	val = snd_cs8404_encode_spdif_bits(&ucontrol->value.iec958);
276 	spin_lock_irq(&ice->reg_lock);
277 	change = ice->spdif.cs8403_bits != val;
278 	ice->spdif.cs8403_bits = val;
279 	if (change && ice->playback_pro_substream == NULL) {
280 		spin_unlock_irq(&ice->reg_lock);
281 		snd_ice1712_ews_cs8404_spdif_write(ice, val);
282 	} else {
283 		spin_unlock_irq(&ice->reg_lock);
284 	}
285 	return change;
286 }
287 
288 static void ews88_spdif_stream_get(struct snd_ice1712 *ice, struct snd_ctl_elem_value *ucontrol)
289 {
290 	snd_cs8404_decode_spdif_bits(&ucontrol->value.iec958, ice->spdif.cs8403_stream_bits);
291 }
292 
293 static int ews88_spdif_stream_put(struct snd_ice1712 *ice, struct snd_ctl_elem_value *ucontrol)
294 {
295 	unsigned int val;
296 	int change;
297 
298 	val = snd_cs8404_encode_spdif_bits(&ucontrol->value.iec958);
299 	spin_lock_irq(&ice->reg_lock);
300 	change = ice->spdif.cs8403_stream_bits != val;
301 	ice->spdif.cs8403_stream_bits = val;
302 	if (change && ice->playback_pro_substream != NULL) {
303 		spin_unlock_irq(&ice->reg_lock);
304 		snd_ice1712_ews_cs8404_spdif_write(ice, val);
305 	} else {
306 		spin_unlock_irq(&ice->reg_lock);
307 	}
308 	return change;
309 }
310 
311 
312 /* open callback */
313 static void ews88_open_spdif(struct snd_ice1712 *ice, struct snd_pcm_substream *substream)
314 {
315 	ice->spdif.cs8403_stream_bits = ice->spdif.cs8403_bits;
316 }
317 
318 /* set up SPDIF for EWS88MT / EWS88D */
319 static void ews88_setup_spdif(struct snd_ice1712 *ice, int rate)
320 {
321 	unsigned long flags;
322 	unsigned char tmp;
323 	int change;
324 
325 	spin_lock_irqsave(&ice->reg_lock, flags);
326 	tmp = ice->spdif.cs8403_stream_bits;
327 	if (tmp & 0x10)		/* consumer */
328 		tmp &= (tmp & 0x01) ? ~0x06 : ~0x60;
329 	switch (rate) {
330 	case 32000: tmp |= (tmp & 0x01) ? 0x02 : 0x00; break;
331 	case 44100: tmp |= (tmp & 0x01) ? 0x06 : 0x40; break;
332 	case 48000: tmp |= (tmp & 0x01) ? 0x04 : 0x20; break;
333 	default: tmp |= (tmp & 0x01) ? 0x06 : 0x40; break;
334 	}
335 	change = ice->spdif.cs8403_stream_bits != tmp;
336 	ice->spdif.cs8403_stream_bits = tmp;
337 	spin_unlock_irqrestore(&ice->reg_lock, flags);
338 	if (change)
339 		snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE, &ice->spdif.stream_ctl->id);
340 	snd_ice1712_ews_cs8404_spdif_write(ice, tmp);
341 }
342 
343 
344 /*
345  */
346 static struct snd_akm4xxx akm_ews88mt = {
347 	.num_adcs = 8,
348 	.num_dacs = 8,
349 	.type = SND_AK4524,
350 	.ops = {
351 		.lock = ews88mt_ak4524_lock,
352 		.unlock = ews88mt_ak4524_unlock
353 	}
354 };
355 
356 static struct snd_ak4xxx_private akm_ews88mt_priv = {
357 	.caddr = 2,
358 	.cif = 1, /* CIF high */
359 	.data_mask = ICE1712_EWS88_SERIAL_DATA,
360 	.clk_mask = ICE1712_EWS88_SERIAL_CLOCK,
361 	.cs_mask = 0,
362 	.cs_addr = 0,
363 	.cs_none = 0, /* no chip select on gpio */
364 	.add_flags = ICE1712_EWS88_RW, /* set rw bit high */
365 	.mask_flags = 0,
366 };
367 
368 static struct snd_akm4xxx akm_ewx2496 = {
369 	.num_adcs = 2,
370 	.num_dacs = 2,
371 	.type = SND_AK4524,
372 	.ops = {
373 		.lock = ewx2496_ak4524_lock
374 	}
375 };
376 
377 static struct snd_ak4xxx_private akm_ewx2496_priv = {
378 	.caddr = 2,
379 	.cif = 1, /* CIF high */
380 	.data_mask = ICE1712_EWS88_SERIAL_DATA,
381 	.clk_mask = ICE1712_EWS88_SERIAL_CLOCK,
382 	.cs_mask = ICE1712_EWX2496_AK4524_CS,
383 	.cs_addr = ICE1712_EWX2496_AK4524_CS,
384 	.cs_none = 0,
385 	.add_flags = ICE1712_EWS88_RW, /* set rw bit high */
386 	.mask_flags = 0,
387 };
388 
389 static struct snd_akm4xxx akm_6fire = {
390 	.num_adcs = 6,
391 	.num_dacs = 6,
392 	.type = SND_AK4524,
393 	.ops = {
394 		.lock = dmx6fire_ak4524_lock
395 	}
396 };
397 
398 static struct snd_ak4xxx_private akm_6fire_priv = {
399 	.caddr = 2,
400 	.cif = 1, /* CIF high */
401 	.data_mask = ICE1712_6FIRE_SERIAL_DATA,
402 	.clk_mask = ICE1712_6FIRE_SERIAL_CLOCK,
403 	.cs_mask = 0,
404 	.cs_addr = 0, /* set later */
405 	.cs_none = 0,
406 	.add_flags = ICE1712_6FIRE_RW, /* set rw bit high */
407 	.mask_flags = 0,
408 };
409 
410 /*
411  * initialize the chip
412  */
413 
414 /* 6fire specific */
415 #define PCF9554_REG_INPUT      0
416 #define PCF9554_REG_OUTPUT     1
417 #define PCF9554_REG_POLARITY   2
418 #define PCF9554_REG_CONFIG     3
419 
420 static int snd_ice1712_6fire_write_pca(struct snd_ice1712 *ice, unsigned char reg, unsigned char data);
421 
422 static int snd_ice1712_ews_init(struct snd_ice1712 *ice)
423 {
424 	int err;
425 	struct snd_akm4xxx *ak;
426 	struct ews_spec *spec;
427 
428 	/* set the analog DACs */
429 	switch (ice->eeprom.subvendor) {
430 	case ICE1712_SUBDEVICE_EWX2496:
431 		ice->num_total_dacs = 2;
432 		ice->num_total_adcs = 2;
433 		break;
434 	case ICE1712_SUBDEVICE_EWS88MT:
435 	case ICE1712_SUBDEVICE_EWS88MT_NEW:
436 	case ICE1712_SUBDEVICE_PHASE88:
437 	case ICE1712_SUBDEVICE_TS88:
438 		ice->num_total_dacs = 8;
439 		ice->num_total_adcs = 8;
440 		break;
441 	case ICE1712_SUBDEVICE_EWS88D:
442 		/* Note: not analog but ADAT I/O */
443 		ice->num_total_dacs = 8;
444 		ice->num_total_adcs = 8;
445 		break;
446 	case ICE1712_SUBDEVICE_DMX6FIRE:
447 		ice->num_total_dacs = 6;
448 		ice->num_total_adcs = 6;
449 		break;
450 	}
451 
452 	spec = kzalloc(sizeof(*spec), GFP_KERNEL);
453 	if (!spec)
454 		return -ENOMEM;
455 	ice->spec = spec;
456 
457 	/* create i2c */
458 	if ((err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c)) < 0) {
459 		snd_printk(KERN_ERR "unable to create I2C bus\n");
460 		return err;
461 	}
462 	ice->i2c->private_data = ice;
463 	ice->i2c->hw_ops.bit = &snd_ice1712_ewx_cs8427_bit_ops;
464 
465 	/* create i2c devices */
466 	switch (ice->eeprom.subvendor) {
467 	case ICE1712_SUBDEVICE_DMX6FIRE:
468 		err = snd_i2c_device_create(ice->i2c, "PCF9554",
469 					    ICE1712_6FIRE_PCF9554_ADDR,
470 					    &spec->i2cdevs[EWS_I2C_6FIRE]);
471 		if (err < 0) {
472 			snd_printk(KERN_ERR "PCF9554 initialization failed\n");
473 			return err;
474 		}
475 		snd_ice1712_6fire_write_pca(ice, PCF9554_REG_CONFIG, 0x80);
476 		break;
477 	case ICE1712_SUBDEVICE_EWS88MT:
478 	case ICE1712_SUBDEVICE_EWS88MT_NEW:
479 	case ICE1712_SUBDEVICE_PHASE88:
480 	case ICE1712_SUBDEVICE_TS88:
481 
482 		err = snd_i2c_device_create(ice->i2c, "CS8404",
483 					    ICE1712_EWS88MT_CS8404_ADDR,
484 					    &spec->i2cdevs[EWS_I2C_CS8404]);
485 		if (err < 0)
486 			return err;
487 		err = snd_i2c_device_create(ice->i2c, "PCF8574 (1st)",
488 					    ICE1712_EWS88MT_INPUT_ADDR,
489 					    &spec->i2cdevs[EWS_I2C_PCF1]);
490 		if (err < 0)
491 			return err;
492 		err = snd_i2c_device_create(ice->i2c, "PCF8574 (2nd)",
493 					    ICE1712_EWS88MT_OUTPUT_ADDR,
494 					    &spec->i2cdevs[EWS_I2C_PCF2]);
495 		if (err < 0)
496 			return err;
497 		/* Check if the front module is connected */
498 		if ((err = snd_ice1712_ews88mt_chip_select(ice, 0x0f)) < 0)
499 			return err;
500 		break;
501 	case ICE1712_SUBDEVICE_EWS88D:
502 		err = snd_i2c_device_create(ice->i2c, "PCF8575",
503 					    ICE1712_EWS88D_PCF_ADDR,
504 					    &spec->i2cdevs[EWS_I2C_88D]);
505 		if (err < 0)
506 			return err;
507 		break;
508 	}
509 
510 	/* set up SPDIF interface */
511 	switch (ice->eeprom.subvendor) {
512 	case ICE1712_SUBDEVICE_EWX2496:
513 		if ((err = snd_ice1712_init_cs8427(ice, CS8427_BASE_ADDR)) < 0)
514 			return err;
515 		snd_cs8427_reg_write(ice->cs8427, CS8427_REG_RECVERRMASK, CS8427_UNLOCK | CS8427_CONF | CS8427_BIP | CS8427_PAR);
516 		break;
517 	case ICE1712_SUBDEVICE_DMX6FIRE:
518 		if ((err = snd_ice1712_init_cs8427(ice, ICE1712_6FIRE_CS8427_ADDR)) < 0)
519 			return err;
520 		snd_cs8427_reg_write(ice->cs8427, CS8427_REG_RECVERRMASK, CS8427_UNLOCK | CS8427_CONF | CS8427_BIP | CS8427_PAR);
521 		break;
522 	case ICE1712_SUBDEVICE_EWS88MT:
523 	case ICE1712_SUBDEVICE_EWS88MT_NEW:
524 	case ICE1712_SUBDEVICE_PHASE88:
525 	case ICE1712_SUBDEVICE_TS88:
526 	case ICE1712_SUBDEVICE_EWS88D:
527 		/* set up CS8404 */
528 		ice->spdif.ops.open = ews88_open_spdif;
529 		ice->spdif.ops.setup_rate = ews88_setup_spdif;
530 		ice->spdif.ops.default_get = ews88_spdif_default_get;
531 		ice->spdif.ops.default_put = ews88_spdif_default_put;
532 		ice->spdif.ops.stream_get = ews88_spdif_stream_get;
533 		ice->spdif.ops.stream_put = ews88_spdif_stream_put;
534 		/* Set spdif defaults */
535 		snd_ice1712_ews_cs8404_spdif_write(ice, ice->spdif.cs8403_bits);
536 		break;
537 	}
538 
539 	/* no analog? */
540 	switch (ice->eeprom.subvendor) {
541 	case ICE1712_SUBDEVICE_EWS88D:
542 		return 0;
543 	}
544 
545 	/* analog section */
546 	ak = ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL);
547 	if (! ak)
548 		return -ENOMEM;
549 	ice->akm_codecs = 1;
550 
551 	switch (ice->eeprom.subvendor) {
552 	case ICE1712_SUBDEVICE_EWS88MT:
553 	case ICE1712_SUBDEVICE_EWS88MT_NEW:
554 	case ICE1712_SUBDEVICE_PHASE88:
555 	case ICE1712_SUBDEVICE_TS88:
556 		err = snd_ice1712_akm4xxx_init(ak, &akm_ews88mt, &akm_ews88mt_priv, ice);
557 		break;
558 	case ICE1712_SUBDEVICE_EWX2496:
559 		err = snd_ice1712_akm4xxx_init(ak, &akm_ewx2496, &akm_ewx2496_priv, ice);
560 		break;
561 	case ICE1712_SUBDEVICE_DMX6FIRE:
562 		err = snd_ice1712_akm4xxx_init(ak, &akm_6fire, &akm_6fire_priv, ice);
563 		break;
564 	default:
565 		err = 0;
566 	}
567 
568 	return err;
569 }
570 
571 /*
572  * EWX 24/96 specific controls
573  */
574 
575 /* i/o sensitivity - this callback is shared among other devices, too */
576 static int snd_ice1712_ewx_io_sense_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo){
577 
578 	static const char * const texts[2] = {
579 		"+4dBu", "-10dBV",
580 	};
581 	uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
582 	uinfo->count = 1;
583 	uinfo->value.enumerated.items = 2;
584 	if (uinfo->value.enumerated.item >= 2)
585 		uinfo->value.enumerated.item = 1;
586 	strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
587 	return 0;
588 }
589 
590 static int snd_ice1712_ewx_io_sense_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
591 {
592 	struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
593 	unsigned char mask = kcontrol->private_value & 0xff;
594 
595 	snd_ice1712_save_gpio_status(ice);
596 	ucontrol->value.enumerated.item[0] = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA) & mask ? 1 : 0;
597 	snd_ice1712_restore_gpio_status(ice);
598 	return 0;
599 }
600 
601 static int snd_ice1712_ewx_io_sense_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
602 {
603 	struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
604 	unsigned char mask = kcontrol->private_value & 0xff;
605 	int val, nval;
606 
607 	if (kcontrol->private_value & (1 << 31))
608 		return -EPERM;
609 	nval = ucontrol->value.enumerated.item[0] ? mask : 0;
610 	snd_ice1712_save_gpio_status(ice);
611 	val = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA);
612 	nval |= val & ~mask;
613 	snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, nval);
614 	snd_ice1712_restore_gpio_status(ice);
615 	return val != nval;
616 }
617 
618 static struct snd_kcontrol_new snd_ice1712_ewx2496_controls[] = {
619 	{
620 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
621 		.name = "Input Sensitivity Switch",
622 		.info = snd_ice1712_ewx_io_sense_info,
623 		.get = snd_ice1712_ewx_io_sense_get,
624 		.put = snd_ice1712_ewx_io_sense_put,
625 		.private_value = ICE1712_EWX2496_AIN_SEL,
626 	},
627 	{
628 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
629 		.name = "Output Sensitivity Switch",
630 		.info = snd_ice1712_ewx_io_sense_info,
631 		.get = snd_ice1712_ewx_io_sense_get,
632 		.put = snd_ice1712_ewx_io_sense_put,
633 		.private_value = ICE1712_EWX2496_AOUT_SEL,
634 	},
635 };
636 
637 
638 /*
639  * EWS88MT specific controls
640  */
641 /* analog output sensitivity;; address 0x48 bit 6 */
642 static int snd_ice1712_ews88mt_output_sense_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
643 {
644 	struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
645 	struct ews_spec *spec = ice->spec;
646 	unsigned char data;
647 
648 	snd_i2c_lock(ice->i2c);
649 	if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_PCF2], &data, 1) != 1) {
650 		snd_i2c_unlock(ice->i2c);
651 		return -EIO;
652 	}
653 	snd_i2c_unlock(ice->i2c);
654 	ucontrol->value.enumerated.item[0] = data & ICE1712_EWS88MT_OUTPUT_SENSE ? 1 : 0; /* high = -10dBV, low = +4dBu */
655 	return 0;
656 }
657 
658 /* analog output sensitivity;; address 0x48 bit 6 */
659 static int snd_ice1712_ews88mt_output_sense_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
660 {
661 	struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
662 	struct ews_spec *spec = ice->spec;
663 	unsigned char data, ndata;
664 
665 	snd_i2c_lock(ice->i2c);
666 	if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_PCF2], &data, 1) != 1) {
667 		snd_i2c_unlock(ice->i2c);
668 		return -EIO;
669 	}
670 	ndata = (data & ~ICE1712_EWS88MT_OUTPUT_SENSE) | (ucontrol->value.enumerated.item[0] ? ICE1712_EWS88MT_OUTPUT_SENSE : 0);
671 	if (ndata != data && snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_PCF2],
672 					       &ndata, 1) != 1) {
673 		snd_i2c_unlock(ice->i2c);
674 		return -EIO;
675 	}
676 	snd_i2c_unlock(ice->i2c);
677 	return ndata != data;
678 }
679 
680 /* analog input sensitivity; address 0x46 */
681 static int snd_ice1712_ews88mt_input_sense_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
682 {
683 	struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
684 	struct ews_spec *spec = ice->spec;
685 	int channel = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
686 	unsigned char data;
687 
688 	if (snd_BUG_ON(channel < 0 || channel > 7))
689 		return 0;
690 	snd_i2c_lock(ice->i2c);
691 	if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_PCF1], &data, 1) != 1) {
692 		snd_i2c_unlock(ice->i2c);
693 		return -EIO;
694 	}
695 	/* reversed; high = +4dBu, low = -10dBV */
696 	ucontrol->value.enumerated.item[0] = data & (1 << channel) ? 0 : 1;
697 	snd_i2c_unlock(ice->i2c);
698 	return 0;
699 }
700 
701 /* analog output sensitivity; address 0x46 */
702 static int snd_ice1712_ews88mt_input_sense_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
703 {
704 	struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
705 	struct ews_spec *spec = ice->spec;
706 	int channel = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
707 	unsigned char data, ndata;
708 
709 	if (snd_BUG_ON(channel < 0 || channel > 7))
710 		return 0;
711 	snd_i2c_lock(ice->i2c);
712 	if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_PCF1], &data, 1) != 1) {
713 		snd_i2c_unlock(ice->i2c);
714 		return -EIO;
715 	}
716 	ndata = (data & ~(1 << channel)) | (ucontrol->value.enumerated.item[0] ? 0 : (1 << channel));
717 	if (ndata != data && snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_PCF1],
718 					       &ndata, 1) != 1) {
719 		snd_i2c_unlock(ice->i2c);
720 		return -EIO;
721 	}
722 	snd_i2c_unlock(ice->i2c);
723 	return ndata != data;
724 }
725 
726 static struct snd_kcontrol_new snd_ice1712_ews88mt_input_sense = {
727 	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
728 	.name = "Input Sensitivity Switch",
729 	.info = snd_ice1712_ewx_io_sense_info,
730 	.get = snd_ice1712_ews88mt_input_sense_get,
731 	.put = snd_ice1712_ews88mt_input_sense_put,
732 	.count = 8,
733 };
734 
735 static struct snd_kcontrol_new snd_ice1712_ews88mt_output_sense = {
736 	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
737 	.name = "Output Sensitivity Switch",
738 	.info = snd_ice1712_ewx_io_sense_info,
739 	.get = snd_ice1712_ews88mt_output_sense_get,
740 	.put = snd_ice1712_ews88mt_output_sense_put,
741 };
742 
743 
744 /*
745  * EWS88D specific controls
746  */
747 
748 #define snd_ice1712_ews88d_control_info		snd_ctl_boolean_mono_info
749 
750 static int snd_ice1712_ews88d_control_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
751 {
752 	struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
753 	struct ews_spec *spec = ice->spec;
754 	int shift = kcontrol->private_value & 0xff;
755 	int invert = (kcontrol->private_value >> 8) & 1;
756 	unsigned char data[2];
757 
758 	snd_i2c_lock(ice->i2c);
759 	if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_88D], data, 2) != 2) {
760 		snd_i2c_unlock(ice->i2c);
761 		return -EIO;
762 	}
763 	snd_i2c_unlock(ice->i2c);
764 	data[0] = (data[shift >> 3] >> (shift & 7)) & 0x01;
765 	if (invert)
766 		data[0] ^= 0x01;
767 	ucontrol->value.integer.value[0] = data[0];
768 	return 0;
769 }
770 
771 static int snd_ice1712_ews88d_control_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
772 {
773 	struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
774 	struct ews_spec *spec = ice->spec;
775 	int shift = kcontrol->private_value & 0xff;
776 	int invert = (kcontrol->private_value >> 8) & 1;
777 	unsigned char data[2], ndata[2];
778 	int change;
779 
780 	snd_i2c_lock(ice->i2c);
781 	if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_88D], data, 2) != 2) {
782 		snd_i2c_unlock(ice->i2c);
783 		return -EIO;
784 	}
785 	ndata[shift >> 3] = data[shift >> 3] & ~(1 << (shift & 7));
786 	if (invert) {
787 		if (! ucontrol->value.integer.value[0])
788 			ndata[shift >> 3] |= (1 << (shift & 7));
789 	} else {
790 		if (ucontrol->value.integer.value[0])
791 			ndata[shift >> 3] |= (1 << (shift & 7));
792 	}
793 	change = (data[shift >> 3] != ndata[shift >> 3]);
794 	if (change &&
795 	    snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_88D], data, 2) != 2) {
796 		snd_i2c_unlock(ice->i2c);
797 		return -EIO;
798 	}
799 	snd_i2c_unlock(ice->i2c);
800 	return change;
801 }
802 
803 #define EWS88D_CONTROL(xiface, xname, xshift, xinvert, xaccess) \
804 { .iface = xiface,\
805   .name = xname,\
806   .access = xaccess,\
807   .info = snd_ice1712_ews88d_control_info,\
808   .get = snd_ice1712_ews88d_control_get,\
809   .put = snd_ice1712_ews88d_control_put,\
810   .private_value = xshift | (xinvert << 8),\
811 }
812 
813 static struct snd_kcontrol_new snd_ice1712_ews88d_controls[] = {
814 	EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "IEC958 Input Optical", 0, 1, 0), /* inverted */
815 	EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "ADAT Output Optical", 1, 0, 0),
816 	EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "ADAT External Master Clock", 2, 0, 0),
817 	EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "Enable ADAT", 3, 0, 0),
818 	EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "ADAT Through", 4, 1, 0),
819 };
820 
821 
822 /*
823  * DMX 6Fire specific controls
824  */
825 
826 static int snd_ice1712_6fire_read_pca(struct snd_ice1712 *ice, unsigned char reg)
827 {
828 	unsigned char byte;
829 	struct ews_spec *spec = ice->spec;
830 
831 	snd_i2c_lock(ice->i2c);
832 	byte = reg;
833 	snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_6FIRE], &byte, 1);
834 	byte = 0;
835 	if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_6FIRE], &byte, 1) != 1) {
836 		snd_i2c_unlock(ice->i2c);
837 		printk(KERN_ERR "cannot read pca\n");
838 		return -EIO;
839 	}
840 	snd_i2c_unlock(ice->i2c);
841 	return byte;
842 }
843 
844 static int snd_ice1712_6fire_write_pca(struct snd_ice1712 *ice, unsigned char reg, unsigned char data)
845 {
846 	unsigned char bytes[2];
847 	struct ews_spec *spec = ice->spec;
848 
849 	snd_i2c_lock(ice->i2c);
850 	bytes[0] = reg;
851 	bytes[1] = data;
852 	if (snd_i2c_sendbytes(spec->i2cdevs[EWS_I2C_6FIRE], bytes, 2) != 2) {
853 		snd_i2c_unlock(ice->i2c);
854 		return -EIO;
855 	}
856 	snd_i2c_unlock(ice->i2c);
857 	return 0;
858 }
859 
860 #define snd_ice1712_6fire_control_info		snd_ctl_boolean_mono_info
861 
862 static int snd_ice1712_6fire_control_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
863 {
864 	struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
865 	int shift = kcontrol->private_value & 0xff;
866 	int invert = (kcontrol->private_value >> 8) & 1;
867 	int data;
868 
869 	if ((data = snd_ice1712_6fire_read_pca(ice, PCF9554_REG_OUTPUT)) < 0)
870 		return data;
871 	data = (data >> shift) & 1;
872 	if (invert)
873 		data ^= 1;
874 	ucontrol->value.integer.value[0] = data;
875 	return 0;
876 }
877 
878 static int snd_ice1712_6fire_control_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
879 {
880 	struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
881 	int shift = kcontrol->private_value & 0xff;
882 	int invert = (kcontrol->private_value >> 8) & 1;
883 	int data, ndata;
884 
885 	if ((data = snd_ice1712_6fire_read_pca(ice, PCF9554_REG_OUTPUT)) < 0)
886 		return data;
887 	ndata = data & ~(1 << shift);
888 	if (ucontrol->value.integer.value[0])
889 		ndata |= (1 << shift);
890 	if (invert)
891 		ndata ^= (1 << shift);
892 	if (data != ndata) {
893 		snd_ice1712_6fire_write_pca(ice, PCF9554_REG_OUTPUT, (unsigned char)ndata);
894 		return 1;
895 	}
896 	return 0;
897 }
898 
899 static int snd_ice1712_6fire_select_input_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
900 {
901 	static const char * const texts[4] = {
902 		"Internal", "Front Input", "Rear Input", "Wave Table"
903 	};
904 	uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
905 	uinfo->count = 1;
906 	uinfo->value.enumerated.items = 4;
907 	if (uinfo->value.enumerated.item >= 4)
908 		uinfo->value.enumerated.item = 1;
909 	strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
910 	return 0;
911 }
912 
913 static int snd_ice1712_6fire_select_input_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
914 {
915 	struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
916 	int data;
917 
918 	if ((data = snd_ice1712_6fire_read_pca(ice, PCF9554_REG_OUTPUT)) < 0)
919 		return data;
920 	ucontrol->value.integer.value[0] = data & 3;
921 	return 0;
922 }
923 
924 static int snd_ice1712_6fire_select_input_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
925 {
926 	struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
927 	int data, ndata;
928 
929 	if ((data = snd_ice1712_6fire_read_pca(ice, PCF9554_REG_OUTPUT)) < 0)
930 		return data;
931 	ndata = data & ~3;
932 	ndata |= (ucontrol->value.integer.value[0] & 3);
933 	if (data != ndata) {
934 		snd_ice1712_6fire_write_pca(ice, PCF9554_REG_OUTPUT, (unsigned char)ndata);
935 		return 1;
936 	}
937 	return 0;
938 }
939 
940 
941 #define DMX6FIRE_CONTROL(xname, xshift, xinvert) \
942 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER,\
943   .name = xname,\
944   .info = snd_ice1712_6fire_control_info,\
945   .get = snd_ice1712_6fire_control_get,\
946   .put = snd_ice1712_6fire_control_put,\
947   .private_value = xshift | (xinvert << 8),\
948 }
949 
950 static struct snd_kcontrol_new snd_ice1712_6fire_controls[] = {
951 	{
952 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
953 		.name = "Analog Input Select",
954 		.info = snd_ice1712_6fire_select_input_info,
955 		.get = snd_ice1712_6fire_select_input_get,
956 		.put = snd_ice1712_6fire_select_input_put,
957 	},
958 	DMX6FIRE_CONTROL("Front Digital Input Switch", 2, 1),
959 	// DMX6FIRE_CONTROL("Master Clock Select", 3, 0),
960 	DMX6FIRE_CONTROL("Optical Digital Input Switch", 4, 0),
961 	DMX6FIRE_CONTROL("Phono Analog Input Switch", 5, 0),
962 	DMX6FIRE_CONTROL("Breakbox LED", 6, 0),
963 };
964 
965 
966 static int snd_ice1712_ews_add_controls(struct snd_ice1712 *ice)
967 {
968 	unsigned int idx;
969 	int err;
970 
971 	/* all terratec cards have spdif, but cs8427 module builds it's own controls */
972 	if (ice->cs8427 == NULL) {
973 		err = snd_ice1712_spdif_build_controls(ice);
974 		if (err < 0)
975 			return err;
976 	}
977 
978 	/* ak4524 controls */
979 	switch (ice->eeprom.subvendor) {
980 	case ICE1712_SUBDEVICE_EWX2496:
981 	case ICE1712_SUBDEVICE_EWS88MT:
982 	case ICE1712_SUBDEVICE_EWS88MT_NEW:
983 	case ICE1712_SUBDEVICE_PHASE88:
984 	case ICE1712_SUBDEVICE_TS88:
985 	case ICE1712_SUBDEVICE_DMX6FIRE:
986 		err = snd_ice1712_akm4xxx_build_controls(ice);
987 		if (err < 0)
988 			return err;
989 		break;
990 	}
991 
992 	/* card specific controls */
993 	switch (ice->eeprom.subvendor) {
994 	case ICE1712_SUBDEVICE_EWX2496:
995 		for (idx = 0; idx < ARRAY_SIZE(snd_ice1712_ewx2496_controls); idx++) {
996 			err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_ewx2496_controls[idx], ice));
997 			if (err < 0)
998 				return err;
999 		}
1000 		break;
1001 	case ICE1712_SUBDEVICE_EWS88MT:
1002 	case ICE1712_SUBDEVICE_EWS88MT_NEW:
1003 	case ICE1712_SUBDEVICE_PHASE88:
1004 	case ICE1712_SUBDEVICE_TS88:
1005 		err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_ews88mt_input_sense, ice));
1006 		if (err < 0)
1007 			return err;
1008 		err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_ews88mt_output_sense, ice));
1009 		if (err < 0)
1010 			return err;
1011 		break;
1012 	case ICE1712_SUBDEVICE_EWS88D:
1013 		for (idx = 0; idx < ARRAY_SIZE(snd_ice1712_ews88d_controls); idx++) {
1014 			err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_ews88d_controls[idx], ice));
1015 			if (err < 0)
1016 				return err;
1017 		}
1018 		break;
1019 	case ICE1712_SUBDEVICE_DMX6FIRE:
1020 		for (idx = 0; idx < ARRAY_SIZE(snd_ice1712_6fire_controls); idx++) {
1021 			err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_6fire_controls[idx], ice));
1022 			if (err < 0)
1023 				return err;
1024 		}
1025 		break;
1026 	}
1027 	return 0;
1028 }
1029 
1030 
1031 /* entry point */
1032 struct snd_ice1712_card_info snd_ice1712_ews_cards[] = {
1033 	{
1034 		.subvendor = ICE1712_SUBDEVICE_EWX2496,
1035 		.name = "TerraTec EWX24/96",
1036 		.model = "ewx2496",
1037 		.chip_init = snd_ice1712_ews_init,
1038 		.build_controls = snd_ice1712_ews_add_controls,
1039 	},
1040 	{
1041 		.subvendor = ICE1712_SUBDEVICE_EWS88MT,
1042 		.name = "TerraTec EWS88MT",
1043 		.model = "ews88mt",
1044 		.chip_init = snd_ice1712_ews_init,
1045 		.build_controls = snd_ice1712_ews_add_controls,
1046 	},
1047 	{
1048 		.subvendor = ICE1712_SUBDEVICE_EWS88MT_NEW,
1049 		.name = "TerraTec EWS88MT",
1050 		.model = "ews88mt_new",
1051 		.chip_init = snd_ice1712_ews_init,
1052 		.build_controls = snd_ice1712_ews_add_controls,
1053 	},
1054 	{
1055 		.subvendor = ICE1712_SUBDEVICE_PHASE88,
1056 		.name = "TerraTec Phase88",
1057 		.model = "phase88",
1058 		.chip_init = snd_ice1712_ews_init,
1059 		.build_controls = snd_ice1712_ews_add_controls,
1060 	},
1061 	{
1062 		.subvendor = ICE1712_SUBDEVICE_TS88,
1063 		.name = "terrasoniq TS88",
1064 		.model = "phase88",
1065 		.chip_init = snd_ice1712_ews_init,
1066 		.build_controls = snd_ice1712_ews_add_controls,
1067 	},
1068 	{
1069 		.subvendor = ICE1712_SUBDEVICE_EWS88D,
1070 		.name = "TerraTec EWS88D",
1071 		.model = "ews88d",
1072 		.chip_init = snd_ice1712_ews_init,
1073 		.build_controls = snd_ice1712_ews_add_controls,
1074 	},
1075 	{
1076 		.subvendor = ICE1712_SUBDEVICE_DMX6FIRE,
1077 		.name = "TerraTec DMX6Fire",
1078 		.model = "dmx6fire",
1079 		.chip_init = snd_ice1712_ews_init,
1080 		.build_controls = snd_ice1712_ews_add_controls,
1081 		.mpu401_1_name = "MIDI-Front DMX6fire",
1082 		.mpu401_2_name = "Wavetable DMX6fire",
1083 		.mpu401_2_info_flags = MPU401_INFO_OUTPUT,
1084 	},
1085 	{ } /* terminator */
1086 };
1087