quartet.c 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105
  1. /*
  2. * ALSA driver for ICEnsemble VT1724 (Envy24HT)
  3. *
  4. * Lowlevel functions for Infrasonic Quartet
  5. *
  6. * Copyright (c) 2009 Pavel Hofman <pavel.hofman@ivitera.com>
  7. *
  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/tlv.h>
  30. #include <sound/info.h>
  31. #include "ice1712.h"
  32. #include "envy24ht.h"
  33. #include <sound/ak4113.h>
  34. #include "quartet.h"
  35. struct qtet_spec {
  36. struct ak4113 *ak4113;
  37. unsigned int scr; /* system control register */
  38. unsigned int mcr; /* monitoring control register */
  39. unsigned int cpld; /* cpld register */
  40. };
  41. struct qtet_kcontrol_private {
  42. unsigned int bit;
  43. void (*set_register)(struct snd_ice1712 *ice, unsigned int val);
  44. unsigned int (*get_register)(struct snd_ice1712 *ice);
  45. const char * const texts[2];
  46. };
  47. enum {
  48. IN12_SEL = 0,
  49. IN34_SEL,
  50. AIN34_SEL,
  51. COAX_OUT,
  52. IN12_MON12,
  53. IN12_MON34,
  54. IN34_MON12,
  55. IN34_MON34,
  56. OUT12_MON34,
  57. OUT34_MON12,
  58. };
  59. static const char * const ext_clock_names[3] = {"IEC958 In", "Word Clock 1xFS",
  60. "Word Clock 256xFS"};
  61. /* chip address on I2C bus */
  62. #define AK4113_ADDR 0x26 /* S/PDIF receiver */
  63. /* chip address on SPI bus */
  64. #define AK4620_ADDR 0x02 /* ADC/DAC */
  65. /*
  66. * GPIO pins
  67. */
  68. /* GPIO0 - O - DATA0, def. 0 */
  69. #define GPIO_D0 (1<<0)
  70. /* GPIO1 - I/O - DATA1, Jack Detect Input0 (0:present, 1:missing), def. 1 */
  71. #define GPIO_D1_JACKDTC0 (1<<1)
  72. /* GPIO2 - I/O - DATA2, Jack Detect Input1 (0:present, 1:missing), def. 1 */
  73. #define GPIO_D2_JACKDTC1 (1<<2)
  74. /* GPIO3 - I/O - DATA3, def. 1 */
  75. #define GPIO_D3 (1<<3)
  76. /* GPIO4 - I/O - DATA4, SPI CDTO, def. 1 */
  77. #define GPIO_D4_SPI_CDTO (1<<4)
  78. /* GPIO5 - I/O - DATA5, SPI CCLK, def. 1 */
  79. #define GPIO_D5_SPI_CCLK (1<<5)
  80. /* GPIO6 - I/O - DATA6, Cable Detect Input (0:detected, 1:not detected */
  81. #define GPIO_D6_CD (1<<6)
  82. /* GPIO7 - I/O - DATA7, Device Detect Input (0:detected, 1:not detected */
  83. #define GPIO_D7_DD (1<<7)
  84. /* GPIO8 - O - CPLD Chip Select, def. 1 */
  85. #define GPIO_CPLD_CSN (1<<8)
  86. /* GPIO9 - O - CPLD register read/write (0:write, 1:read), def. 0 */
  87. #define GPIO_CPLD_RW (1<<9)
  88. /* GPIO10 - O - SPI Chip Select for CODEC#0, def. 1 */
  89. #define GPIO_SPI_CSN0 (1<<10)
  90. /* GPIO11 - O - SPI Chip Select for CODEC#1, def. 1 */
  91. #define GPIO_SPI_CSN1 (1<<11)
  92. /* GPIO12 - O - Ex. Register Output Enable (0:enable, 1:disable), def. 1,
  93. * init 0 */
  94. #define GPIO_EX_GPIOE (1<<12)
  95. /* GPIO13 - O - Ex. Register0 Chip Select for System Control Register,
  96. * def. 1 */
  97. #define GPIO_SCR (1<<13)
  98. /* GPIO14 - O - Ex. Register1 Chip Select for Monitor Control Register,
  99. * def. 1 */
  100. #define GPIO_MCR (1<<14)
  101. #define GPIO_SPI_ALL (GPIO_D4_SPI_CDTO | GPIO_D5_SPI_CCLK |\
  102. GPIO_SPI_CSN0 | GPIO_SPI_CSN1)
  103. #define GPIO_DATA_MASK (GPIO_D0 | GPIO_D1_JACKDTC0 | \
  104. GPIO_D2_JACKDTC1 | GPIO_D3 | \
  105. GPIO_D4_SPI_CDTO | GPIO_D5_SPI_CCLK | \
  106. GPIO_D6_CD | GPIO_D7_DD)
  107. /* System Control Register GPIO_SCR data bits */
  108. /* Mic/Line select relay (0:line, 1:mic) */
  109. #define SCR_RELAY GPIO_D0
  110. /* Phantom power drive control (0:5V, 1:48V) */
  111. #define SCR_PHP_V GPIO_D1_JACKDTC0
  112. /* H/W mute control (0:Normal, 1:Mute) */
  113. #define SCR_MUTE GPIO_D2_JACKDTC1
  114. /* Phantom power control (0:Phantom on, 1:off) */
  115. #define SCR_PHP GPIO_D3
  116. /* Analog input 1/2 Source Select */
  117. #define SCR_AIN12_SEL0 GPIO_D4_SPI_CDTO
  118. #define SCR_AIN12_SEL1 GPIO_D5_SPI_CCLK
  119. /* Analog input 3/4 Source Select (0:line, 1:hi-z) */
  120. #define SCR_AIN34_SEL GPIO_D6_CD
  121. /* Codec Power Down (0:power down, 1:normal) */
  122. #define SCR_CODEC_PDN GPIO_D7_DD
  123. #define SCR_AIN12_LINE (0)
  124. #define SCR_AIN12_MIC (SCR_AIN12_SEL0)
  125. #define SCR_AIN12_LOWCUT (SCR_AIN12_SEL1 | SCR_AIN12_SEL0)
  126. /* Monitor Control Register GPIO_MCR data bits */
  127. /* Input 1/2 to Monitor 1/2 (0:off, 1:on) */
  128. #define MCR_IN12_MON12 GPIO_D0
  129. /* Input 1/2 to Monitor 3/4 (0:off, 1:on) */
  130. #define MCR_IN12_MON34 GPIO_D1_JACKDTC0
  131. /* Input 3/4 to Monitor 1/2 (0:off, 1:on) */
  132. #define MCR_IN34_MON12 GPIO_D2_JACKDTC1
  133. /* Input 3/4 to Monitor 3/4 (0:off, 1:on) */
  134. #define MCR_IN34_MON34 GPIO_D3
  135. /* Output to Monitor 1/2 (0:off, 1:on) */
  136. #define MCR_OUT34_MON12 GPIO_D4_SPI_CDTO
  137. /* Output to Monitor 3/4 (0:off, 1:on) */
  138. #define MCR_OUT12_MON34 GPIO_D5_SPI_CCLK
  139. /* CPLD Register DATA bits */
  140. /* Clock Rate Select */
  141. #define CPLD_CKS0 GPIO_D0
  142. #define CPLD_CKS1 GPIO_D1_JACKDTC0
  143. #define CPLD_CKS2 GPIO_D2_JACKDTC1
  144. /* Sync Source Select (0:Internal, 1:External) */
  145. #define CPLD_SYNC_SEL GPIO_D3
  146. /* Word Clock FS Select (0:FS, 1:256FS) */
  147. #define CPLD_WORD_SEL GPIO_D4_SPI_CDTO
  148. /* Coaxial Output Source (IS-Link) (0:SPDIF, 1:I2S) */
  149. #define CPLD_COAX_OUT GPIO_D5_SPI_CCLK
  150. /* Input 1/2 Source Select (0:Analog12, 1:An34) */
  151. #define CPLD_IN12_SEL GPIO_D6_CD
  152. /* Input 3/4 Source Select (0:Analog34, 1:Digital In) */
  153. #define CPLD_IN34_SEL GPIO_D7_DD
  154. /* internal clock (CPLD_SYNC_SEL = 0) options */
  155. #define CPLD_CKS_44100HZ (0)
  156. #define CPLD_CKS_48000HZ (CPLD_CKS0)
  157. #define CPLD_CKS_88200HZ (CPLD_CKS1)
  158. #define CPLD_CKS_96000HZ (CPLD_CKS1 | CPLD_CKS0)
  159. #define CPLD_CKS_176400HZ (CPLD_CKS2)
  160. #define CPLD_CKS_192000HZ (CPLD_CKS2 | CPLD_CKS0)
  161. #define CPLD_CKS_MASK (CPLD_CKS0 | CPLD_CKS1 | CPLD_CKS2)
  162. /* external clock (CPLD_SYNC_SEL = 1) options */
  163. /* external clock - SPDIF */
  164. #define CPLD_EXT_SPDIF (0 | CPLD_SYNC_SEL)
  165. /* external clock - WordClock 1xfs */
  166. #define CPLD_EXT_WORDCLOCK_1FS (CPLD_CKS1 | CPLD_SYNC_SEL)
  167. /* external clock - WordClock 256xfs */
  168. #define CPLD_EXT_WORDCLOCK_256FS (CPLD_CKS1 | CPLD_WORD_SEL |\
  169. CPLD_SYNC_SEL)
  170. #define EXT_SPDIF_TYPE 0
  171. #define EXT_WORDCLOCK_1FS_TYPE 1
  172. #define EXT_WORDCLOCK_256FS_TYPE 2
  173. #define AK4620_DFS0 (1<<0)
  174. #define AK4620_DFS1 (1<<1)
  175. #define AK4620_CKS0 (1<<2)
  176. #define AK4620_CKS1 (1<<3)
  177. /* Clock and Format Control register */
  178. #define AK4620_DFS_REG 0x02
  179. /* Deem and Volume Control register */
  180. #define AK4620_DEEMVOL_REG 0x03
  181. #define AK4620_SMUTE (1<<7)
  182. /*
  183. * Conversion from int value to its binary form. Used for debugging.
  184. * The output buffer must be allocated prior to calling the function.
  185. */
  186. static char *get_binary(char *buffer, int value)
  187. {
  188. int i, j, pos;
  189. pos = 0;
  190. for (i = 0; i < 4; ++i) {
  191. for (j = 0; j < 8; ++j) {
  192. if (value & (1 << (31-(i*8 + j))))
  193. buffer[pos] = '1';
  194. else
  195. buffer[pos] = '0';
  196. pos++;
  197. }
  198. if (i < 3) {
  199. buffer[pos] = ' ';
  200. pos++;
  201. }
  202. }
  203. buffer[pos] = '\0';
  204. return buffer;
  205. }
  206. /*
  207. * Initial setup of the conversion array GPIO <-> rate
  208. */
  209. static unsigned int qtet_rates[] = {
  210. 44100, 48000, 88200,
  211. 96000, 176400, 192000,
  212. };
  213. static unsigned int cks_vals[] = {
  214. CPLD_CKS_44100HZ, CPLD_CKS_48000HZ, CPLD_CKS_88200HZ,
  215. CPLD_CKS_96000HZ, CPLD_CKS_176400HZ, CPLD_CKS_192000HZ,
  216. };
  217. static struct snd_pcm_hw_constraint_list qtet_rates_info = {
  218. .count = ARRAY_SIZE(qtet_rates),
  219. .list = qtet_rates,
  220. .mask = 0,
  221. };
  222. static void qtet_ak4113_write(void *private_data, unsigned char reg,
  223. unsigned char val)
  224. {
  225. snd_vt1724_write_i2c((struct snd_ice1712 *)private_data, AK4113_ADDR,
  226. reg, val);
  227. }
  228. static unsigned char qtet_ak4113_read(void *private_data, unsigned char reg)
  229. {
  230. return snd_vt1724_read_i2c((struct snd_ice1712 *)private_data,
  231. AK4113_ADDR, reg);
  232. }
  233. /*
  234. * AK4620 section
  235. */
  236. /*
  237. * Write data to addr register of ak4620
  238. */
  239. static void qtet_akm_write(struct snd_akm4xxx *ak, int chip,
  240. unsigned char addr, unsigned char data)
  241. {
  242. unsigned int tmp, orig_dir;
  243. int idx;
  244. unsigned int addrdata;
  245. struct snd_ice1712 *ice = ak->private_data[0];
  246. if (snd_BUG_ON(chip < 0 || chip >= 4))
  247. return;
  248. /*dev_dbg(ice->card->dev, "Writing to AK4620: chip=%d, addr=0x%x,
  249. data=0x%x\n", chip, addr, data);*/
  250. orig_dir = ice->gpio.get_dir(ice);
  251. ice->gpio.set_dir(ice, orig_dir | GPIO_SPI_ALL);
  252. /* set mask - only SPI bits */
  253. ice->gpio.set_mask(ice, ~GPIO_SPI_ALL);
  254. tmp = ice->gpio.get_data(ice);
  255. /* high all */
  256. tmp |= GPIO_SPI_ALL;
  257. ice->gpio.set_data(ice, tmp);
  258. udelay(100);
  259. /* drop chip select */
  260. if (chip)
  261. /* CODEC 1 */
  262. tmp &= ~GPIO_SPI_CSN1;
  263. else
  264. tmp &= ~GPIO_SPI_CSN0;
  265. ice->gpio.set_data(ice, tmp);
  266. udelay(100);
  267. /* build I2C address + data byte */
  268. addrdata = (AK4620_ADDR << 6) | 0x20 | (addr & 0x1f);
  269. addrdata = (addrdata << 8) | data;
  270. for (idx = 15; idx >= 0; idx--) {
  271. /* drop clock */
  272. tmp &= ~GPIO_D5_SPI_CCLK;
  273. ice->gpio.set_data(ice, tmp);
  274. udelay(100);
  275. /* set data */
  276. if (addrdata & (1 << idx))
  277. tmp |= GPIO_D4_SPI_CDTO;
  278. else
  279. tmp &= ~GPIO_D4_SPI_CDTO;
  280. ice->gpio.set_data(ice, tmp);
  281. udelay(100);
  282. /* raise clock */
  283. tmp |= GPIO_D5_SPI_CCLK;
  284. ice->gpio.set_data(ice, tmp);
  285. udelay(100);
  286. }
  287. /* all back to 1 */
  288. tmp |= GPIO_SPI_ALL;
  289. ice->gpio.set_data(ice, tmp);
  290. udelay(100);
  291. /* return all gpios to non-writable */
  292. ice->gpio.set_mask(ice, 0xffffff);
  293. /* restore GPIOs direction */
  294. ice->gpio.set_dir(ice, orig_dir);
  295. }
  296. static void qtet_akm_set_regs(struct snd_akm4xxx *ak, unsigned char addr,
  297. unsigned char mask, unsigned char value)
  298. {
  299. unsigned char tmp;
  300. int chip;
  301. for (chip = 0; chip < ak->num_chips; chip++) {
  302. tmp = snd_akm4xxx_get(ak, chip, addr);
  303. /* clear the bits */
  304. tmp &= ~mask;
  305. /* set the new bits */
  306. tmp |= value;
  307. snd_akm4xxx_write(ak, chip, addr, tmp);
  308. }
  309. }
  310. /*
  311. * change the rate of AK4620
  312. */
  313. static void qtet_akm_set_rate_val(struct snd_akm4xxx *ak, unsigned int rate)
  314. {
  315. unsigned char ak4620_dfs;
  316. if (rate == 0) /* no hint - S/PDIF input is master or the new spdif
  317. input rate undetected, simply return */
  318. return;
  319. /* adjust DFS on codecs - see datasheet */
  320. if (rate > 108000)
  321. ak4620_dfs = AK4620_DFS1 | AK4620_CKS1;
  322. else if (rate > 54000)
  323. ak4620_dfs = AK4620_DFS0 | AK4620_CKS0;
  324. else
  325. ak4620_dfs = 0;
  326. /* set new value */
  327. qtet_akm_set_regs(ak, AK4620_DFS_REG, AK4620_DFS0 | AK4620_DFS1 |
  328. AK4620_CKS0 | AK4620_CKS1, ak4620_dfs);
  329. }
  330. #define AK_CONTROL(xname, xch) { .name = xname, .num_channels = xch }
  331. #define PCM_12_PLAYBACK_VOLUME "PCM 1/2 Playback Volume"
  332. #define PCM_34_PLAYBACK_VOLUME "PCM 3/4 Playback Volume"
  333. #define PCM_12_CAPTURE_VOLUME "PCM 1/2 Capture Volume"
  334. #define PCM_34_CAPTURE_VOLUME "PCM 3/4 Capture Volume"
  335. static const struct snd_akm4xxx_dac_channel qtet_dac[] = {
  336. AK_CONTROL(PCM_12_PLAYBACK_VOLUME, 2),
  337. AK_CONTROL(PCM_34_PLAYBACK_VOLUME, 2),
  338. };
  339. static const struct snd_akm4xxx_adc_channel qtet_adc[] = {
  340. AK_CONTROL(PCM_12_CAPTURE_VOLUME, 2),
  341. AK_CONTROL(PCM_34_CAPTURE_VOLUME, 2),
  342. };
  343. static struct snd_akm4xxx akm_qtet_dac = {
  344. .type = SND_AK4620,
  345. .num_dacs = 4, /* DAC1 - Output 12
  346. */
  347. .num_adcs = 4, /* ADC1 - Input 12
  348. */
  349. .ops = {
  350. .write = qtet_akm_write,
  351. .set_rate_val = qtet_akm_set_rate_val,
  352. },
  353. .dac_info = qtet_dac,
  354. .adc_info = qtet_adc,
  355. };
  356. /* Communication routines with the CPLD */
  357. /* Writes data to external register reg, both reg and data are
  358. * GPIO representations */
  359. static void reg_write(struct snd_ice1712 *ice, unsigned int reg,
  360. unsigned int data)
  361. {
  362. unsigned int tmp;
  363. mutex_lock(&ice->gpio_mutex);
  364. /* set direction of used GPIOs*/
  365. /* all outputs */
  366. tmp = 0x00ffff;
  367. ice->gpio.set_dir(ice, tmp);
  368. /* mask - writable bits */
  369. ice->gpio.set_mask(ice, ~(tmp));
  370. /* write the data */
  371. tmp = ice->gpio.get_data(ice);
  372. tmp &= ~GPIO_DATA_MASK;
  373. tmp |= data;
  374. ice->gpio.set_data(ice, tmp);
  375. udelay(100);
  376. /* drop output enable */
  377. tmp &= ~GPIO_EX_GPIOE;
  378. ice->gpio.set_data(ice, tmp);
  379. udelay(100);
  380. /* drop the register gpio */
  381. tmp &= ~reg;
  382. ice->gpio.set_data(ice, tmp);
  383. udelay(100);
  384. /* raise the register GPIO */
  385. tmp |= reg;
  386. ice->gpio.set_data(ice, tmp);
  387. udelay(100);
  388. /* raise all data gpios */
  389. tmp |= GPIO_DATA_MASK;
  390. ice->gpio.set_data(ice, tmp);
  391. /* mask - immutable bits */
  392. ice->gpio.set_mask(ice, 0xffffff);
  393. /* outputs only 8-15 */
  394. ice->gpio.set_dir(ice, 0x00ff00);
  395. mutex_unlock(&ice->gpio_mutex);
  396. }
  397. static unsigned int get_scr(struct snd_ice1712 *ice)
  398. {
  399. struct qtet_spec *spec = ice->spec;
  400. return spec->scr;
  401. }
  402. static unsigned int get_mcr(struct snd_ice1712 *ice)
  403. {
  404. struct qtet_spec *spec = ice->spec;
  405. return spec->mcr;
  406. }
  407. static unsigned int get_cpld(struct snd_ice1712 *ice)
  408. {
  409. struct qtet_spec *spec = ice->spec;
  410. return spec->cpld;
  411. }
  412. static void set_scr(struct snd_ice1712 *ice, unsigned int val)
  413. {
  414. struct qtet_spec *spec = ice->spec;
  415. reg_write(ice, GPIO_SCR, val);
  416. spec->scr = val;
  417. }
  418. static void set_mcr(struct snd_ice1712 *ice, unsigned int val)
  419. {
  420. struct qtet_spec *spec = ice->spec;
  421. reg_write(ice, GPIO_MCR, val);
  422. spec->mcr = val;
  423. }
  424. static void set_cpld(struct snd_ice1712 *ice, unsigned int val)
  425. {
  426. struct qtet_spec *spec = ice->spec;
  427. reg_write(ice, GPIO_CPLD_CSN, val);
  428. spec->cpld = val;
  429. }
  430. static void proc_regs_read(struct snd_info_entry *entry,
  431. struct snd_info_buffer *buffer)
  432. {
  433. struct snd_ice1712 *ice = entry->private_data;
  434. char bin_buffer[36];
  435. snd_iprintf(buffer, "SCR: %s\n", get_binary(bin_buffer,
  436. get_scr(ice)));
  437. snd_iprintf(buffer, "MCR: %s\n", get_binary(bin_buffer,
  438. get_mcr(ice)));
  439. snd_iprintf(buffer, "CPLD: %s\n", get_binary(bin_buffer,
  440. get_cpld(ice)));
  441. }
  442. static void proc_init(struct snd_ice1712 *ice)
  443. {
  444. struct snd_info_entry *entry;
  445. if (!snd_card_proc_new(ice->card, "quartet", &entry))
  446. snd_info_set_text_ops(entry, ice, proc_regs_read);
  447. }
  448. static int qtet_mute_get(struct snd_kcontrol *kcontrol,
  449. struct snd_ctl_elem_value *ucontrol)
  450. {
  451. struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
  452. unsigned int val;
  453. val = get_scr(ice) & SCR_MUTE;
  454. ucontrol->value.integer.value[0] = (val) ? 0 : 1;
  455. return 0;
  456. }
  457. static int qtet_mute_put(struct snd_kcontrol *kcontrol,
  458. struct snd_ctl_elem_value *ucontrol)
  459. {
  460. struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
  461. unsigned int old, new, smute;
  462. old = get_scr(ice) & SCR_MUTE;
  463. if (ucontrol->value.integer.value[0]) {
  464. /* unmute */
  465. new = 0;
  466. /* un-smuting DAC */
  467. smute = 0;
  468. } else {
  469. /* mute */
  470. new = SCR_MUTE;
  471. /* smuting DAC */
  472. smute = AK4620_SMUTE;
  473. }
  474. if (old != new) {
  475. struct snd_akm4xxx *ak = ice->akm;
  476. set_scr(ice, (get_scr(ice) & ~SCR_MUTE) | new);
  477. /* set smute */
  478. qtet_akm_set_regs(ak, AK4620_DEEMVOL_REG, AK4620_SMUTE, smute);
  479. return 1;
  480. }
  481. /* no change */
  482. return 0;
  483. }
  484. static int qtet_ain12_enum_info(struct snd_kcontrol *kcontrol,
  485. struct snd_ctl_elem_info *uinfo)
  486. {
  487. static const char * const texts[3] =
  488. {"Line In 1/2", "Mic", "Mic + Low-cut"};
  489. return snd_ctl_enum_info(uinfo, 1, ARRAY_SIZE(texts), texts);
  490. }
  491. static int qtet_ain12_sw_get(struct snd_kcontrol *kcontrol,
  492. struct snd_ctl_elem_value *ucontrol)
  493. {
  494. struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
  495. unsigned int val, result;
  496. val = get_scr(ice) & (SCR_AIN12_SEL1 | SCR_AIN12_SEL0);
  497. switch (val) {
  498. case SCR_AIN12_LINE:
  499. result = 0;
  500. break;
  501. case SCR_AIN12_MIC:
  502. result = 1;
  503. break;
  504. case SCR_AIN12_LOWCUT:
  505. result = 2;
  506. break;
  507. default:
  508. /* BUG - no other combinations allowed */
  509. snd_BUG();
  510. result = 0;
  511. }
  512. ucontrol->value.integer.value[0] = result;
  513. return 0;
  514. }
  515. static int qtet_ain12_sw_put(struct snd_kcontrol *kcontrol,
  516. struct snd_ctl_elem_value *ucontrol)
  517. {
  518. struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
  519. unsigned int old, new, tmp, masked_old;
  520. old = new = get_scr(ice);
  521. masked_old = old & (SCR_AIN12_SEL1 | SCR_AIN12_SEL0);
  522. tmp = ucontrol->value.integer.value[0];
  523. if (tmp == 2)
  524. tmp = 3; /* binary 10 is not supported */
  525. tmp <<= 4; /* shifting to SCR_AIN12_SEL0 */
  526. if (tmp != masked_old) {
  527. /* change requested */
  528. switch (tmp) {
  529. case SCR_AIN12_LINE:
  530. new = old & ~(SCR_AIN12_SEL1 | SCR_AIN12_SEL0);
  531. set_scr(ice, new);
  532. /* turn off relay */
  533. new &= ~SCR_RELAY;
  534. set_scr(ice, new);
  535. break;
  536. case SCR_AIN12_MIC:
  537. /* turn on relay */
  538. new = old | SCR_RELAY;
  539. set_scr(ice, new);
  540. new = (new & ~SCR_AIN12_SEL1) | SCR_AIN12_SEL0;
  541. set_scr(ice, new);
  542. break;
  543. case SCR_AIN12_LOWCUT:
  544. /* turn on relay */
  545. new = old | SCR_RELAY;
  546. set_scr(ice, new);
  547. new |= SCR_AIN12_SEL1 | SCR_AIN12_SEL0;
  548. set_scr(ice, new);
  549. break;
  550. default:
  551. snd_BUG();
  552. }
  553. return 1;
  554. }
  555. /* no change */
  556. return 0;
  557. }
  558. static int qtet_php_get(struct snd_kcontrol *kcontrol,
  559. struct snd_ctl_elem_value *ucontrol)
  560. {
  561. struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
  562. unsigned int val;
  563. /* if phantom voltage =48V, phantom on */
  564. val = get_scr(ice) & SCR_PHP_V;
  565. ucontrol->value.integer.value[0] = val ? 1 : 0;
  566. return 0;
  567. }
  568. static int qtet_php_put(struct snd_kcontrol *kcontrol,
  569. struct snd_ctl_elem_value *ucontrol)
  570. {
  571. struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
  572. unsigned int old, new;
  573. old = new = get_scr(ice);
  574. if (ucontrol->value.integer.value[0] /* phantom on requested */
  575. && (~old & SCR_PHP_V)) /* 0 = voltage 5V */ {
  576. /* is off, turn on */
  577. /* turn voltage on first, = 1 */
  578. new = old | SCR_PHP_V;
  579. set_scr(ice, new);
  580. /* turn phantom on, = 0 */
  581. new &= ~SCR_PHP;
  582. set_scr(ice, new);
  583. } else if (!ucontrol->value.integer.value[0] && (old & SCR_PHP_V)) {
  584. /* phantom off requested and 1 = voltage 48V */
  585. /* is on, turn off */
  586. /* turn voltage off first, = 0 */
  587. new = old & ~SCR_PHP_V;
  588. set_scr(ice, new);
  589. /* turn phantom off, = 1 */
  590. new |= SCR_PHP;
  591. set_scr(ice, new);
  592. }
  593. if (old != new)
  594. return 1;
  595. /* no change */
  596. return 0;
  597. }
  598. #define PRIV_SW(xid, xbit, xreg) [xid] = {.bit = xbit,\
  599. .set_register = set_##xreg,\
  600. .get_register = get_##xreg, }
  601. #define PRIV_ENUM2(xid, xbit, xreg, xtext1, xtext2) [xid] = {.bit = xbit,\
  602. .set_register = set_##xreg,\
  603. .get_register = get_##xreg,\
  604. .texts = {xtext1, xtext2} }
  605. static struct qtet_kcontrol_private qtet_privates[] = {
  606. PRIV_ENUM2(IN12_SEL, CPLD_IN12_SEL, cpld, "An In 1/2", "An In 3/4"),
  607. PRIV_ENUM2(IN34_SEL, CPLD_IN34_SEL, cpld, "An In 3/4", "IEC958 In"),
  608. PRIV_ENUM2(AIN34_SEL, SCR_AIN34_SEL, scr, "Line In 3/4", "Hi-Z"),
  609. PRIV_ENUM2(COAX_OUT, CPLD_COAX_OUT, cpld, "IEC958", "I2S"),
  610. PRIV_SW(IN12_MON12, MCR_IN12_MON12, mcr),
  611. PRIV_SW(IN12_MON34, MCR_IN12_MON34, mcr),
  612. PRIV_SW(IN34_MON12, MCR_IN34_MON12, mcr),
  613. PRIV_SW(IN34_MON34, MCR_IN34_MON34, mcr),
  614. PRIV_SW(OUT12_MON34, MCR_OUT12_MON34, mcr),
  615. PRIV_SW(OUT34_MON12, MCR_OUT34_MON12, mcr),
  616. };
  617. static int qtet_enum_info(struct snd_kcontrol *kcontrol,
  618. struct snd_ctl_elem_info *uinfo)
  619. {
  620. struct qtet_kcontrol_private private =
  621. qtet_privates[kcontrol->private_value];
  622. return snd_ctl_enum_info(uinfo, 1, ARRAY_SIZE(private.texts),
  623. private.texts);
  624. }
  625. static int qtet_sw_get(struct snd_kcontrol *kcontrol,
  626. struct snd_ctl_elem_value *ucontrol)
  627. {
  628. struct qtet_kcontrol_private private =
  629. qtet_privates[kcontrol->private_value];
  630. struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
  631. ucontrol->value.integer.value[0] =
  632. (private.get_register(ice) & private.bit) ? 1 : 0;
  633. return 0;
  634. }
  635. static int qtet_sw_put(struct snd_kcontrol *kcontrol,
  636. struct snd_ctl_elem_value *ucontrol)
  637. {
  638. struct qtet_kcontrol_private private =
  639. qtet_privates[kcontrol->private_value];
  640. struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
  641. unsigned int old, new;
  642. old = private.get_register(ice);
  643. if (ucontrol->value.integer.value[0])
  644. new = old | private.bit;
  645. else
  646. new = old & ~private.bit;
  647. if (old != new) {
  648. private.set_register(ice, new);
  649. return 1;
  650. }
  651. /* no change */
  652. return 0;
  653. }
  654. #define qtet_sw_info snd_ctl_boolean_mono_info
  655. #define QTET_CONTROL(xname, xtype, xpriv) \
  656. {.iface = SNDRV_CTL_ELEM_IFACE_MIXER,\
  657. .name = xname,\
  658. .info = qtet_##xtype##_info,\
  659. .get = qtet_sw_get,\
  660. .put = qtet_sw_put,\
  661. .private_value = xpriv }
  662. static struct snd_kcontrol_new qtet_controls[] = {
  663. {
  664. .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  665. .name = "Master Playback Switch",
  666. .info = qtet_sw_info,
  667. .get = qtet_mute_get,
  668. .put = qtet_mute_put,
  669. .private_value = 0
  670. },
  671. {
  672. .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  673. .name = "Phantom Power",
  674. .info = qtet_sw_info,
  675. .get = qtet_php_get,
  676. .put = qtet_php_put,
  677. .private_value = 0
  678. },
  679. {
  680. .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  681. .name = "Analog In 1/2 Capture Switch",
  682. .info = qtet_ain12_enum_info,
  683. .get = qtet_ain12_sw_get,
  684. .put = qtet_ain12_sw_put,
  685. .private_value = 0
  686. },
  687. QTET_CONTROL("Analog In 3/4 Capture Switch", enum, AIN34_SEL),
  688. QTET_CONTROL("PCM In 1/2 Capture Switch", enum, IN12_SEL),
  689. QTET_CONTROL("PCM In 3/4 Capture Switch", enum, IN34_SEL),
  690. QTET_CONTROL("Coax Output Source", enum, COAX_OUT),
  691. QTET_CONTROL("Analog In 1/2 to Monitor 1/2", sw, IN12_MON12),
  692. QTET_CONTROL("Analog In 1/2 to Monitor 3/4", sw, IN12_MON34),
  693. QTET_CONTROL("Analog In 3/4 to Monitor 1/2", sw, IN34_MON12),
  694. QTET_CONTROL("Analog In 3/4 to Monitor 3/4", sw, IN34_MON34),
  695. QTET_CONTROL("Output 1/2 to Monitor 3/4", sw, OUT12_MON34),
  696. QTET_CONTROL("Output 3/4 to Monitor 1/2", sw, OUT34_MON12),
  697. };
  698. static char *slave_vols[] = {
  699. PCM_12_PLAYBACK_VOLUME,
  700. PCM_34_PLAYBACK_VOLUME,
  701. NULL
  702. };
  703. static
  704. DECLARE_TLV_DB_SCALE(qtet_master_db_scale, -6350, 50, 1);
  705. static struct snd_kcontrol *ctl_find(struct snd_card *card,
  706. const char *name)
  707. {
  708. struct snd_ctl_elem_id sid;
  709. memset(&sid, 0, sizeof(sid));
  710. /* FIXME: strcpy is bad. */
  711. strcpy(sid.name, name);
  712. sid.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
  713. return snd_ctl_find_id(card, &sid);
  714. }
  715. static void add_slaves(struct snd_card *card,
  716. struct snd_kcontrol *master, char * const *list)
  717. {
  718. for (; *list; list++) {
  719. struct snd_kcontrol *slave = ctl_find(card, *list);
  720. if (slave)
  721. snd_ctl_add_slave(master, slave);
  722. }
  723. }
  724. static int qtet_add_controls(struct snd_ice1712 *ice)
  725. {
  726. struct qtet_spec *spec = ice->spec;
  727. int err, i;
  728. struct snd_kcontrol *vmaster;
  729. err = snd_ice1712_akm4xxx_build_controls(ice);
  730. if (err < 0)
  731. return err;
  732. for (i = 0; i < ARRAY_SIZE(qtet_controls); i++) {
  733. err = snd_ctl_add(ice->card,
  734. snd_ctl_new1(&qtet_controls[i], ice));
  735. if (err < 0)
  736. return err;
  737. }
  738. /* Create virtual master control */
  739. vmaster = snd_ctl_make_virtual_master("Master Playback Volume",
  740. qtet_master_db_scale);
  741. if (!vmaster)
  742. return -ENOMEM;
  743. add_slaves(ice->card, vmaster, slave_vols);
  744. err = snd_ctl_add(ice->card, vmaster);
  745. if (err < 0)
  746. return err;
  747. /* only capture SPDIF over AK4113 */
  748. return snd_ak4113_build(spec->ak4113,
  749. ice->pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream);
  750. }
  751. static inline int qtet_is_spdif_master(struct snd_ice1712 *ice)
  752. {
  753. /* CPLD_SYNC_SEL: 0 = internal, 1 = external (i.e. spdif master) */
  754. return (get_cpld(ice) & CPLD_SYNC_SEL) ? 1 : 0;
  755. }
  756. static unsigned int qtet_get_rate(struct snd_ice1712 *ice)
  757. {
  758. int i;
  759. unsigned char result;
  760. result = get_cpld(ice) & CPLD_CKS_MASK;
  761. for (i = 0; i < ARRAY_SIZE(cks_vals); i++)
  762. if (cks_vals[i] == result)
  763. return qtet_rates[i];
  764. return 0;
  765. }
  766. static int get_cks_val(int rate)
  767. {
  768. int i;
  769. for (i = 0; i < ARRAY_SIZE(qtet_rates); i++)
  770. if (qtet_rates[i] == rate)
  771. return cks_vals[i];
  772. return 0;
  773. }
  774. /* setting new rate */
  775. static void qtet_set_rate(struct snd_ice1712 *ice, unsigned int rate)
  776. {
  777. unsigned int new;
  778. unsigned char val;
  779. /* switching ice1724 to external clock - supplied by ext. circuits */
  780. val = inb(ICEMT1724(ice, RATE));
  781. outb(val | VT1724_SPDIF_MASTER, ICEMT1724(ice, RATE));
  782. new = (get_cpld(ice) & ~CPLD_CKS_MASK) | get_cks_val(rate);
  783. /* switch to internal clock, drop CPLD_SYNC_SEL */
  784. new &= ~CPLD_SYNC_SEL;
  785. /* dev_dbg(ice->card->dev, "QT - set_rate: old %x, new %x\n",
  786. get_cpld(ice), new); */
  787. set_cpld(ice, new);
  788. }
  789. static inline unsigned char qtet_set_mclk(struct snd_ice1712 *ice,
  790. unsigned int rate)
  791. {
  792. /* no change in master clock */
  793. return 0;
  794. }
  795. /* setting clock to external - SPDIF */
  796. static int qtet_set_spdif_clock(struct snd_ice1712 *ice, int type)
  797. {
  798. unsigned int old, new;
  799. old = new = get_cpld(ice);
  800. new &= ~(CPLD_CKS_MASK | CPLD_WORD_SEL);
  801. switch (type) {
  802. case EXT_SPDIF_TYPE:
  803. new |= CPLD_EXT_SPDIF;
  804. break;
  805. case EXT_WORDCLOCK_1FS_TYPE:
  806. new |= CPLD_EXT_WORDCLOCK_1FS;
  807. break;
  808. case EXT_WORDCLOCK_256FS_TYPE:
  809. new |= CPLD_EXT_WORDCLOCK_256FS;
  810. break;
  811. default:
  812. snd_BUG();
  813. }
  814. if (old != new) {
  815. set_cpld(ice, new);
  816. /* changed */
  817. return 1;
  818. }
  819. return 0;
  820. }
  821. static int qtet_get_spdif_master_type(struct snd_ice1712 *ice)
  822. {
  823. unsigned int val;
  824. int result;
  825. val = get_cpld(ice);
  826. /* checking only rate/clock-related bits */
  827. val &= (CPLD_CKS_MASK | CPLD_WORD_SEL | CPLD_SYNC_SEL);
  828. if (!(val & CPLD_SYNC_SEL)) {
  829. /* switched to internal clock, is not any external type */
  830. result = -1;
  831. } else {
  832. switch (val) {
  833. case (CPLD_EXT_SPDIF):
  834. result = EXT_SPDIF_TYPE;
  835. break;
  836. case (CPLD_EXT_WORDCLOCK_1FS):
  837. result = EXT_WORDCLOCK_1FS_TYPE;
  838. break;
  839. case (CPLD_EXT_WORDCLOCK_256FS):
  840. result = EXT_WORDCLOCK_256FS_TYPE;
  841. break;
  842. default:
  843. /* undefined combination of external clock setup */
  844. snd_BUG();
  845. result = 0;
  846. }
  847. }
  848. return result;
  849. }
  850. /* Called when ak4113 detects change in the input SPDIF stream */
  851. static void qtet_ak4113_change(struct ak4113 *ak4113, unsigned char c0,
  852. unsigned char c1)
  853. {
  854. struct snd_ice1712 *ice = ak4113->change_callback_private;
  855. int rate;
  856. if ((qtet_get_spdif_master_type(ice) == EXT_SPDIF_TYPE) &&
  857. c1) {
  858. /* only for SPDIF master mode, rate was changed */
  859. rate = snd_ak4113_external_rate(ak4113);
  860. /* dev_dbg(ice->card->dev, "ak4113 - input rate changed to %d\n",
  861. rate); */
  862. qtet_akm_set_rate_val(ice->akm, rate);
  863. }
  864. }
  865. /*
  866. * If clock slaved to SPDIF-IN, setting runtime rate
  867. * to the detected external rate
  868. */
  869. static void qtet_spdif_in_open(struct snd_ice1712 *ice,
  870. struct snd_pcm_substream *substream)
  871. {
  872. struct qtet_spec *spec = ice->spec;
  873. struct snd_pcm_runtime *runtime = substream->runtime;
  874. int rate;
  875. if (qtet_get_spdif_master_type(ice) != EXT_SPDIF_TYPE)
  876. /* not external SPDIF, no rate limitation */
  877. return;
  878. /* only external SPDIF can detect incoming sample rate */
  879. rate = snd_ak4113_external_rate(spec->ak4113);
  880. if (rate >= runtime->hw.rate_min && rate <= runtime->hw.rate_max) {
  881. runtime->hw.rate_min = rate;
  882. runtime->hw.rate_max = rate;
  883. }
  884. }
  885. /*
  886. * initialize the chip
  887. */
  888. static int qtet_init(struct snd_ice1712 *ice)
  889. {
  890. static const unsigned char ak4113_init_vals[] = {
  891. /* AK4113_REG_PWRDN */ AK4113_RST | AK4113_PWN |
  892. AK4113_OCKS0 | AK4113_OCKS1,
  893. /* AK4113_REQ_FORMAT */ AK4113_DIF_I24I2S | AK4113_VTX |
  894. AK4113_DEM_OFF | AK4113_DEAU,
  895. /* AK4113_REG_IO0 */ AK4113_OPS2 | AK4113_TXE |
  896. AK4113_XTL_24_576M,
  897. /* AK4113_REG_IO1 */ AK4113_EFH_1024LRCLK | AK4113_IPS(0),
  898. /* AK4113_REG_INT0_MASK */ 0,
  899. /* AK4113_REG_INT1_MASK */ 0,
  900. /* AK4113_REG_DATDTS */ 0,
  901. };
  902. int err;
  903. struct qtet_spec *spec;
  904. struct snd_akm4xxx *ak;
  905. unsigned char val;
  906. /* switching ice1724 to external clock - supplied by ext. circuits */
  907. val = inb(ICEMT1724(ice, RATE));
  908. outb(val | VT1724_SPDIF_MASTER, ICEMT1724(ice, RATE));
  909. spec = kzalloc(sizeof(*spec), GFP_KERNEL);
  910. if (!spec)
  911. return -ENOMEM;
  912. /* qtet is clocked by Xilinx array */
  913. ice->hw_rates = &qtet_rates_info;
  914. ice->is_spdif_master = qtet_is_spdif_master;
  915. ice->get_rate = qtet_get_rate;
  916. ice->set_rate = qtet_set_rate;
  917. ice->set_mclk = qtet_set_mclk;
  918. ice->set_spdif_clock = qtet_set_spdif_clock;
  919. ice->get_spdif_master_type = qtet_get_spdif_master_type;
  920. ice->ext_clock_names = ext_clock_names;
  921. ice->ext_clock_count = ARRAY_SIZE(ext_clock_names);
  922. /* since Qtet can detect correct SPDIF-in rate, all streams can be
  923. * limited to this specific rate */
  924. ice->spdif.ops.open = ice->pro_open = qtet_spdif_in_open;
  925. ice->spec = spec;
  926. /* Mute Off */
  927. /* SCR Initialize*/
  928. /* keep codec power down first */
  929. set_scr(ice, SCR_PHP);
  930. udelay(1);
  931. /* codec power up */
  932. set_scr(ice, SCR_PHP | SCR_CODEC_PDN);
  933. /* MCR Initialize */
  934. set_mcr(ice, 0);
  935. /* CPLD Initialize */
  936. set_cpld(ice, 0);
  937. ice->num_total_dacs = 2;
  938. ice->num_total_adcs = 2;
  939. ice->akm = kcalloc(2, sizeof(struct snd_akm4xxx), GFP_KERNEL);
  940. ak = ice->akm;
  941. if (!ak)
  942. return -ENOMEM;
  943. /* only one codec with two chips */
  944. ice->akm_codecs = 1;
  945. err = snd_ice1712_akm4xxx_init(ak, &akm_qtet_dac, NULL, ice);
  946. if (err < 0)
  947. return err;
  948. err = snd_ak4113_create(ice->card,
  949. qtet_ak4113_read,
  950. qtet_ak4113_write,
  951. ak4113_init_vals,
  952. ice, &spec->ak4113);
  953. if (err < 0)
  954. return err;
  955. /* callback for codecs rate setting */
  956. spec->ak4113->change_callback = qtet_ak4113_change;
  957. spec->ak4113->change_callback_private = ice;
  958. /* AK41143 in Quartet can detect external rate correctly
  959. * (i.e. check_flags = 0) */
  960. spec->ak4113->check_flags = 0;
  961. proc_init(ice);
  962. qtet_set_rate(ice, 44100);
  963. return 0;
  964. }
  965. static unsigned char qtet_eeprom[] = {
  966. [ICE_EEP2_SYSCONF] = 0x28, /* clock 256(24MHz), mpu401, 1xADC,
  967. 1xDACs, SPDIF in */
  968. [ICE_EEP2_ACLINK] = 0x80, /* I2S */
  969. [ICE_EEP2_I2S] = 0x78, /* 96k, 24bit, 192k */
  970. [ICE_EEP2_SPDIF] = 0xc3, /* out-en, out-int, in, out-ext */
  971. [ICE_EEP2_GPIO_DIR] = 0x00, /* 0-7 inputs, switched to output
  972. only during output operations */
  973. [ICE_EEP2_GPIO_DIR1] = 0xff, /* 8-15 outputs */
  974. [ICE_EEP2_GPIO_DIR2] = 0x00,
  975. [ICE_EEP2_GPIO_MASK] = 0xff, /* changed only for OUT operations */
  976. [ICE_EEP2_GPIO_MASK1] = 0x00,
  977. [ICE_EEP2_GPIO_MASK2] = 0xff,
  978. [ICE_EEP2_GPIO_STATE] = 0x00, /* inputs */
  979. [ICE_EEP2_GPIO_STATE1] = 0x7d, /* all 1, but GPIO_CPLD_RW
  980. and GPIO15 always zero */
  981. [ICE_EEP2_GPIO_STATE2] = 0x00, /* inputs */
  982. };
  983. /* entry point */
  984. struct snd_ice1712_card_info snd_vt1724_qtet_cards[] = {
  985. {
  986. .subvendor = VT1724_SUBDEVICE_QTET,
  987. .name = "Infrasonic Quartet",
  988. .model = "quartet",
  989. .chip_init = qtet_init,
  990. .build_controls = qtet_add_controls,
  991. .eeprom_size = sizeof(qtet_eeprom),
  992. .eeprom_data = qtet_eeprom,
  993. },
  994. { } /* terminator */
  995. };