quartet.c 29 KB

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