ews.c 31 KB

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