ews.c 30 KB

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