revo.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. /*
  2. * ALSA driver for ICEnsemble ICE1712 (Envy24)
  3. *
  4. * Lowlevel functions for M-Audio Revolution 7.1
  5. *
  6. * Copyright (c) 2003 Takashi Iwai <tiwai@suse.de>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. *
  22. */
  23. #include <asm/io.h>
  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 "ice1712.h"
  30. #include "envy24ht.h"
  31. #include "revo.h"
  32. /* a non-standard I2C device for revo51 */
  33. struct revo51_spec {
  34. struct snd_i2c_device *dev;
  35. struct snd_pt2258 *pt2258;
  36. };
  37. static void revo_i2s_mclk_changed(struct snd_ice1712 *ice)
  38. {
  39. /* assert PRST# to converters; MT05 bit 7 */
  40. outb(inb(ICEMT1724(ice, AC97_CMD)) | 0x80, ICEMT1724(ice, AC97_CMD));
  41. mdelay(5);
  42. /* deassert PRST# */
  43. outb(inb(ICEMT1724(ice, AC97_CMD)) & ~0x80, ICEMT1724(ice, AC97_CMD));
  44. }
  45. /*
  46. * change the rate of envy24HT, AK4355 and AK4381
  47. */
  48. static void revo_set_rate_val(struct snd_akm4xxx *ak, unsigned int rate)
  49. {
  50. unsigned char old, tmp, dfs;
  51. int reg, shift;
  52. if (rate == 0) /* no hint - S/PDIF input is master, simply return */
  53. return;
  54. /* adjust DFS on codecs */
  55. if (rate > 96000)
  56. dfs = 2;
  57. else if (rate > 48000)
  58. dfs = 1;
  59. else
  60. dfs = 0;
  61. if (ak->type == SND_AK4355 || ak->type == SND_AK4358) {
  62. reg = 2;
  63. shift = 4;
  64. } else {
  65. reg = 1;
  66. shift = 3;
  67. }
  68. tmp = snd_akm4xxx_get(ak, 0, reg);
  69. old = (tmp >> shift) & 0x03;
  70. if (old == dfs)
  71. return;
  72. /* reset DFS */
  73. snd_akm4xxx_reset(ak, 1);
  74. tmp = snd_akm4xxx_get(ak, 0, reg);
  75. tmp &= ~(0x03 << shift);
  76. tmp |= dfs << shift;
  77. // snd_akm4xxx_write(ak, 0, reg, tmp);
  78. snd_akm4xxx_set(ak, 0, reg, tmp); /* the value is written in reset(0) */
  79. snd_akm4xxx_reset(ak, 0);
  80. }
  81. /*
  82. * I2C access to the PT2258 volume controller on GPIO 6/7 (Revolution 5.1)
  83. */
  84. static void revo_i2c_start(struct snd_i2c_bus *bus)
  85. {
  86. struct snd_ice1712 *ice = bus->private_data;
  87. snd_ice1712_save_gpio_status(ice);
  88. }
  89. static void revo_i2c_stop(struct snd_i2c_bus *bus)
  90. {
  91. struct snd_ice1712 *ice = bus->private_data;
  92. snd_ice1712_restore_gpio_status(ice);
  93. }
  94. static void revo_i2c_direction(struct snd_i2c_bus *bus, int clock, int data)
  95. {
  96. struct snd_ice1712 *ice = bus->private_data;
  97. unsigned int mask, val;
  98. val = 0;
  99. if (clock)
  100. val |= VT1724_REVO_I2C_CLOCK; /* write SCL */
  101. if (data)
  102. val |= VT1724_REVO_I2C_DATA; /* write SDA */
  103. mask = VT1724_REVO_I2C_CLOCK | VT1724_REVO_I2C_DATA;
  104. ice->gpio.direction &= ~mask;
  105. ice->gpio.direction |= val;
  106. snd_ice1712_gpio_set_dir(ice, ice->gpio.direction);
  107. snd_ice1712_gpio_set_mask(ice, ~mask);
  108. }
  109. static void revo_i2c_setlines(struct snd_i2c_bus *bus, int clk, int data)
  110. {
  111. struct snd_ice1712 *ice = bus->private_data;
  112. unsigned int val = 0;
  113. if (clk)
  114. val |= VT1724_REVO_I2C_CLOCK;
  115. if (data)
  116. val |= VT1724_REVO_I2C_DATA;
  117. snd_ice1712_gpio_write_bits(ice,
  118. VT1724_REVO_I2C_DATA |
  119. VT1724_REVO_I2C_CLOCK, val);
  120. udelay(5);
  121. }
  122. static int revo_i2c_getdata(struct snd_i2c_bus *bus, int ack)
  123. {
  124. struct snd_ice1712 *ice = bus->private_data;
  125. int bit;
  126. if (ack)
  127. udelay(5);
  128. bit = snd_ice1712_gpio_read_bits(ice, VT1724_REVO_I2C_DATA) ? 1 : 0;
  129. return bit;
  130. }
  131. static struct snd_i2c_bit_ops revo51_bit_ops = {
  132. .start = revo_i2c_start,
  133. .stop = revo_i2c_stop,
  134. .direction = revo_i2c_direction,
  135. .setlines = revo_i2c_setlines,
  136. .getdata = revo_i2c_getdata,
  137. };
  138. static int revo51_i2c_init(struct snd_ice1712 *ice,
  139. struct snd_pt2258 *pt)
  140. {
  141. struct revo51_spec *spec;
  142. int err;
  143. spec = kzalloc(sizeof(*spec), GFP_KERNEL);
  144. if (!spec)
  145. return -ENOMEM;
  146. ice->spec = spec;
  147. /* create the I2C bus */
  148. err = snd_i2c_bus_create(ice->card, "ICE1724 GPIO6", NULL, &ice->i2c);
  149. if (err < 0)
  150. return err;
  151. ice->i2c->private_data = ice;
  152. ice->i2c->hw_ops.bit = &revo51_bit_ops;
  153. /* create the I2C device */
  154. err = snd_i2c_device_create(ice->i2c, "PT2258", 0x40, &spec->dev);
  155. if (err < 0)
  156. return err;
  157. pt->card = ice->card;
  158. pt->i2c_bus = ice->i2c;
  159. pt->i2c_dev = spec->dev;
  160. spec->pt2258 = pt;
  161. snd_pt2258_reset(pt);
  162. return 0;
  163. }
  164. /*
  165. * initialize the chips on M-Audio Revolution cards
  166. */
  167. #define AK_DAC(xname,xch) { .name = xname, .num_channels = xch }
  168. static const struct snd_akm4xxx_dac_channel revo71_front[] = {
  169. {
  170. .name = "PCM Playback Volume",
  171. .num_channels = 2,
  172. /* front channels DAC supports muting */
  173. .switch_name = "PCM Playback Switch",
  174. },
  175. };
  176. static const struct snd_akm4xxx_dac_channel revo71_surround[] = {
  177. AK_DAC("PCM Center Playback Volume", 1),
  178. AK_DAC("PCM LFE Playback Volume", 1),
  179. AK_DAC("PCM Side Playback Volume", 2),
  180. AK_DAC("PCM Rear Playback Volume", 2),
  181. };
  182. static const struct snd_akm4xxx_dac_channel revo51_dac[] = {
  183. AK_DAC("PCM Playback Volume", 2),
  184. AK_DAC("PCM Center Playback Volume", 1),
  185. AK_DAC("PCM LFE Playback Volume", 1),
  186. AK_DAC("PCM Rear Playback Volume", 2),
  187. };
  188. static const char *revo51_adc_input_names[] = {
  189. "Mic",
  190. "Line",
  191. "CD",
  192. NULL
  193. };
  194. static const struct snd_akm4xxx_adc_channel revo51_adc[] = {
  195. {
  196. .name = "PCM Capture Volume",
  197. .switch_name = "PCM Capture Switch",
  198. .num_channels = 2,
  199. .input_names = revo51_adc_input_names
  200. },
  201. };
  202. static struct snd_akm4xxx akm_revo_front __devinitdata = {
  203. .type = SND_AK4381,
  204. .num_dacs = 2,
  205. .ops = {
  206. .set_rate_val = revo_set_rate_val
  207. },
  208. .dac_info = revo71_front,
  209. };
  210. static struct snd_ak4xxx_private akm_revo_front_priv __devinitdata = {
  211. .caddr = 1,
  212. .cif = 0,
  213. .data_mask = VT1724_REVO_CDOUT,
  214. .clk_mask = VT1724_REVO_CCLK,
  215. .cs_mask = VT1724_REVO_CS0 | VT1724_REVO_CS1 | VT1724_REVO_CS2,
  216. .cs_addr = VT1724_REVO_CS0 | VT1724_REVO_CS2,
  217. .cs_none = VT1724_REVO_CS0 | VT1724_REVO_CS1 | VT1724_REVO_CS2,
  218. .add_flags = VT1724_REVO_CCLK, /* high at init */
  219. .mask_flags = 0,
  220. };
  221. static struct snd_akm4xxx akm_revo_surround __devinitdata = {
  222. .type = SND_AK4355,
  223. .idx_offset = 1,
  224. .num_dacs = 6,
  225. .ops = {
  226. .set_rate_val = revo_set_rate_val
  227. },
  228. .dac_info = revo71_surround,
  229. };
  230. static struct snd_ak4xxx_private akm_revo_surround_priv __devinitdata = {
  231. .caddr = 3,
  232. .cif = 0,
  233. .data_mask = VT1724_REVO_CDOUT,
  234. .clk_mask = VT1724_REVO_CCLK,
  235. .cs_mask = VT1724_REVO_CS0 | VT1724_REVO_CS1 | VT1724_REVO_CS2,
  236. .cs_addr = VT1724_REVO_CS0 | VT1724_REVO_CS1,
  237. .cs_none = VT1724_REVO_CS0 | VT1724_REVO_CS1 | VT1724_REVO_CS2,
  238. .add_flags = VT1724_REVO_CCLK, /* high at init */
  239. .mask_flags = 0,
  240. };
  241. static struct snd_akm4xxx akm_revo51 __devinitdata = {
  242. .type = SND_AK4358,
  243. .num_dacs = 6,
  244. .ops = {
  245. .set_rate_val = revo_set_rate_val
  246. },
  247. .dac_info = revo51_dac,
  248. };
  249. static struct snd_ak4xxx_private akm_revo51_priv __devinitdata = {
  250. .caddr = 2,
  251. .cif = 0,
  252. .data_mask = VT1724_REVO_CDOUT,
  253. .clk_mask = VT1724_REVO_CCLK,
  254. .cs_mask = VT1724_REVO_CS0 | VT1724_REVO_CS1,
  255. .cs_addr = VT1724_REVO_CS1,
  256. .cs_none = VT1724_REVO_CS0 | VT1724_REVO_CS1,
  257. .add_flags = VT1724_REVO_CCLK, /* high at init */
  258. .mask_flags = 0,
  259. };
  260. static struct snd_akm4xxx akm_revo51_adc __devinitdata = {
  261. .type = SND_AK5365,
  262. .num_adcs = 2,
  263. .adc_info = revo51_adc,
  264. };
  265. static struct snd_ak4xxx_private akm_revo51_adc_priv __devinitdata = {
  266. .caddr = 2,
  267. .cif = 0,
  268. .data_mask = VT1724_REVO_CDOUT,
  269. .clk_mask = VT1724_REVO_CCLK,
  270. .cs_mask = VT1724_REVO_CS0 | VT1724_REVO_CS1,
  271. .cs_addr = VT1724_REVO_CS0,
  272. .cs_none = VT1724_REVO_CS0 | VT1724_REVO_CS1,
  273. .add_flags = VT1724_REVO_CCLK, /* high at init */
  274. .mask_flags = 0,
  275. };
  276. static struct snd_pt2258 ptc_revo51_volume;
  277. /* AK4358 for AP192 DAC, AK5385A for ADC */
  278. static void ap192_set_rate_val(struct snd_akm4xxx *ak, unsigned int rate)
  279. {
  280. struct snd_ice1712 *ice = ak->private_data[0];
  281. int dfs;
  282. revo_set_rate_val(ak, rate);
  283. /* reset CKS */
  284. snd_ice1712_gpio_write_bits(ice, 1 << 8, rate > 96000 ? 1 << 8 : 0);
  285. /* reset DFS pins of AK5385A for ADC, too */
  286. if (rate > 96000)
  287. dfs = 2;
  288. else if (rate > 48000)
  289. dfs = 1;
  290. else
  291. dfs = 0;
  292. snd_ice1712_gpio_write_bits(ice, 3 << 9, dfs << 9);
  293. /* reset ADC */
  294. snd_ice1712_gpio_write_bits(ice, 1 << 11, 0);
  295. snd_ice1712_gpio_write_bits(ice, 1 << 11, 1 << 11);
  296. }
  297. static const struct snd_akm4xxx_dac_channel ap192_dac[] = {
  298. AK_DAC("PCM Playback Volume", 2)
  299. };
  300. static struct snd_akm4xxx akm_ap192 __devinitdata = {
  301. .type = SND_AK4358,
  302. .num_dacs = 2,
  303. .ops = {
  304. .set_rate_val = ap192_set_rate_val
  305. },
  306. .dac_info = ap192_dac,
  307. };
  308. static struct snd_ak4xxx_private akm_ap192_priv __devinitdata = {
  309. .caddr = 2,
  310. .cif = 0,
  311. .data_mask = VT1724_REVO_CDOUT,
  312. .clk_mask = VT1724_REVO_CCLK,
  313. .cs_mask = VT1724_REVO_CS0 | VT1724_REVO_CS1,
  314. .cs_addr = VT1724_REVO_CS1,
  315. .cs_none = VT1724_REVO_CS0 | VT1724_REVO_CS1,
  316. .add_flags = VT1724_REVO_CCLK, /* high at init */
  317. .mask_flags = 0,
  318. };
  319. /* AK4114 support on Audiophile 192 */
  320. /* CDTO (pin 32) -- GPIO2 pin 52
  321. * CDTI (pin 33) -- GPIO3 pin 53 (shared with AK4358)
  322. * CCLK (pin 34) -- GPIO1 pin 51 (shared with AK4358)
  323. * CSN (pin 35) -- GPIO7 pin 59
  324. */
  325. #define AK4114_ADDR 0x02
  326. static void write_data(struct snd_ice1712 *ice, unsigned int gpio,
  327. unsigned int data, int idx)
  328. {
  329. for (; idx >= 0; idx--) {
  330. /* drop clock */
  331. gpio &= ~VT1724_REVO_CCLK;
  332. snd_ice1712_gpio_write(ice, gpio);
  333. udelay(1);
  334. /* set data */
  335. if (data & (1 << idx))
  336. gpio |= VT1724_REVO_CDOUT;
  337. else
  338. gpio &= ~VT1724_REVO_CDOUT;
  339. snd_ice1712_gpio_write(ice, gpio);
  340. udelay(1);
  341. /* raise clock */
  342. gpio |= VT1724_REVO_CCLK;
  343. snd_ice1712_gpio_write(ice, gpio);
  344. udelay(1);
  345. }
  346. }
  347. static unsigned char read_data(struct snd_ice1712 *ice, unsigned int gpio,
  348. int idx)
  349. {
  350. unsigned char data = 0;
  351. for (; idx >= 0; idx--) {
  352. /* drop clock */
  353. gpio &= ~VT1724_REVO_CCLK;
  354. snd_ice1712_gpio_write(ice, gpio);
  355. udelay(1);
  356. /* read data */
  357. if (snd_ice1712_gpio_read(ice) & VT1724_REVO_CDIN)
  358. data |= (1 << idx);
  359. udelay(1);
  360. /* raise clock */
  361. gpio |= VT1724_REVO_CCLK;
  362. snd_ice1712_gpio_write(ice, gpio);
  363. udelay(1);
  364. }
  365. return data;
  366. }
  367. static unsigned int ap192_4wire_start(struct snd_ice1712 *ice)
  368. {
  369. unsigned int tmp;
  370. snd_ice1712_save_gpio_status(ice);
  371. tmp = snd_ice1712_gpio_read(ice);
  372. tmp |= VT1724_REVO_CCLK; /* high at init */
  373. tmp |= VT1724_REVO_CS0;
  374. tmp &= ~VT1724_REVO_CS1;
  375. snd_ice1712_gpio_write(ice, tmp);
  376. udelay(1);
  377. return tmp;
  378. }
  379. static void ap192_4wire_finish(struct snd_ice1712 *ice, unsigned int tmp)
  380. {
  381. tmp |= VT1724_REVO_CS1;
  382. tmp |= VT1724_REVO_CS0;
  383. snd_ice1712_gpio_write(ice, tmp);
  384. udelay(1);
  385. snd_ice1712_restore_gpio_status(ice);
  386. }
  387. static void ap192_ak4114_write(void *private_data, unsigned char addr,
  388. unsigned char data)
  389. {
  390. struct snd_ice1712 *ice = private_data;
  391. unsigned int tmp, addrdata;
  392. tmp = ap192_4wire_start(ice);
  393. addrdata = (AK4114_ADDR << 6) | 0x20 | (addr & 0x1f);
  394. addrdata = (addrdata << 8) | data;
  395. write_data(ice, tmp, addrdata, 15);
  396. ap192_4wire_finish(ice, tmp);
  397. }
  398. static unsigned char ap192_ak4114_read(void *private_data, unsigned char addr)
  399. {
  400. struct snd_ice1712 *ice = private_data;
  401. unsigned int tmp;
  402. unsigned char data;
  403. tmp = ap192_4wire_start(ice);
  404. write_data(ice, tmp, (AK4114_ADDR << 6) | (addr & 0x1f), 7);
  405. data = read_data(ice, tmp, 7);
  406. ap192_4wire_finish(ice, tmp);
  407. return data;
  408. }
  409. static int __devinit ap192_ak4114_init(struct snd_ice1712 *ice)
  410. {
  411. static const unsigned char ak4114_init_vals[] = {
  412. AK4114_RST | AK4114_PWN | AK4114_OCKS0 | AK4114_OCKS1,
  413. AK4114_DIF_I24I2S,
  414. AK4114_TX1E,
  415. AK4114_EFH_1024 | AK4114_DIT | AK4114_IPS(1),
  416. 0,
  417. 0
  418. };
  419. static const unsigned char ak4114_init_txcsb[] = {
  420. 0x41, 0x02, 0x2c, 0x00, 0x00
  421. };
  422. struct ak4114 *ak;
  423. int err;
  424. err = snd_ak4114_create(ice->card,
  425. ap192_ak4114_read,
  426. ap192_ak4114_write,
  427. ak4114_init_vals, ak4114_init_txcsb,
  428. ice, &ak);
  429. /* AK4114 in Revo cannot detect external rate correctly.
  430. * No reason to stop capture stream due to incorrect checks */
  431. ak->check_flags = AK4114_CHECK_NO_RATE;
  432. return 0; /* error ignored; it's no fatal error */
  433. }
  434. static int __devinit revo_init(struct snd_ice1712 *ice)
  435. {
  436. struct snd_akm4xxx *ak;
  437. int err;
  438. /* determine I2C, DACs and ADCs */
  439. switch (ice->eeprom.subvendor) {
  440. case VT1724_SUBDEVICE_REVOLUTION71:
  441. ice->num_total_dacs = 8;
  442. ice->num_total_adcs = 2;
  443. ice->gpio.i2s_mclk_changed = revo_i2s_mclk_changed;
  444. break;
  445. case VT1724_SUBDEVICE_REVOLUTION51:
  446. ice->num_total_dacs = 6;
  447. ice->num_total_adcs = 2;
  448. break;
  449. case VT1724_SUBDEVICE_AUDIOPHILE192:
  450. ice->num_total_dacs = 2;
  451. ice->num_total_adcs = 2;
  452. break;
  453. default:
  454. snd_BUG();
  455. return -EINVAL;
  456. }
  457. /* second stage of initialization, analog parts and others */
  458. ak = ice->akm = kcalloc(2, sizeof(struct snd_akm4xxx), GFP_KERNEL);
  459. if (! ak)
  460. return -ENOMEM;
  461. ice->akm_codecs = 2;
  462. switch (ice->eeprom.subvendor) {
  463. case VT1724_SUBDEVICE_REVOLUTION71:
  464. ice->akm_codecs = 2;
  465. if ((err = snd_ice1712_akm4xxx_init(ak, &akm_revo_front, &akm_revo_front_priv, ice)) < 0)
  466. return err;
  467. if ((err = snd_ice1712_akm4xxx_init(ak + 1, &akm_revo_surround, &akm_revo_surround_priv, ice)) < 0)
  468. return err;
  469. /* unmute all codecs */
  470. snd_ice1712_gpio_write_bits(ice, VT1724_REVO_MUTE, VT1724_REVO_MUTE);
  471. break;
  472. case VT1724_SUBDEVICE_REVOLUTION51:
  473. ice->akm_codecs = 2;
  474. err = snd_ice1712_akm4xxx_init(ak, &akm_revo51,
  475. &akm_revo51_priv, ice);
  476. if (err < 0)
  477. return err;
  478. err = snd_ice1712_akm4xxx_init(ak+1, &akm_revo51_adc,
  479. &akm_revo51_adc_priv, ice);
  480. if (err < 0)
  481. return err;
  482. err = revo51_i2c_init(ice, &ptc_revo51_volume);
  483. if (err < 0)
  484. return err;
  485. /* unmute all codecs */
  486. snd_ice1712_gpio_write_bits(ice, VT1724_REVO_MUTE,
  487. VT1724_REVO_MUTE);
  488. break;
  489. case VT1724_SUBDEVICE_AUDIOPHILE192:
  490. ice->akm_codecs = 1;
  491. err = snd_ice1712_akm4xxx_init(ak, &akm_ap192, &akm_ap192_priv,
  492. ice);
  493. if (err < 0)
  494. return err;
  495. /* unmute all codecs */
  496. snd_ice1712_gpio_write_bits(ice, VT1724_REVO_MUTE,
  497. VT1724_REVO_MUTE);
  498. break;
  499. }
  500. return 0;
  501. }
  502. static int __devinit revo_add_controls(struct snd_ice1712 *ice)
  503. {
  504. struct revo51_spec *spec;
  505. int err;
  506. switch (ice->eeprom.subvendor) {
  507. case VT1724_SUBDEVICE_REVOLUTION71:
  508. err = snd_ice1712_akm4xxx_build_controls(ice);
  509. if (err < 0)
  510. return err;
  511. break;
  512. case VT1724_SUBDEVICE_REVOLUTION51:
  513. err = snd_ice1712_akm4xxx_build_controls(ice);
  514. if (err < 0)
  515. return err;
  516. spec = ice->spec;
  517. err = snd_pt2258_build_controls(spec->pt2258);
  518. if (err < 0)
  519. return err;
  520. break;
  521. case VT1724_SUBDEVICE_AUDIOPHILE192:
  522. err = snd_ice1712_akm4xxx_build_controls(ice);
  523. if (err < 0)
  524. return err;
  525. err = ap192_ak4114_init(ice);
  526. if (err < 0)
  527. return err;
  528. break;
  529. }
  530. return 0;
  531. }
  532. /* entry point */
  533. struct snd_ice1712_card_info snd_vt1724_revo_cards[] __devinitdata = {
  534. {
  535. .subvendor = VT1724_SUBDEVICE_REVOLUTION71,
  536. .name = "M Audio Revolution-7.1",
  537. .model = "revo71",
  538. .chip_init = revo_init,
  539. .build_controls = revo_add_controls,
  540. },
  541. {
  542. .subvendor = VT1724_SUBDEVICE_REVOLUTION51,
  543. .name = "M Audio Revolution-5.1",
  544. .model = "revo51",
  545. .chip_init = revo_init,
  546. .build_controls = revo_add_controls,
  547. },
  548. {
  549. .subvendor = VT1724_SUBDEVICE_AUDIOPHILE192,
  550. .name = "M Audio Audiophile192",
  551. .model = "ap192",
  552. .chip_init = revo_init,
  553. .build_controls = revo_add_controls,
  554. },
  555. { } /* terminator */
  556. };