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