revo.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. /*
  2. * ALSA driver for ICEnsemble ICE1712 (Envy24)
  3. *
  4. * Lowlevel functions for M-Audio Audiophile 192, Revolution 7.1 and 5.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 <linux/delay.h>
  24. #include <linux/interrupt.h>
  25. #include <linux/init.h>
  26. #include <linux/slab.h>
  27. #include <sound/core.h>
  28. #include "ice1712.h"
  29. #include "envy24ht.h"
  30. #include "revo.h"
  31. /* a non-standard I2C device for revo51 */
  32. struct revo51_spec {
  33. struct snd_i2c_device *dev;
  34. struct snd_pt2258 *pt2258;
  35. struct ak4114 *ak4114;
  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); /* 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. AK_DAC("PCM Headphone Volume", 2),
  188. };
  189. static const char *revo51_adc_input_names[] = {
  190. "Mic",
  191. "Line",
  192. "CD",
  193. NULL
  194. };
  195. static const struct snd_akm4xxx_adc_channel revo51_adc[] = {
  196. {
  197. .name = "PCM Capture Volume",
  198. .switch_name = "PCM Capture Switch",
  199. .num_channels = 2,
  200. .input_names = revo51_adc_input_names
  201. },
  202. };
  203. static struct snd_akm4xxx akm_revo_front = {
  204. .type = SND_AK4381,
  205. .num_dacs = 2,
  206. .ops = {
  207. .set_rate_val = revo_set_rate_val
  208. },
  209. .dac_info = revo71_front,
  210. };
  211. static struct snd_ak4xxx_private akm_revo_front_priv = {
  212. .caddr = 1,
  213. .cif = 0,
  214. .data_mask = VT1724_REVO_CDOUT,
  215. .clk_mask = VT1724_REVO_CCLK,
  216. .cs_mask = VT1724_REVO_CS0 | VT1724_REVO_CS1 | VT1724_REVO_CS2,
  217. .cs_addr = VT1724_REVO_CS0 | VT1724_REVO_CS2,
  218. .cs_none = VT1724_REVO_CS0 | VT1724_REVO_CS1 | VT1724_REVO_CS2,
  219. .add_flags = VT1724_REVO_CCLK, /* high at init */
  220. .mask_flags = 0,
  221. };
  222. static struct snd_akm4xxx akm_revo_surround = {
  223. .type = SND_AK4355,
  224. .idx_offset = 1,
  225. .num_dacs = 6,
  226. .ops = {
  227. .set_rate_val = revo_set_rate_val
  228. },
  229. .dac_info = revo71_surround,
  230. };
  231. static struct snd_ak4xxx_private akm_revo_surround_priv = {
  232. .caddr = 3,
  233. .cif = 0,
  234. .data_mask = VT1724_REVO_CDOUT,
  235. .clk_mask = VT1724_REVO_CCLK,
  236. .cs_mask = VT1724_REVO_CS0 | VT1724_REVO_CS1 | VT1724_REVO_CS2,
  237. .cs_addr = VT1724_REVO_CS0 | VT1724_REVO_CS1,
  238. .cs_none = VT1724_REVO_CS0 | VT1724_REVO_CS1 | VT1724_REVO_CS2,
  239. .add_flags = VT1724_REVO_CCLK, /* high at init */
  240. .mask_flags = 0,
  241. };
  242. static struct snd_akm4xxx akm_revo51 = {
  243. .type = SND_AK4358,
  244. .num_dacs = 8,
  245. .ops = {
  246. .set_rate_val = revo_set_rate_val
  247. },
  248. .dac_info = revo51_dac,
  249. };
  250. static struct snd_ak4xxx_private akm_revo51_priv = {
  251. .caddr = 2,
  252. .cif = 0,
  253. .data_mask = VT1724_REVO_CDOUT,
  254. .clk_mask = VT1724_REVO_CCLK,
  255. .cs_mask = VT1724_REVO_CS0 | VT1724_REVO_CS1,
  256. .cs_addr = VT1724_REVO_CS1,
  257. .cs_none = VT1724_REVO_CS0 | VT1724_REVO_CS1,
  258. .add_flags = VT1724_REVO_CCLK, /* high at init */
  259. .mask_flags = 0,
  260. };
  261. static struct snd_akm4xxx akm_revo51_adc = {
  262. .type = SND_AK5365,
  263. .num_adcs = 2,
  264. .adc_info = revo51_adc,
  265. };
  266. static struct snd_ak4xxx_private akm_revo51_adc_priv = {
  267. .caddr = 2,
  268. .cif = 0,
  269. .data_mask = VT1724_REVO_CDOUT,
  270. .clk_mask = VT1724_REVO_CCLK,
  271. .cs_mask = VT1724_REVO_CS0 | VT1724_REVO_CS1,
  272. .cs_addr = VT1724_REVO_CS0,
  273. .cs_none = VT1724_REVO_CS0 | VT1724_REVO_CS1,
  274. .add_flags = VT1724_REVO_CCLK, /* high at init */
  275. .mask_flags = 0,
  276. };
  277. static struct snd_pt2258 ptc_revo51_volume;
  278. /* AK4358 for AP192 DAC, AK5385A for ADC */
  279. static void ap192_set_rate_val(struct snd_akm4xxx *ak, unsigned int rate)
  280. {
  281. struct snd_ice1712 *ice = ak->private_data[0];
  282. int dfs;
  283. revo_set_rate_val(ak, rate);
  284. /* reset CKS */
  285. snd_ice1712_gpio_write_bits(ice, 1 << 8, rate > 96000 ? 1 << 8 : 0);
  286. /* reset DFS pins of AK5385A for ADC, too */
  287. if (rate > 96000)
  288. dfs = 2;
  289. else if (rate > 48000)
  290. dfs = 1;
  291. else
  292. dfs = 0;
  293. snd_ice1712_gpio_write_bits(ice, 3 << 9, dfs << 9);
  294. /* reset ADC */
  295. snd_ice1712_gpio_write_bits(ice, 1 << 11, 0);
  296. snd_ice1712_gpio_write_bits(ice, 1 << 11, 1 << 11);
  297. }
  298. static const struct snd_akm4xxx_dac_channel ap192_dac[] = {
  299. AK_DAC("PCM Playback Volume", 2)
  300. };
  301. static struct snd_akm4xxx akm_ap192 = {
  302. .type = SND_AK4358,
  303. .num_dacs = 2,
  304. .ops = {
  305. .set_rate_val = ap192_set_rate_val
  306. },
  307. .dac_info = ap192_dac,
  308. };
  309. static struct snd_ak4xxx_private akm_ap192_priv = {
  310. .caddr = 2,
  311. .cif = 0,
  312. .data_mask = VT1724_REVO_CDOUT,
  313. .clk_mask = VT1724_REVO_CCLK,
  314. .cs_mask = VT1724_REVO_CS0 | VT1724_REVO_CS3,
  315. .cs_addr = VT1724_REVO_CS3,
  316. .cs_none = VT1724_REVO_CS0 | VT1724_REVO_CS3,
  317. .add_flags = VT1724_REVO_CCLK, /* high at init */
  318. .mask_flags = 0,
  319. };
  320. /* AK4114 support on Audiophile 192 */
  321. /* CDTO (pin 32) -- GPIO2 pin 52
  322. * CDTI (pin 33) -- GPIO3 pin 53 (shared with AK4358)
  323. * CCLK (pin 34) -- GPIO1 pin 51 (shared with AK4358)
  324. * CSN (pin 35) -- GPIO7 pin 59
  325. */
  326. #define AK4114_ADDR 0x00
  327. static void write_data(struct snd_ice1712 *ice, unsigned int gpio,
  328. unsigned int data, int idx)
  329. {
  330. for (; idx >= 0; idx--) {
  331. /* drop clock */
  332. gpio &= ~VT1724_REVO_CCLK;
  333. snd_ice1712_gpio_write(ice, gpio);
  334. udelay(1);
  335. /* set data */
  336. if (data & (1 << idx))
  337. gpio |= VT1724_REVO_CDOUT;
  338. else
  339. gpio &= ~VT1724_REVO_CDOUT;
  340. snd_ice1712_gpio_write(ice, gpio);
  341. udelay(1);
  342. /* raise clock */
  343. gpio |= VT1724_REVO_CCLK;
  344. snd_ice1712_gpio_write(ice, gpio);
  345. udelay(1);
  346. }
  347. }
  348. static unsigned char read_data(struct snd_ice1712 *ice, unsigned int gpio,
  349. int idx)
  350. {
  351. unsigned char data = 0;
  352. for (; idx >= 0; idx--) {
  353. /* drop clock */
  354. gpio &= ~VT1724_REVO_CCLK;
  355. snd_ice1712_gpio_write(ice, gpio);
  356. udelay(1);
  357. /* read data */
  358. if (snd_ice1712_gpio_read(ice) & VT1724_REVO_CDIN)
  359. data |= (1 << idx);
  360. udelay(1);
  361. /* raise clock */
  362. gpio |= VT1724_REVO_CCLK;
  363. snd_ice1712_gpio_write(ice, gpio);
  364. udelay(1);
  365. }
  366. return data;
  367. }
  368. static unsigned int ap192_4wire_start(struct snd_ice1712 *ice)
  369. {
  370. unsigned int tmp;
  371. snd_ice1712_save_gpio_status(ice);
  372. tmp = snd_ice1712_gpio_read(ice);
  373. tmp |= VT1724_REVO_CCLK; /* high at init */
  374. tmp |= VT1724_REVO_CS0;
  375. tmp &= ~VT1724_REVO_CS3;
  376. snd_ice1712_gpio_write(ice, tmp);
  377. udelay(1);
  378. return tmp;
  379. }
  380. static void ap192_4wire_finish(struct snd_ice1712 *ice, unsigned int tmp)
  381. {
  382. tmp |= VT1724_REVO_CS3;
  383. tmp |= VT1724_REVO_CS0;
  384. snd_ice1712_gpio_write(ice, tmp);
  385. udelay(1);
  386. snd_ice1712_restore_gpio_status(ice);
  387. }
  388. static void ap192_ak4114_write(void *private_data, unsigned char addr,
  389. unsigned char data)
  390. {
  391. struct snd_ice1712 *ice = private_data;
  392. unsigned int tmp, addrdata;
  393. tmp = ap192_4wire_start(ice);
  394. addrdata = (AK4114_ADDR << 6) | 0x20 | (addr & 0x1f);
  395. addrdata = (addrdata << 8) | data;
  396. write_data(ice, tmp, addrdata, 15);
  397. ap192_4wire_finish(ice, tmp);
  398. }
  399. static unsigned char ap192_ak4114_read(void *private_data, unsigned char addr)
  400. {
  401. struct snd_ice1712 *ice = private_data;
  402. unsigned int tmp;
  403. unsigned char data;
  404. tmp = ap192_4wire_start(ice);
  405. write_data(ice, tmp, (AK4114_ADDR << 6) | (addr & 0x1f), 7);
  406. data = read_data(ice, tmp, 7);
  407. ap192_4wire_finish(ice, tmp);
  408. return data;
  409. }
  410. static int ap192_ak4114_init(struct snd_ice1712 *ice)
  411. {
  412. static const unsigned char ak4114_init_vals[] = {
  413. AK4114_RST | AK4114_PWN | AK4114_OCKS0,
  414. AK4114_DIF_I24I2S,
  415. AK4114_TX1E,
  416. AK4114_EFH_1024 | AK4114_DIT | AK4114_IPS(0),
  417. 0,
  418. 0
  419. };
  420. static const unsigned char ak4114_init_txcsb[] = {
  421. 0x41, 0x02, 0x2c, 0x00, 0x00
  422. };
  423. int err;
  424. struct revo51_spec *spec;
  425. spec = kzalloc(sizeof(*spec), GFP_KERNEL);
  426. if (!spec)
  427. return -ENOMEM;
  428. ice->spec = spec;
  429. err = snd_ak4114_create(ice->card,
  430. ap192_ak4114_read,
  431. ap192_ak4114_write,
  432. ak4114_init_vals, ak4114_init_txcsb,
  433. ice, &spec->ak4114);
  434. if (err < 0)
  435. return err;
  436. /* AK4114 in Revo cannot detect external rate correctly.
  437. * No reason to stop capture stream due to incorrect checks */
  438. spec->ak4114->check_flags = AK4114_CHECK_NO_RATE;
  439. return 0;
  440. }
  441. static int revo_init(struct snd_ice1712 *ice)
  442. {
  443. struct snd_akm4xxx *ak;
  444. int err;
  445. /* determine I2C, DACs and ADCs */
  446. switch (ice->eeprom.subvendor) {
  447. case VT1724_SUBDEVICE_REVOLUTION71:
  448. ice->num_total_dacs = 8;
  449. ice->num_total_adcs = 2;
  450. ice->gpio.i2s_mclk_changed = revo_i2s_mclk_changed;
  451. break;
  452. case VT1724_SUBDEVICE_REVOLUTION51:
  453. ice->num_total_dacs = 8;
  454. ice->num_total_adcs = 2;
  455. break;
  456. case VT1724_SUBDEVICE_AUDIOPHILE192:
  457. ice->num_total_dacs = 2;
  458. ice->num_total_adcs = 2;
  459. break;
  460. default:
  461. snd_BUG();
  462. return -EINVAL;
  463. }
  464. /* second stage of initialization, analog parts and others */
  465. ak = ice->akm = kcalloc(2, sizeof(struct snd_akm4xxx), GFP_KERNEL);
  466. if (! ak)
  467. return -ENOMEM;
  468. switch (ice->eeprom.subvendor) {
  469. case VT1724_SUBDEVICE_REVOLUTION71:
  470. ice->akm_codecs = 2;
  471. err = snd_ice1712_akm4xxx_init(ak, &akm_revo_front,
  472. &akm_revo_front_priv, ice);
  473. if (err < 0)
  474. return err;
  475. err = snd_ice1712_akm4xxx_init(ak+1, &akm_revo_surround,
  476. &akm_revo_surround_priv, ice);
  477. if (err < 0)
  478. return err;
  479. /* unmute all codecs */
  480. snd_ice1712_gpio_write_bits(ice, VT1724_REVO_MUTE,
  481. VT1724_REVO_MUTE);
  482. break;
  483. case VT1724_SUBDEVICE_REVOLUTION51:
  484. ice->akm_codecs = 2;
  485. err = snd_ice1712_akm4xxx_init(ak, &akm_revo51,
  486. &akm_revo51_priv, ice);
  487. if (err < 0)
  488. return err;
  489. err = snd_ice1712_akm4xxx_init(ak+1, &akm_revo51_adc,
  490. &akm_revo51_adc_priv, ice);
  491. if (err < 0)
  492. return err;
  493. err = revo51_i2c_init(ice, &ptc_revo51_volume);
  494. if (err < 0)
  495. return err;
  496. /* unmute all codecs */
  497. snd_ice1712_gpio_write_bits(ice, VT1724_REVO_MUTE,
  498. VT1724_REVO_MUTE);
  499. break;
  500. case VT1724_SUBDEVICE_AUDIOPHILE192:
  501. ice->akm_codecs = 1;
  502. err = snd_ice1712_akm4xxx_init(ak, &akm_ap192, &akm_ap192_priv,
  503. ice);
  504. if (err < 0)
  505. return err;
  506. err = ap192_ak4114_init(ice);
  507. if (err < 0)
  508. return err;
  509. /* unmute all codecs */
  510. snd_ice1712_gpio_write_bits(ice, VT1724_REVO_MUTE,
  511. VT1724_REVO_MUTE);
  512. break;
  513. }
  514. return 0;
  515. }
  516. static int revo_add_controls(struct snd_ice1712 *ice)
  517. {
  518. struct revo51_spec *spec = ice->spec;
  519. int err;
  520. switch (ice->eeprom.subvendor) {
  521. case VT1724_SUBDEVICE_REVOLUTION71:
  522. err = snd_ice1712_akm4xxx_build_controls(ice);
  523. if (err < 0)
  524. return err;
  525. break;
  526. case VT1724_SUBDEVICE_REVOLUTION51:
  527. err = snd_ice1712_akm4xxx_build_controls(ice);
  528. if (err < 0)
  529. return err;
  530. spec = ice->spec;
  531. err = snd_pt2258_build_controls(spec->pt2258);
  532. if (err < 0)
  533. return err;
  534. break;
  535. case VT1724_SUBDEVICE_AUDIOPHILE192:
  536. err = snd_ice1712_akm4xxx_build_controls(ice);
  537. if (err < 0)
  538. return err;
  539. /* only capture SPDIF over AK4114 */
  540. err = snd_ak4114_build(spec->ak4114, NULL,
  541. ice->pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream);
  542. if (err < 0)
  543. return err;
  544. break;
  545. }
  546. return 0;
  547. }
  548. /* entry point */
  549. struct snd_ice1712_card_info snd_vt1724_revo_cards[] = {
  550. {
  551. .subvendor = VT1724_SUBDEVICE_REVOLUTION71,
  552. .name = "M Audio Revolution-7.1",
  553. .model = "revo71",
  554. .chip_init = revo_init,
  555. .build_controls = revo_add_controls,
  556. },
  557. {
  558. .subvendor = VT1724_SUBDEVICE_REVOLUTION51,
  559. .name = "M Audio Revolution-5.1",
  560. .model = "revo51",
  561. .chip_init = revo_init,
  562. .build_controls = revo_add_controls,
  563. },
  564. {
  565. .subvendor = VT1724_SUBDEVICE_AUDIOPHILE192,
  566. .name = "M Audio Audiophile192",
  567. .model = "ap192",
  568. .chip_init = revo_init,
  569. .build_controls = revo_add_controls,
  570. },
  571. { } /* terminator */
  572. };