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