emu10k1_main.c 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436
  1. /*
  2. * Copyright (c) by Jaroslav Kysela <perex@suse.cz>
  3. * Creative Labs, Inc.
  4. * Routines for control of EMU10K1 chips
  5. *
  6. * Copyright (c) by James Courtier-Dutton <James@superbug.demon.co.uk>
  7. * Added support for Audigy 2 Value.
  8. *
  9. *
  10. * BUGS:
  11. * --
  12. *
  13. * TODO:
  14. * --
  15. *
  16. * This program is free software; you can redistribute it and/or modify
  17. * it under the terms of the GNU General Public License as published by
  18. * the Free Software Foundation; either version 2 of the License, or
  19. * (at your option) any later version.
  20. *
  21. * This program is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. * GNU General Public License for more details.
  25. *
  26. * You should have received a copy of the GNU General Public License
  27. * along with this program; if not, write to the Free Software
  28. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  29. *
  30. */
  31. #include <sound/driver.h>
  32. #include <linux/delay.h>
  33. #include <linux/init.h>
  34. #include <linux/interrupt.h>
  35. #include <linux/pci.h>
  36. #include <linux/slab.h>
  37. #include <linux/vmalloc.h>
  38. #include <linux/mutex.h>
  39. #include <sound/core.h>
  40. #include <sound/emu10k1.h>
  41. #include "p16v.h"
  42. #include "tina2.h"
  43. /*************************************************************************
  44. * EMU10K1 init / done
  45. *************************************************************************/
  46. void snd_emu10k1_voice_init(struct snd_emu10k1 * emu, int ch)
  47. {
  48. snd_emu10k1_ptr_write(emu, DCYSUSV, ch, 0);
  49. snd_emu10k1_ptr_write(emu, IP, ch, 0);
  50. snd_emu10k1_ptr_write(emu, VTFT, ch, 0xffff);
  51. snd_emu10k1_ptr_write(emu, CVCF, ch, 0xffff);
  52. snd_emu10k1_ptr_write(emu, PTRX, ch, 0);
  53. snd_emu10k1_ptr_write(emu, CPF, ch, 0);
  54. snd_emu10k1_ptr_write(emu, CCR, ch, 0);
  55. snd_emu10k1_ptr_write(emu, PSST, ch, 0);
  56. snd_emu10k1_ptr_write(emu, DSL, ch, 0x10);
  57. snd_emu10k1_ptr_write(emu, CCCA, ch, 0);
  58. snd_emu10k1_ptr_write(emu, Z1, ch, 0);
  59. snd_emu10k1_ptr_write(emu, Z2, ch, 0);
  60. snd_emu10k1_ptr_write(emu, FXRT, ch, 0x32100000);
  61. snd_emu10k1_ptr_write(emu, ATKHLDM, ch, 0);
  62. snd_emu10k1_ptr_write(emu, DCYSUSM, ch, 0);
  63. snd_emu10k1_ptr_write(emu, IFATN, ch, 0xffff);
  64. snd_emu10k1_ptr_write(emu, PEFE, ch, 0);
  65. snd_emu10k1_ptr_write(emu, FMMOD, ch, 0);
  66. snd_emu10k1_ptr_write(emu, TREMFRQ, ch, 24); /* 1 Hz */
  67. snd_emu10k1_ptr_write(emu, FM2FRQ2, ch, 24); /* 1 Hz */
  68. snd_emu10k1_ptr_write(emu, TEMPENV, ch, 0);
  69. /*** these are last so OFF prevents writing ***/
  70. snd_emu10k1_ptr_write(emu, LFOVAL2, ch, 0);
  71. snd_emu10k1_ptr_write(emu, LFOVAL1, ch, 0);
  72. snd_emu10k1_ptr_write(emu, ATKHLDV, ch, 0);
  73. snd_emu10k1_ptr_write(emu, ENVVOL, ch, 0);
  74. snd_emu10k1_ptr_write(emu, ENVVAL, ch, 0);
  75. /* Audigy extra stuffs */
  76. if (emu->audigy) {
  77. snd_emu10k1_ptr_write(emu, 0x4c, ch, 0); /* ?? */
  78. snd_emu10k1_ptr_write(emu, 0x4d, ch, 0); /* ?? */
  79. snd_emu10k1_ptr_write(emu, 0x4e, ch, 0); /* ?? */
  80. snd_emu10k1_ptr_write(emu, 0x4f, ch, 0); /* ?? */
  81. snd_emu10k1_ptr_write(emu, A_FXRT1, ch, 0x03020100);
  82. snd_emu10k1_ptr_write(emu, A_FXRT2, ch, 0x3f3f3f3f);
  83. snd_emu10k1_ptr_write(emu, A_SENDAMOUNTS, ch, 0);
  84. }
  85. }
  86. static unsigned int spi_dac_init[] = {
  87. 0x00ff,
  88. 0x02ff,
  89. 0x0400,
  90. 0x0520,
  91. 0x0600,
  92. 0x08ff,
  93. 0x0aff,
  94. 0x0cff,
  95. 0x0eff,
  96. 0x10ff,
  97. 0x1200,
  98. 0x1400,
  99. 0x1480,
  100. 0x1800,
  101. 0x1aff,
  102. 0x1cff,
  103. 0x1e00,
  104. 0x0530,
  105. 0x0602,
  106. 0x0622,
  107. 0x1400,
  108. };
  109. static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir, int resume)
  110. {
  111. unsigned int silent_page;
  112. int ch;
  113. /* disable audio and lock cache */
  114. outl(HCFG_LOCKSOUNDCACHE | HCFG_LOCKTANKCACHE_MASK | HCFG_MUTEBUTTONENABLE,
  115. emu->port + HCFG);
  116. /* reset recording buffers */
  117. snd_emu10k1_ptr_write(emu, MICBS, 0, ADCBS_BUFSIZE_NONE);
  118. snd_emu10k1_ptr_write(emu, MICBA, 0, 0);
  119. snd_emu10k1_ptr_write(emu, FXBS, 0, ADCBS_BUFSIZE_NONE);
  120. snd_emu10k1_ptr_write(emu, FXBA, 0, 0);
  121. snd_emu10k1_ptr_write(emu, ADCBS, 0, ADCBS_BUFSIZE_NONE);
  122. snd_emu10k1_ptr_write(emu, ADCBA, 0, 0);
  123. /* disable channel interrupt */
  124. outl(0, emu->port + INTE);
  125. snd_emu10k1_ptr_write(emu, CLIEL, 0, 0);
  126. snd_emu10k1_ptr_write(emu, CLIEH, 0, 0);
  127. snd_emu10k1_ptr_write(emu, SOLEL, 0, 0);
  128. snd_emu10k1_ptr_write(emu, SOLEH, 0, 0);
  129. if (emu->audigy){
  130. /* set SPDIF bypass mode */
  131. snd_emu10k1_ptr_write(emu, SPBYPASS, 0, SPBYPASS_FORMAT);
  132. /* enable rear left + rear right AC97 slots */
  133. snd_emu10k1_ptr_write(emu, AC97SLOT, 0, AC97SLOT_REAR_RIGHT |
  134. AC97SLOT_REAR_LEFT);
  135. }
  136. /* init envelope engine */
  137. for (ch = 0; ch < NUM_G; ch++)
  138. snd_emu10k1_voice_init(emu, ch);
  139. snd_emu10k1_ptr_write(emu, SPCS0, 0, emu->spdif_bits[0]);
  140. snd_emu10k1_ptr_write(emu, SPCS1, 0, emu->spdif_bits[1]);
  141. snd_emu10k1_ptr_write(emu, SPCS2, 0, emu->spdif_bits[2]);
  142. if (emu->card_capabilities->ca0151_chip) { /* audigy2 */
  143. /* Hacks for Alice3 to work independent of haP16V driver */
  144. u32 tmp;
  145. //Setup SRCMulti_I2S SamplingRate
  146. tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0);
  147. tmp &= 0xfffff1ff;
  148. tmp |= (0x2<<9);
  149. snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, 0, tmp);
  150. /* Setup SRCSel (Enable Spdif,I2S SRCMulti) */
  151. snd_emu10k1_ptr20_write(emu, SRCSel, 0, 0x14);
  152. /* Setup SRCMulti Input Audio Enable */
  153. /* Use 0xFFFFFFFF to enable P16V sounds. */
  154. snd_emu10k1_ptr20_write(emu, SRCMULTI_ENABLE, 0, 0xFFFFFFFF);
  155. /* Enabled Phased (8-channel) P16V playback */
  156. outl(0x0201, emu->port + HCFG2);
  157. /* Set playback routing. */
  158. snd_emu10k1_ptr20_write(emu, CAPTURE_P16V_SOURCE, 0, 0x78e4);
  159. }
  160. if (emu->card_capabilities->ca0108_chip) { /* audigy2 Value */
  161. /* Hacks for Alice3 to work independent of haP16V driver */
  162. u32 tmp;
  163. snd_printk(KERN_INFO "Audigy2 value: Special config.\n");
  164. //Setup SRCMulti_I2S SamplingRate
  165. tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0);
  166. tmp &= 0xfffff1ff;
  167. tmp |= (0x2<<9);
  168. snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, 0, tmp);
  169. /* Setup SRCSel (Enable Spdif,I2S SRCMulti) */
  170. outl(0x600000, emu->port + 0x20);
  171. outl(0x14, emu->port + 0x24);
  172. /* Setup SRCMulti Input Audio Enable */
  173. outl(0x7b0000, emu->port + 0x20);
  174. outl(0xFF000000, emu->port + 0x24);
  175. /* Setup SPDIF Out Audio Enable */
  176. /* The Audigy 2 Value has a separate SPDIF out,
  177. * so no need for a mixer switch
  178. */
  179. outl(0x7a0000, emu->port + 0x20);
  180. outl(0xFF000000, emu->port + 0x24);
  181. tmp = inl(emu->port + A_IOCFG) & ~0x8; /* Clear bit 3 */
  182. outl(tmp, emu->port + A_IOCFG);
  183. }
  184. if (emu->card_capabilities->spi_dac) { /* Audigy 2 ZS Notebook with DAC Wolfson WM8768/WM8568 */
  185. int size, n;
  186. size = ARRAY_SIZE(spi_dac_init);
  187. for (n=0; n < size; n++)
  188. snd_emu10k1_spi_write(emu, spi_dac_init[n]);
  189. snd_emu10k1_ptr20_write(emu, 0x60, 0, 0x10);
  190. /* Enable GPIOs
  191. * GPIO0: Unknown
  192. * GPIO1: Speakers-enabled.
  193. * GPIO2: Unknown
  194. * GPIO3: Unknown
  195. * GPIO4: IEC958 Output on.
  196. * GPIO5: Unknown
  197. * GPIO6: Unknown
  198. * GPIO7: Unknown
  199. */
  200. outl(0x76, emu->port + A_IOCFG); /* Windows uses 0x3f76 */
  201. }
  202. snd_emu10k1_ptr_write(emu, PTB, 0, emu->ptb_pages.addr);
  203. snd_emu10k1_ptr_write(emu, TCB, 0, 0); /* taken from original driver */
  204. snd_emu10k1_ptr_write(emu, TCBS, 0, 4); /* taken from original driver */
  205. silent_page = (emu->silent_page.addr << 1) | MAP_PTI_MASK;
  206. for (ch = 0; ch < NUM_G; ch++) {
  207. snd_emu10k1_ptr_write(emu, MAPA, ch, silent_page);
  208. snd_emu10k1_ptr_write(emu, MAPB, ch, silent_page);
  209. }
  210. /*
  211. * Hokay, setup HCFG
  212. * Mute Disable Audio = 0
  213. * Lock Tank Memory = 1
  214. * Lock Sound Memory = 0
  215. * Auto Mute = 1
  216. */
  217. if (emu->audigy) {
  218. if (emu->revision == 4) /* audigy2 */
  219. outl(HCFG_AUDIOENABLE |
  220. HCFG_AC3ENABLE_CDSPDIF |
  221. HCFG_AC3ENABLE_GPSPDIF |
  222. HCFG_AUTOMUTE | HCFG_JOYENABLE, emu->port + HCFG);
  223. else
  224. outl(HCFG_AUTOMUTE | HCFG_JOYENABLE, emu->port + HCFG);
  225. /* FIXME: Remove all these emu->model and replace it with a card recognition parameter,
  226. * e.g. card_capabilities->joystick */
  227. } else if (emu->model == 0x20 ||
  228. emu->model == 0xc400 ||
  229. (emu->model == 0x21 && emu->revision < 6))
  230. outl(HCFG_LOCKTANKCACHE_MASK | HCFG_AUTOMUTE, emu->port + HCFG);
  231. else
  232. // With on-chip joystick
  233. outl(HCFG_LOCKTANKCACHE_MASK | HCFG_AUTOMUTE | HCFG_JOYENABLE, emu->port + HCFG);
  234. if (enable_ir) { /* enable IR for SB Live */
  235. if ( emu->card_capabilities->emu1212m) {
  236. ; /* Disable all access to A_IOCFG for the emu1212m */
  237. } else if (emu->audigy) {
  238. unsigned int reg = inl(emu->port + A_IOCFG);
  239. outl(reg | A_IOCFG_GPOUT2, emu->port + A_IOCFG);
  240. udelay(500);
  241. outl(reg | A_IOCFG_GPOUT1 | A_IOCFG_GPOUT2, emu->port + A_IOCFG);
  242. udelay(100);
  243. outl(reg, emu->port + A_IOCFG);
  244. } else {
  245. unsigned int reg = inl(emu->port + HCFG);
  246. outl(reg | HCFG_GPOUT2, emu->port + HCFG);
  247. udelay(500);
  248. outl(reg | HCFG_GPOUT1 | HCFG_GPOUT2, emu->port + HCFG);
  249. udelay(100);
  250. outl(reg, emu->port + HCFG);
  251. }
  252. }
  253. if ( emu->card_capabilities->emu1212m) {
  254. ; /* Disable all access to A_IOCFG for the emu1212m */
  255. } else if (emu->audigy) { /* enable analog output */
  256. unsigned int reg = inl(emu->port + A_IOCFG);
  257. outl(reg | A_IOCFG_GPOUT0, emu->port + A_IOCFG);
  258. }
  259. return 0;
  260. }
  261. static void snd_emu10k1_audio_enable(struct snd_emu10k1 *emu)
  262. {
  263. /*
  264. * Enable the audio bit
  265. */
  266. outl(inl(emu->port + HCFG) | HCFG_AUDIOENABLE, emu->port + HCFG);
  267. /* Enable analog/digital outs on audigy */
  268. if ( emu->card_capabilities->emu1212m) {
  269. ; /* Disable all access to A_IOCFG for the emu1212m */
  270. } else if (emu->audigy) {
  271. outl(inl(emu->port + A_IOCFG) & ~0x44, emu->port + A_IOCFG);
  272. if (emu->card_capabilities->ca0151_chip) { /* audigy2 */
  273. /* Unmute Analog now. Set GPO6 to 1 for Apollo.
  274. * This has to be done after init ALice3 I2SOut beyond 48KHz.
  275. * So, sequence is important. */
  276. outl(inl(emu->port + A_IOCFG) | 0x0040, emu->port + A_IOCFG);
  277. } else if (emu->card_capabilities->ca0108_chip) { /* audigy2 value */
  278. /* Unmute Analog now. */
  279. outl(inl(emu->port + A_IOCFG) | 0x0060, emu->port + A_IOCFG);
  280. } else {
  281. /* Disable routing from AC97 line out to Front speakers */
  282. outl(inl(emu->port + A_IOCFG) | 0x0080, emu->port + A_IOCFG);
  283. }
  284. }
  285. #if 0
  286. {
  287. unsigned int tmp;
  288. /* FIXME: the following routine disables LiveDrive-II !! */
  289. // TOSLink detection
  290. emu->tos_link = 0;
  291. tmp = inl(emu->port + HCFG);
  292. if (tmp & (HCFG_GPINPUT0 | HCFG_GPINPUT1)) {
  293. outl(tmp|0x800, emu->port + HCFG);
  294. udelay(50);
  295. if (tmp != (inl(emu->port + HCFG) & ~0x800)) {
  296. emu->tos_link = 1;
  297. outl(tmp, emu->port + HCFG);
  298. }
  299. }
  300. }
  301. #endif
  302. snd_emu10k1_intr_enable(emu, INTE_PCIERRORENABLE);
  303. }
  304. int snd_emu10k1_done(struct snd_emu10k1 * emu)
  305. {
  306. int ch;
  307. outl(0, emu->port + INTE);
  308. /*
  309. * Shutdown the chip
  310. */
  311. for (ch = 0; ch < NUM_G; ch++)
  312. snd_emu10k1_ptr_write(emu, DCYSUSV, ch, 0);
  313. for (ch = 0; ch < NUM_G; ch++) {
  314. snd_emu10k1_ptr_write(emu, VTFT, ch, 0);
  315. snd_emu10k1_ptr_write(emu, CVCF, ch, 0);
  316. snd_emu10k1_ptr_write(emu, PTRX, ch, 0);
  317. snd_emu10k1_ptr_write(emu, CPF, ch, 0);
  318. }
  319. /* reset recording buffers */
  320. snd_emu10k1_ptr_write(emu, MICBS, 0, 0);
  321. snd_emu10k1_ptr_write(emu, MICBA, 0, 0);
  322. snd_emu10k1_ptr_write(emu, FXBS, 0, 0);
  323. snd_emu10k1_ptr_write(emu, FXBA, 0, 0);
  324. snd_emu10k1_ptr_write(emu, FXWC, 0, 0);
  325. snd_emu10k1_ptr_write(emu, ADCBS, 0, ADCBS_BUFSIZE_NONE);
  326. snd_emu10k1_ptr_write(emu, ADCBA, 0, 0);
  327. snd_emu10k1_ptr_write(emu, TCBS, 0, TCBS_BUFFSIZE_16K);
  328. snd_emu10k1_ptr_write(emu, TCB, 0, 0);
  329. if (emu->audigy)
  330. snd_emu10k1_ptr_write(emu, A_DBG, 0, A_DBG_SINGLE_STEP);
  331. else
  332. snd_emu10k1_ptr_write(emu, DBG, 0, EMU10K1_DBG_SINGLE_STEP);
  333. /* disable channel interrupt */
  334. snd_emu10k1_ptr_write(emu, CLIEL, 0, 0);
  335. snd_emu10k1_ptr_write(emu, CLIEH, 0, 0);
  336. snd_emu10k1_ptr_write(emu, SOLEL, 0, 0);
  337. snd_emu10k1_ptr_write(emu, SOLEH, 0, 0);
  338. /* disable audio and lock cache */
  339. outl(HCFG_LOCKSOUNDCACHE | HCFG_LOCKTANKCACHE_MASK | HCFG_MUTEBUTTONENABLE, emu->port + HCFG);
  340. snd_emu10k1_ptr_write(emu, PTB, 0, 0);
  341. return 0;
  342. }
  343. /*************************************************************************
  344. * ECARD functional implementation
  345. *************************************************************************/
  346. /* In A1 Silicon, these bits are in the HC register */
  347. #define HOOKN_BIT (1L << 12)
  348. #define HANDN_BIT (1L << 11)
  349. #define PULSEN_BIT (1L << 10)
  350. #define EC_GDI1 (1 << 13)
  351. #define EC_GDI0 (1 << 14)
  352. #define EC_NUM_CONTROL_BITS 20
  353. #define EC_AC3_DATA_SELN 0x0001L
  354. #define EC_EE_DATA_SEL 0x0002L
  355. #define EC_EE_CNTRL_SELN 0x0004L
  356. #define EC_EECLK 0x0008L
  357. #define EC_EECS 0x0010L
  358. #define EC_EESDO 0x0020L
  359. #define EC_TRIM_CSN 0x0040L
  360. #define EC_TRIM_SCLK 0x0080L
  361. #define EC_TRIM_SDATA 0x0100L
  362. #define EC_TRIM_MUTEN 0x0200L
  363. #define EC_ADCCAL 0x0400L
  364. #define EC_ADCRSTN 0x0800L
  365. #define EC_DACCAL 0x1000L
  366. #define EC_DACMUTEN 0x2000L
  367. #define EC_LEDN 0x4000L
  368. #define EC_SPDIF0_SEL_SHIFT 15
  369. #define EC_SPDIF1_SEL_SHIFT 17
  370. #define EC_SPDIF0_SEL_MASK (0x3L << EC_SPDIF0_SEL_SHIFT)
  371. #define EC_SPDIF1_SEL_MASK (0x7L << EC_SPDIF1_SEL_SHIFT)
  372. #define EC_SPDIF0_SELECT(_x) (((_x) << EC_SPDIF0_SEL_SHIFT) & EC_SPDIF0_SEL_MASK)
  373. #define EC_SPDIF1_SELECT(_x) (((_x) << EC_SPDIF1_SEL_SHIFT) & EC_SPDIF1_SEL_MASK)
  374. #define EC_CURRENT_PROM_VERSION 0x01 /* Self-explanatory. This should
  375. * be incremented any time the EEPROM's
  376. * format is changed. */
  377. #define EC_EEPROM_SIZE 0x40 /* ECARD EEPROM has 64 16-bit words */
  378. /* Addresses for special values stored in to EEPROM */
  379. #define EC_PROM_VERSION_ADDR 0x20 /* Address of the current prom version */
  380. #define EC_BOARDREV0_ADDR 0x21 /* LSW of board rev */
  381. #define EC_BOARDREV1_ADDR 0x22 /* MSW of board rev */
  382. #define EC_LAST_PROMFILE_ADDR 0x2f
  383. #define EC_SERIALNUM_ADDR 0x30 /* First word of serial number. The
  384. * can be up to 30 characters in length
  385. * and is stored as a NULL-terminated
  386. * ASCII string. Any unused bytes must be
  387. * filled with zeros */
  388. #define EC_CHECKSUM_ADDR 0x3f /* Location at which checksum is stored */
  389. /* Most of this stuff is pretty self-evident. According to the hardware
  390. * dudes, we need to leave the ADCCAL bit low in order to avoid a DC
  391. * offset problem. Weird.
  392. */
  393. #define EC_RAW_RUN_MODE (EC_DACMUTEN | EC_ADCRSTN | EC_TRIM_MUTEN | \
  394. EC_TRIM_CSN)
  395. #define EC_DEFAULT_ADC_GAIN 0xC4C4
  396. #define EC_DEFAULT_SPDIF0_SEL 0x0
  397. #define EC_DEFAULT_SPDIF1_SEL 0x4
  398. /**************************************************************************
  399. * @func Clock bits into the Ecard's control latch. The Ecard uses a
  400. * control latch will is loaded bit-serially by toggling the Modem control
  401. * lines from function 2 on the E8010. This function hides these details
  402. * and presents the illusion that we are actually writing to a distinct
  403. * register.
  404. */
  405. static void snd_emu10k1_ecard_write(struct snd_emu10k1 * emu, unsigned int value)
  406. {
  407. unsigned short count;
  408. unsigned int data;
  409. unsigned long hc_port;
  410. unsigned int hc_value;
  411. hc_port = emu->port + HCFG;
  412. hc_value = inl(hc_port) & ~(HOOKN_BIT | HANDN_BIT | PULSEN_BIT);
  413. outl(hc_value, hc_port);
  414. for (count = 0; count < EC_NUM_CONTROL_BITS; count++) {
  415. /* Set up the value */
  416. data = ((value & 0x1) ? PULSEN_BIT : 0);
  417. value >>= 1;
  418. outl(hc_value | data, hc_port);
  419. /* Clock the shift register */
  420. outl(hc_value | data | HANDN_BIT, hc_port);
  421. outl(hc_value | data, hc_port);
  422. }
  423. /* Latch the bits */
  424. outl(hc_value | HOOKN_BIT, hc_port);
  425. outl(hc_value, hc_port);
  426. }
  427. /**************************************************************************
  428. * @func Set the gain of the ECARD's CS3310 Trim/gain controller. The
  429. * trim value consists of a 16bit value which is composed of two
  430. * 8 bit gain/trim values, one for the left channel and one for the
  431. * right channel. The following table maps from the Gain/Attenuation
  432. * value in decibels into the corresponding bit pattern for a single
  433. * channel.
  434. */
  435. static void snd_emu10k1_ecard_setadcgain(struct snd_emu10k1 * emu,
  436. unsigned short gain)
  437. {
  438. unsigned int bit;
  439. /* Enable writing to the TRIM registers */
  440. snd_emu10k1_ecard_write(emu, emu->ecard_ctrl & ~EC_TRIM_CSN);
  441. /* Do it again to insure that we meet hold time requirements */
  442. snd_emu10k1_ecard_write(emu, emu->ecard_ctrl & ~EC_TRIM_CSN);
  443. for (bit = (1 << 15); bit; bit >>= 1) {
  444. unsigned int value;
  445. value = emu->ecard_ctrl & ~(EC_TRIM_CSN | EC_TRIM_SDATA);
  446. if (gain & bit)
  447. value |= EC_TRIM_SDATA;
  448. /* Clock the bit */
  449. snd_emu10k1_ecard_write(emu, value);
  450. snd_emu10k1_ecard_write(emu, value | EC_TRIM_SCLK);
  451. snd_emu10k1_ecard_write(emu, value);
  452. }
  453. snd_emu10k1_ecard_write(emu, emu->ecard_ctrl);
  454. }
  455. static int __devinit snd_emu10k1_ecard_init(struct snd_emu10k1 * emu)
  456. {
  457. unsigned int hc_value;
  458. /* Set up the initial settings */
  459. emu->ecard_ctrl = EC_RAW_RUN_MODE |
  460. EC_SPDIF0_SELECT(EC_DEFAULT_SPDIF0_SEL) |
  461. EC_SPDIF1_SELECT(EC_DEFAULT_SPDIF1_SEL);
  462. /* Step 0: Set the codec type in the hardware control register
  463. * and enable audio output */
  464. hc_value = inl(emu->port + HCFG);
  465. outl(hc_value | HCFG_AUDIOENABLE | HCFG_CODECFORMAT_I2S, emu->port + HCFG);
  466. inl(emu->port + HCFG);
  467. /* Step 1: Turn off the led and deassert TRIM_CS */
  468. snd_emu10k1_ecard_write(emu, EC_ADCCAL | EC_LEDN | EC_TRIM_CSN);
  469. /* Step 2: Calibrate the ADC and DAC */
  470. snd_emu10k1_ecard_write(emu, EC_DACCAL | EC_LEDN | EC_TRIM_CSN);
  471. /* Step 3: Wait for awhile; XXX We can't get away with this
  472. * under a real operating system; we'll need to block and wait that
  473. * way. */
  474. snd_emu10k1_wait(emu, 48000);
  475. /* Step 4: Switch off the DAC and ADC calibration. Note
  476. * That ADC_CAL is actually an inverted signal, so we assert
  477. * it here to stop calibration. */
  478. snd_emu10k1_ecard_write(emu, EC_ADCCAL | EC_LEDN | EC_TRIM_CSN);
  479. /* Step 4: Switch into run mode */
  480. snd_emu10k1_ecard_write(emu, emu->ecard_ctrl);
  481. /* Step 5: Set the analog input gain */
  482. snd_emu10k1_ecard_setadcgain(emu, EC_DEFAULT_ADC_GAIN);
  483. return 0;
  484. }
  485. static int __devinit snd_emu10k1_cardbus_init(struct snd_emu10k1 * emu)
  486. {
  487. unsigned long special_port;
  488. unsigned int value;
  489. /* Special initialisation routine
  490. * before the rest of the IO-Ports become active.
  491. */
  492. special_port = emu->port + 0x38;
  493. value = inl(special_port);
  494. outl(0x00d00000, special_port);
  495. value = inl(special_port);
  496. outl(0x00d00001, special_port);
  497. value = inl(special_port);
  498. outl(0x00d0005f, special_port);
  499. value = inl(special_port);
  500. outl(0x00d0007f, special_port);
  501. value = inl(special_port);
  502. outl(0x0090007f, special_port);
  503. value = inl(special_port);
  504. snd_emu10k1_ptr20_write(emu, TINA2_VOLUME, 0, 0xfefefefe); /* Defaults to 0x30303030 */
  505. return 0;
  506. }
  507. static int snd_emu1212m_fpga_write(struct snd_emu10k1 * emu, int reg, int value)
  508. {
  509. if (reg<0 || reg>0x3f)
  510. return 1;
  511. reg+=0x40; /* 0x40 upwards are registers. */
  512. if (value<0 || value>0x3f) /* 0 to 0x3f are values */
  513. return 1;
  514. outl(reg, emu->port + A_IOCFG);
  515. outl(reg | 0x80, emu->port + A_IOCFG); /* High bit clocks the value into the fpga. */
  516. outl(value, emu->port + A_IOCFG);
  517. outl(value | 0x80 , emu->port + A_IOCFG); /* High bit clocks the value into the fpga. */
  518. return 0;
  519. }
  520. static int snd_emu1212m_fpga_read(struct snd_emu10k1 * emu, int reg, int *value)
  521. {
  522. if (reg<0 || reg>0x3f)
  523. return 1;
  524. reg+=0x40; /* 0x40 upwards are registers. */
  525. outl(reg, emu->port + A_IOCFG);
  526. outl(reg | 0x80, emu->port + A_IOCFG); /* High bit clocks the value into the fpga. */
  527. *value = inl(emu->port + A_IOCFG);
  528. return 0;
  529. }
  530. static int snd_emu1212m_fpga_netlist_write(struct snd_emu10k1 * emu, int reg, int value)
  531. {
  532. snd_emu1212m_fpga_write(emu, 0x00, ((reg >> 8) & 0x3f) );
  533. snd_emu1212m_fpga_write(emu, 0x01, (reg & 0x3f) );
  534. snd_emu1212m_fpga_write(emu, 0x02, ((value >> 8) & 0x3f) );
  535. snd_emu1212m_fpga_write(emu, 0x03, (value & 0x3f) );
  536. return 0;
  537. }
  538. static int __devinit snd_emu10k1_emu1212m_init(struct snd_emu10k1 * emu)
  539. {
  540. unsigned int i;
  541. int tmp;
  542. snd_printk(KERN_ERR "emu1212m: Special config.\n");
  543. outl(0x0005a00c, emu->port + HCFG);
  544. outl(0x0005a004, emu->port + HCFG);
  545. outl(0x0005a000, emu->port + HCFG);
  546. outl(0x0005a000, emu->port + HCFG);
  547. snd_emu1212m_fpga_read(emu, 0x22, &tmp );
  548. snd_emu1212m_fpga_read(emu, 0x23, &tmp );
  549. snd_emu1212m_fpga_read(emu, 0x24, &tmp );
  550. snd_emu1212m_fpga_write(emu, 0x04, 0x01 );
  551. snd_emu1212m_fpga_read(emu, 0x0b, &tmp );
  552. snd_emu1212m_fpga_write(emu, 0x0b, 0x01 );
  553. snd_emu1212m_fpga_read(emu, 0x10, &tmp );
  554. snd_emu1212m_fpga_write(emu, 0x10, 0x00 );
  555. snd_emu1212m_fpga_read(emu, 0x11, &tmp );
  556. snd_emu1212m_fpga_write(emu, 0x11, 0x30 );
  557. snd_emu1212m_fpga_read(emu, 0x13, &tmp );
  558. snd_emu1212m_fpga_write(emu, 0x13, 0x0f );
  559. snd_emu1212m_fpga_read(emu, 0x11, &tmp );
  560. snd_emu1212m_fpga_write(emu, 0x11, 0x30 );
  561. snd_emu1212m_fpga_read(emu, 0x0a, &tmp );
  562. snd_emu1212m_fpga_write(emu, 0x0a, 0x10 );
  563. snd_emu1212m_fpga_write(emu, 0x0c, 0x19 );
  564. snd_emu1212m_fpga_write(emu, 0x12, 0x0c );
  565. snd_emu1212m_fpga_write(emu, 0x09, 0x0f );
  566. snd_emu1212m_fpga_write(emu, 0x06, 0x00 );
  567. snd_emu1212m_fpga_write(emu, 0x05, 0x00 );
  568. snd_emu1212m_fpga_write(emu, 0x0e, 0x12 );
  569. snd_emu1212m_fpga_netlist_write(emu, 0x0000, 0x0200);
  570. snd_emu1212m_fpga_netlist_write(emu, 0x0001, 0x0201);
  571. snd_emu1212m_fpga_netlist_write(emu, 0x0002, 0x0500);
  572. snd_emu1212m_fpga_netlist_write(emu, 0x0003, 0x0501);
  573. snd_emu1212m_fpga_netlist_write(emu, 0x0004, 0x0400);
  574. snd_emu1212m_fpga_netlist_write(emu, 0x0005, 0x0401);
  575. snd_emu1212m_fpga_netlist_write(emu, 0x0006, 0x0402);
  576. snd_emu1212m_fpga_netlist_write(emu, 0x0007, 0x0403);
  577. snd_emu1212m_fpga_netlist_write(emu, 0x0008, 0x0404);
  578. snd_emu1212m_fpga_netlist_write(emu, 0x0009, 0x0405);
  579. snd_emu1212m_fpga_netlist_write(emu, 0x000a, 0x0406);
  580. snd_emu1212m_fpga_netlist_write(emu, 0x000b, 0x0407);
  581. snd_emu1212m_fpga_netlist_write(emu, 0x000c, 0x0100);
  582. snd_emu1212m_fpga_netlist_write(emu, 0x000d, 0x0104);
  583. snd_emu1212m_fpga_netlist_write(emu, 0x000e, 0x0200);
  584. snd_emu1212m_fpga_netlist_write(emu, 0x000f, 0x0201);
  585. for (i=0;i < 0x20;i++) {
  586. snd_emu1212m_fpga_netlist_write(emu, 0x0100+i, 0x0000);
  587. }
  588. for (i=0;i < 4;i++) {
  589. snd_emu1212m_fpga_netlist_write(emu, 0x0200+i, 0x0000);
  590. }
  591. for (i=0;i < 7;i++) {
  592. snd_emu1212m_fpga_netlist_write(emu, 0x0300+i, 0x0000);
  593. }
  594. for (i=0;i < 7;i++) {
  595. snd_emu1212m_fpga_netlist_write(emu, 0x0400+i, 0x0000);
  596. }
  597. snd_emu1212m_fpga_netlist_write(emu, 0x0500, 0x0108);
  598. snd_emu1212m_fpga_netlist_write(emu, 0x0501, 0x010c);
  599. snd_emu1212m_fpga_netlist_write(emu, 0x0600, 0x0110);
  600. snd_emu1212m_fpga_netlist_write(emu, 0x0601, 0x0114);
  601. snd_emu1212m_fpga_netlist_write(emu, 0x0700, 0x0118);
  602. snd_emu1212m_fpga_netlist_write(emu, 0x0701, 0x011c);
  603. snd_emu1212m_fpga_write(emu, 0x07, 0x01 );
  604. snd_emu1212m_fpga_read(emu, 0x21, &tmp );
  605. outl(0x0000a000, emu->port + HCFG);
  606. outl(0x0000a001, emu->port + HCFG);
  607. /* Initial boot complete. Now patches */
  608. snd_emu1212m_fpga_read(emu, 0x21, &tmp );
  609. snd_emu1212m_fpga_write(emu, 0x0c, 0x19 );
  610. snd_emu1212m_fpga_write(emu, 0x12, 0x0c );
  611. snd_emu1212m_fpga_write(emu, 0x0c, 0x19 );
  612. snd_emu1212m_fpga_write(emu, 0x12, 0x0c );
  613. snd_emu1212m_fpga_read(emu, 0x0a, &tmp );
  614. snd_emu1212m_fpga_write(emu, 0x0a, 0x10 );
  615. snd_emu1212m_fpga_read(emu, 0x20, &tmp );
  616. snd_emu1212m_fpga_read(emu, 0x21, &tmp );
  617. snd_emu1212m_fpga_netlist_write(emu, 0x0300, 0x0312);
  618. snd_emu1212m_fpga_netlist_write(emu, 0x0301, 0x0313);
  619. snd_emu1212m_fpga_netlist_write(emu, 0x0200, 0x0302);
  620. snd_emu1212m_fpga_netlist_write(emu, 0x0201, 0x0303);
  621. return 0;
  622. }
  623. /*
  624. * Create the EMU10K1 instance
  625. */
  626. #ifdef CONFIG_PM
  627. static int alloc_pm_buffer(struct snd_emu10k1 *emu);
  628. static void free_pm_buffer(struct snd_emu10k1 *emu);
  629. #endif
  630. static int snd_emu10k1_free(struct snd_emu10k1 *emu)
  631. {
  632. if (emu->port) { /* avoid access to already used hardware */
  633. snd_emu10k1_fx8010_tram_setup(emu, 0);
  634. snd_emu10k1_done(emu);
  635. /* remove reserved page */
  636. if (emu->reserved_page) {
  637. snd_emu10k1_synth_free(emu, (struct snd_util_memblk *)emu->reserved_page);
  638. emu->reserved_page = NULL;
  639. }
  640. snd_emu10k1_free_efx(emu);
  641. }
  642. if (emu->memhdr)
  643. snd_util_memhdr_free(emu->memhdr);
  644. if (emu->silent_page.area)
  645. snd_dma_free_pages(&emu->silent_page);
  646. if (emu->ptb_pages.area)
  647. snd_dma_free_pages(&emu->ptb_pages);
  648. vfree(emu->page_ptr_table);
  649. vfree(emu->page_addr_table);
  650. #ifdef CONFIG_PM
  651. free_pm_buffer(emu);
  652. #endif
  653. if (emu->irq >= 0)
  654. free_irq(emu->irq, (void *)emu);
  655. if (emu->port)
  656. pci_release_regions(emu->pci);
  657. if (emu->card_capabilities->ca0151_chip) /* P16V */
  658. snd_p16v_free(emu);
  659. pci_disable_device(emu->pci);
  660. kfree(emu);
  661. return 0;
  662. }
  663. static int snd_emu10k1_dev_free(struct snd_device *device)
  664. {
  665. struct snd_emu10k1 *emu = device->device_data;
  666. return snd_emu10k1_free(emu);
  667. }
  668. static struct snd_emu_chip_details emu_chip_details[] = {
  669. /* Audigy 2 Value AC3 out does not work yet. Need to find out how to turn off interpolators.*/
  670. /* Audigy4 SB0400 */
  671. {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x10211102,
  672. .driver = "Audigy2", .name = "Audigy 4 [SB0400]",
  673. .id = "Audigy2",
  674. .emu10k2_chip = 1,
  675. .ca0108_chip = 1,
  676. .spk71 = 1,
  677. .ac97_chip = 1} ,
  678. /* Tested by James@superbug.co.uk 3rd July 2005 */
  679. /* DSP: CA0108-IAT
  680. * DAC: CS4382-KQ
  681. * ADC: Philips 1361T
  682. * AC97: STAC9750
  683. * CA0151: None
  684. */
  685. {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x10011102,
  686. .driver = "Audigy2", .name = "Audigy 2 Value [SB0400]",
  687. .id = "Audigy2",
  688. .emu10k2_chip = 1,
  689. .ca0108_chip = 1,
  690. .spk71 = 1,
  691. .ac97_chip = 1} ,
  692. /* Audigy 2 ZS Notebook Cardbus card.*/
  693. /* Tested by James@superbug.co.uk 22th December 2005 */
  694. /* Audio output 7.1/Headphones working.
  695. * Digital output working. (AC3 not checked, only PCM)
  696. * Audio inputs not tested.
  697. */
  698. /* DSP: Tiny2
  699. * DAC: Wolfson WM8768/WM8568
  700. * ADC: Wolfson WM8775
  701. * AC97: None
  702. * CA0151: None
  703. */
  704. {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x20011102,
  705. .driver = "Audigy2", .name = "Audigy 2 ZS Notebook [SB0530]",
  706. .id = "Audigy2",
  707. .emu10k2_chip = 1,
  708. .ca0108_chip = 1,
  709. .ca_cardbus_chip = 1,
  710. .spi_dac = 1,
  711. .spk71 = 1} ,
  712. {.vendor = 0x1102, .device = 0x0008,
  713. .driver = "Audigy2", .name = "Audigy 2 Value [Unknown]",
  714. .id = "Audigy2",
  715. .emu10k2_chip = 1,
  716. .ca0108_chip = 1,
  717. .ac97_chip = 1} ,
  718. /* Tested by James@superbug.co.uk 8th July 2005. No sound available yet. */
  719. {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x40011102,
  720. .driver = "Audigy2", .name = "E-mu 1212m [4001]",
  721. .id = "EMU1212m",
  722. .emu10k2_chip = 1,
  723. .ca0102_chip = 1,
  724. .emu1212m = 1} ,
  725. /* Tested by James@superbug.co.uk 3rd July 2005 */
  726. {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20071102,
  727. .driver = "Audigy2", .name = "Audigy 4 PRO [SB0380]",
  728. .id = "Audigy2",
  729. .emu10k2_chip = 1,
  730. .ca0102_chip = 1,
  731. .ca0151_chip = 1,
  732. .spk71 = 1,
  733. .spdif_bug = 1,
  734. .ac97_chip = 1} ,
  735. /* Tested by shane-alsa@cm.nu 5th Nov 2005 */
  736. /* The 0x20061102 does have SB0350 written on it
  737. * Just like 0x20021102
  738. */
  739. {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20061102,
  740. .driver = "Audigy2", .name = "Audigy 2 [SB0350b]",
  741. .id = "Audigy2",
  742. .emu10k2_chip = 1,
  743. .ca0102_chip = 1,
  744. .ca0151_chip = 1,
  745. .spk71 = 1,
  746. .spdif_bug = 1,
  747. .ac97_chip = 1} ,
  748. {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20021102,
  749. .driver = "Audigy2", .name = "Audigy 2 ZS [SB0350]",
  750. .id = "Audigy2",
  751. .emu10k2_chip = 1,
  752. .ca0102_chip = 1,
  753. .ca0151_chip = 1,
  754. .spk71 = 1,
  755. .spdif_bug = 1,
  756. .ac97_chip = 1} ,
  757. {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20011102,
  758. .driver = "Audigy2", .name = "Audigy 2 ZS [2001]",
  759. .id = "Audigy2",
  760. .emu10k2_chip = 1,
  761. .ca0102_chip = 1,
  762. .ca0151_chip = 1,
  763. .spk71 = 1,
  764. .spdif_bug = 1,
  765. .ac97_chip = 1} ,
  766. /* Audigy 2 */
  767. /* Tested by James@superbug.co.uk 3rd July 2005 */
  768. /* DSP: CA0102-IAT
  769. * DAC: CS4382-KQ
  770. * ADC: Philips 1361T
  771. * AC97: STAC9721
  772. * CA0151: Yes
  773. */
  774. {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10071102,
  775. .driver = "Audigy2", .name = "Audigy 2 [SB0240]",
  776. .id = "Audigy2",
  777. .emu10k2_chip = 1,
  778. .ca0102_chip = 1,
  779. .ca0151_chip = 1,
  780. .spk71 = 1,
  781. .spdif_bug = 1,
  782. .ac97_chip = 1} ,
  783. {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10051102,
  784. .driver = "Audigy2", .name = "Audigy 2 EX [1005]",
  785. .id = "Audigy2",
  786. .emu10k2_chip = 1,
  787. .ca0102_chip = 1,
  788. .ca0151_chip = 1,
  789. .spk71 = 1,
  790. .spdif_bug = 1} ,
  791. {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10021102,
  792. .driver = "Audigy2", .name = "Audigy 2 Platinum [SB0240P]",
  793. .id = "Audigy2",
  794. .emu10k2_chip = 1,
  795. .ca0102_chip = 1,
  796. .ca0151_chip = 1,
  797. .spk71 = 1,
  798. .spdif_bug = 1,
  799. .ac97_chip = 1} ,
  800. {.vendor = 0x1102, .device = 0x0004, .revision = 0x04,
  801. .driver = "Audigy2", .name = "Audigy 2 [Unknown]",
  802. .id = "Audigy2",
  803. .emu10k2_chip = 1,
  804. .ca0102_chip = 1,
  805. .ca0151_chip = 1,
  806. .spdif_bug = 1,
  807. .ac97_chip = 1} ,
  808. {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x00531102,
  809. .driver = "Audigy", .name = "Audigy 1 [SB0090]",
  810. .id = "Audigy",
  811. .emu10k2_chip = 1,
  812. .ca0102_chip = 1,
  813. .ac97_chip = 1} ,
  814. {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x00521102,
  815. .driver = "Audigy", .name = "Audigy 1 ES [SB0160]",
  816. .id = "Audigy",
  817. .emu10k2_chip = 1,
  818. .ca0102_chip = 1,
  819. .spdif_bug = 1,
  820. .ac97_chip = 1} ,
  821. {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x00511102,
  822. .driver = "Audigy", .name = "Audigy 1 [SB0090]",
  823. .id = "Audigy",
  824. .emu10k2_chip = 1,
  825. .ca0102_chip = 1,
  826. .ac97_chip = 1} ,
  827. {.vendor = 0x1102, .device = 0x0004,
  828. .driver = "Audigy", .name = "Audigy 1 [Unknown]",
  829. .id = "Audigy",
  830. .emu10k2_chip = 1,
  831. .ca0102_chip = 1,
  832. .ac97_chip = 1} ,
  833. {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x806B1102,
  834. .driver = "EMU10K1", .name = "SBLive! [SB0105]",
  835. .id = "Live",
  836. .emu10k1_chip = 1,
  837. .ac97_chip = 1,
  838. .sblive51 = 1} ,
  839. {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x806A1102,
  840. .driver = "EMU10K1", .name = "SBLive! Value [SB0103]",
  841. .id = "Live",
  842. .emu10k1_chip = 1,
  843. .ac97_chip = 1,
  844. .sblive51 = 1} ,
  845. {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80691102,
  846. .driver = "EMU10K1", .name = "SBLive! Value [SB0101]",
  847. .id = "Live",
  848. .emu10k1_chip = 1,
  849. .ac97_chip = 1,
  850. .sblive51 = 1} ,
  851. /* Tested by ALSA bug#1680 26th December 2005 */
  852. /* note: It really has SB0220 written on the card. */
  853. {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80661102,
  854. .driver = "EMU10K1", .name = "SB Live 5.1 Dell OEM [SB0220]",
  855. .id = "Live",
  856. .emu10k1_chip = 1,
  857. .ac97_chip = 1,
  858. .sblive51 = 1} ,
  859. /* Tested by Thomas Zehetbauer 27th Aug 2005 */
  860. {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80651102,
  861. .driver = "EMU10K1", .name = "SB Live 5.1 [SB0220]",
  862. .id = "Live",
  863. .emu10k1_chip = 1,
  864. .ac97_chip = 1,
  865. .sblive51 = 1} ,
  866. {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x100a1102,
  867. .driver = "EMU10K1", .name = "SB Live 5.1 [SB0220]",
  868. .id = "Live",
  869. .emu10k1_chip = 1,
  870. .ac97_chip = 1,
  871. .sblive51 = 1} ,
  872. {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80641102,
  873. .driver = "EMU10K1", .name = "SB Live 5.1",
  874. .id = "Live",
  875. .emu10k1_chip = 1,
  876. .ac97_chip = 1,
  877. .sblive51 = 1} ,
  878. /* Tested by alsa bugtrack user "hus" bug #1297 12th Aug 2005 */
  879. {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80611102,
  880. .driver = "EMU10K1", .name = "SBLive 5.1 [SB0060]",
  881. .id = "Live",
  882. .emu10k1_chip = 1,
  883. .ac97_chip = 2, /* ac97 is optional; both SBLive 5.1 and platinum
  884. * share the same IDs!
  885. */
  886. .sblive51 = 1} ,
  887. {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80511102,
  888. .driver = "EMU10K1", .name = "SBLive! Value [CT4850]",
  889. .id = "Live",
  890. .emu10k1_chip = 1,
  891. .ac97_chip = 1,
  892. .sblive51 = 1} ,
  893. {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80401102,
  894. .driver = "EMU10K1", .name = "SBLive! Platinum [CT4760P]",
  895. .id = "Live",
  896. .emu10k1_chip = 1,
  897. .ac97_chip = 1} ,
  898. {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80321102,
  899. .driver = "EMU10K1", .name = "SBLive! Value [CT4871]",
  900. .id = "Live",
  901. .emu10k1_chip = 1,
  902. .ac97_chip = 1,
  903. .sblive51 = 1} ,
  904. {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80311102,
  905. .driver = "EMU10K1", .name = "SBLive! Value [CT4831]",
  906. .id = "Live",
  907. .emu10k1_chip = 1,
  908. .ac97_chip = 1,
  909. .sblive51 = 1} ,
  910. {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80281102,
  911. .driver = "EMU10K1", .name = "SBLive! Value [CT4870]",
  912. .id = "Live",
  913. .emu10k1_chip = 1,
  914. .ac97_chip = 1,
  915. .sblive51 = 1} ,
  916. /* Tested by James@superbug.co.uk 3rd July 2005 */
  917. {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80271102,
  918. .driver = "EMU10K1", .name = "SBLive! Value [CT4832]",
  919. .id = "Live",
  920. .emu10k1_chip = 1,
  921. .ac97_chip = 1,
  922. .sblive51 = 1} ,
  923. {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80261102,
  924. .driver = "EMU10K1", .name = "SBLive! Value [CT4830]",
  925. .id = "Live",
  926. .emu10k1_chip = 1,
  927. .ac97_chip = 1,
  928. .sblive51 = 1} ,
  929. {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80231102,
  930. .driver = "EMU10K1", .name = "SB PCI512 [CT4790]",
  931. .id = "Live",
  932. .emu10k1_chip = 1,
  933. .ac97_chip = 1,
  934. .sblive51 = 1} ,
  935. {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80221102,
  936. .driver = "EMU10K1", .name = "SBLive! Value [CT4780]",
  937. .id = "Live",
  938. .emu10k1_chip = 1,
  939. .ac97_chip = 1,
  940. .sblive51 = 1} ,
  941. {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x40011102,
  942. .driver = "EMU10K1", .name = "E-mu APS [4001]",
  943. .id = "APS",
  944. .emu10k1_chip = 1,
  945. .ecard = 1} ,
  946. {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x00211102,
  947. .driver = "EMU10K1", .name = "SBLive! [CT4620]",
  948. .id = "Live",
  949. .emu10k1_chip = 1,
  950. .ac97_chip = 1,
  951. .sblive51 = 1} ,
  952. {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x00201102,
  953. .driver = "EMU10K1", .name = "SBLive! Value [CT4670]",
  954. .id = "Live",
  955. .emu10k1_chip = 1,
  956. .ac97_chip = 1,
  957. .sblive51 = 1} ,
  958. {.vendor = 0x1102, .device = 0x0002,
  959. .driver = "EMU10K1", .name = "SB Live [Unknown]",
  960. .id = "Live",
  961. .emu10k1_chip = 1,
  962. .ac97_chip = 1,
  963. .sblive51 = 1} ,
  964. { } /* terminator */
  965. };
  966. int __devinit snd_emu10k1_create(struct snd_card *card,
  967. struct pci_dev * pci,
  968. unsigned short extin_mask,
  969. unsigned short extout_mask,
  970. long max_cache_bytes,
  971. int enable_ir,
  972. uint subsystem,
  973. struct snd_emu10k1 ** remu)
  974. {
  975. struct snd_emu10k1 *emu;
  976. int idx, err;
  977. int is_audigy;
  978. unsigned char revision;
  979. unsigned int silent_page;
  980. const struct snd_emu_chip_details *c;
  981. static struct snd_device_ops ops = {
  982. .dev_free = snd_emu10k1_dev_free,
  983. };
  984. *remu = NULL;
  985. /* enable PCI device */
  986. if ((err = pci_enable_device(pci)) < 0)
  987. return err;
  988. emu = kzalloc(sizeof(*emu), GFP_KERNEL);
  989. if (emu == NULL) {
  990. pci_disable_device(pci);
  991. return -ENOMEM;
  992. }
  993. emu->card = card;
  994. spin_lock_init(&emu->reg_lock);
  995. spin_lock_init(&emu->emu_lock);
  996. spin_lock_init(&emu->voice_lock);
  997. spin_lock_init(&emu->synth_lock);
  998. spin_lock_init(&emu->memblk_lock);
  999. mutex_init(&emu->fx8010.lock);
  1000. INIT_LIST_HEAD(&emu->mapped_link_head);
  1001. INIT_LIST_HEAD(&emu->mapped_order_link_head);
  1002. emu->pci = pci;
  1003. emu->irq = -1;
  1004. emu->synth = NULL;
  1005. emu->get_synth_voice = NULL;
  1006. /* read revision & serial */
  1007. pci_read_config_byte(pci, PCI_REVISION_ID, &revision);
  1008. emu->revision = revision;
  1009. pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &emu->serial);
  1010. pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &emu->model);
  1011. snd_printdd("vendor=0x%x, device=0x%x, subsystem_vendor_id=0x%x, subsystem_id=0x%x\n",pci->vendor, pci->device, emu->serial, emu->model);
  1012. for (c = emu_chip_details; c->vendor; c++) {
  1013. if (c->vendor == pci->vendor && c->device == pci->device) {
  1014. if (subsystem) {
  1015. if (c->subsystem && (c->subsystem == subsystem) ) {
  1016. break;
  1017. } else continue;
  1018. } else {
  1019. if (c->subsystem && (c->subsystem != emu->serial) )
  1020. continue;
  1021. if (c->revision && c->revision != emu->revision)
  1022. continue;
  1023. }
  1024. break;
  1025. }
  1026. }
  1027. if (c->vendor == 0) {
  1028. snd_printk(KERN_ERR "emu10k1: Card not recognised\n");
  1029. kfree(emu);
  1030. pci_disable_device(pci);
  1031. return -ENOENT;
  1032. }
  1033. emu->card_capabilities = c;
  1034. if (c->subsystem && !subsystem)
  1035. snd_printdd("Sound card name=%s\n", c->name);
  1036. else if (subsystem)
  1037. snd_printdd("Sound card name=%s, vendor=0x%x, device=0x%x, subsystem=0x%x. Forced to subsytem=0x%x\n",
  1038. c->name, pci->vendor, pci->device, emu->serial, c->subsystem);
  1039. else
  1040. snd_printdd("Sound card name=%s, vendor=0x%x, device=0x%x, subsystem=0x%x.\n",
  1041. c->name, pci->vendor, pci->device, emu->serial);
  1042. if (!*card->id && c->id) {
  1043. int i, n = 0;
  1044. strlcpy(card->id, c->id, sizeof(card->id));
  1045. for (;;) {
  1046. for (i = 0; i < snd_ecards_limit; i++) {
  1047. if (snd_cards[i] && !strcmp(snd_cards[i]->id, card->id))
  1048. break;
  1049. }
  1050. if (i >= snd_ecards_limit)
  1051. break;
  1052. n++;
  1053. if (n >= SNDRV_CARDS)
  1054. break;
  1055. snprintf(card->id, sizeof(card->id), "%s_%d", c->id, n);
  1056. }
  1057. }
  1058. is_audigy = emu->audigy = c->emu10k2_chip;
  1059. /* set the DMA transfer mask */
  1060. emu->dma_mask = is_audigy ? AUDIGY_DMA_MASK : EMU10K1_DMA_MASK;
  1061. if (pci_set_dma_mask(pci, emu->dma_mask) < 0 ||
  1062. pci_set_consistent_dma_mask(pci, emu->dma_mask) < 0) {
  1063. snd_printk(KERN_ERR "architecture does not support PCI busmaster DMA with mask 0x%lx\n", emu->dma_mask);
  1064. kfree(emu);
  1065. pci_disable_device(pci);
  1066. return -ENXIO;
  1067. }
  1068. if (is_audigy)
  1069. emu->gpr_base = A_FXGPREGBASE;
  1070. else
  1071. emu->gpr_base = FXGPREGBASE;
  1072. if ((err = pci_request_regions(pci, "EMU10K1")) < 0) {
  1073. kfree(emu);
  1074. pci_disable_device(pci);
  1075. return err;
  1076. }
  1077. emu->port = pci_resource_start(pci, 0);
  1078. if (request_irq(pci->irq, snd_emu10k1_interrupt, SA_INTERRUPT|SA_SHIRQ, "EMU10K1", (void *)emu)) {
  1079. err = -EBUSY;
  1080. goto error;
  1081. }
  1082. emu->irq = pci->irq;
  1083. emu->max_cache_pages = max_cache_bytes >> PAGE_SHIFT;
  1084. if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
  1085. 32 * 1024, &emu->ptb_pages) < 0) {
  1086. err = -ENOMEM;
  1087. goto error;
  1088. }
  1089. emu->page_ptr_table = (void **)vmalloc(emu->max_cache_pages * sizeof(void*));
  1090. emu->page_addr_table = (unsigned long*)vmalloc(emu->max_cache_pages * sizeof(unsigned long));
  1091. if (emu->page_ptr_table == NULL || emu->page_addr_table == NULL) {
  1092. err = -ENOMEM;
  1093. goto error;
  1094. }
  1095. if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
  1096. EMUPAGESIZE, &emu->silent_page) < 0) {
  1097. err = -ENOMEM;
  1098. goto error;
  1099. }
  1100. emu->memhdr = snd_util_memhdr_new(emu->max_cache_pages * PAGE_SIZE);
  1101. if (emu->memhdr == NULL) {
  1102. err = -ENOMEM;
  1103. goto error;
  1104. }
  1105. emu->memhdr->block_extra_size = sizeof(struct snd_emu10k1_memblk) -
  1106. sizeof(struct snd_util_memblk);
  1107. pci_set_master(pci);
  1108. emu->fx8010.fxbus_mask = 0x303f;
  1109. if (extin_mask == 0)
  1110. extin_mask = 0x3fcf;
  1111. if (extout_mask == 0)
  1112. extout_mask = 0x7fff;
  1113. emu->fx8010.extin_mask = extin_mask;
  1114. emu->fx8010.extout_mask = extout_mask;
  1115. emu->enable_ir = enable_ir;
  1116. if (emu->card_capabilities->ecard) {
  1117. if ((err = snd_emu10k1_ecard_init(emu)) < 0)
  1118. goto error;
  1119. } else if (emu->card_capabilities->ca_cardbus_chip) {
  1120. if ((err = snd_emu10k1_cardbus_init(emu)) < 0)
  1121. goto error;
  1122. } else if (emu->card_capabilities->emu1212m) {
  1123. if ((err = snd_emu10k1_emu1212m_init(emu)) < 0) {
  1124. snd_emu10k1_free(emu);
  1125. return err;
  1126. }
  1127. } else {
  1128. /* 5.1: Enable the additional AC97 Slots. If the emu10k1 version
  1129. does not support this, it shouldn't do any harm */
  1130. snd_emu10k1_ptr_write(emu, AC97SLOT, 0, AC97SLOT_CNTR|AC97SLOT_LFE);
  1131. }
  1132. /* initialize TRAM setup */
  1133. emu->fx8010.itram_size = (16 * 1024)/2;
  1134. emu->fx8010.etram_pages.area = NULL;
  1135. emu->fx8010.etram_pages.bytes = 0;
  1136. /*
  1137. * Init to 0x02109204 :
  1138. * Clock accuracy = 0 (1000ppm)
  1139. * Sample Rate = 2 (48kHz)
  1140. * Audio Channel = 1 (Left of 2)
  1141. * Source Number = 0 (Unspecified)
  1142. * Generation Status = 1 (Original for Cat Code 12)
  1143. * Cat Code = 12 (Digital Signal Mixer)
  1144. * Mode = 0 (Mode 0)
  1145. * Emphasis = 0 (None)
  1146. * CP = 1 (Copyright unasserted)
  1147. * AN = 0 (Audio data)
  1148. * P = 0 (Consumer)
  1149. */
  1150. emu->spdif_bits[0] = emu->spdif_bits[1] =
  1151. emu->spdif_bits[2] = SPCS_CLKACCY_1000PPM | SPCS_SAMPLERATE_48 |
  1152. SPCS_CHANNELNUM_LEFT | SPCS_SOURCENUM_UNSPEC |
  1153. SPCS_GENERATIONSTATUS | 0x00001200 |
  1154. 0x00000000 | SPCS_EMPHASIS_NONE | SPCS_COPYRIGHT;
  1155. emu->reserved_page = (struct snd_emu10k1_memblk *)
  1156. snd_emu10k1_synth_alloc(emu, 4096);
  1157. if (emu->reserved_page)
  1158. emu->reserved_page->map_locked = 1;
  1159. /* Clear silent pages and set up pointers */
  1160. memset(emu->silent_page.area, 0, PAGE_SIZE);
  1161. silent_page = emu->silent_page.addr << 1;
  1162. for (idx = 0; idx < MAXPAGES; idx++)
  1163. ((u32 *)emu->ptb_pages.area)[idx] = cpu_to_le32(silent_page | idx);
  1164. /* set up voice indices */
  1165. for (idx = 0; idx < NUM_G; idx++) {
  1166. emu->voices[idx].emu = emu;
  1167. emu->voices[idx].number = idx;
  1168. }
  1169. if ((err = snd_emu10k1_init(emu, enable_ir, 0)) < 0)
  1170. goto error;
  1171. #ifdef CONFIG_PM
  1172. if ((err = alloc_pm_buffer(emu)) < 0)
  1173. goto error;
  1174. #endif
  1175. /* Initialize the effect engine */
  1176. if ((err = snd_emu10k1_init_efx(emu)) < 0)
  1177. goto error;
  1178. snd_emu10k1_audio_enable(emu);
  1179. if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, emu, &ops)) < 0)
  1180. goto error;
  1181. #ifdef CONFIG_PROC_FS
  1182. snd_emu10k1_proc_init(emu);
  1183. #endif
  1184. snd_card_set_dev(card, &pci->dev);
  1185. *remu = emu;
  1186. return 0;
  1187. error:
  1188. snd_emu10k1_free(emu);
  1189. return err;
  1190. }
  1191. #ifdef CONFIG_PM
  1192. static unsigned char saved_regs[] = {
  1193. CPF, PTRX, CVCF, VTFT, Z1, Z2, PSST, DSL, CCCA, CCR, CLP,
  1194. FXRT, MAPA, MAPB, ENVVOL, ATKHLDV, DCYSUSV, LFOVAL1, ENVVAL,
  1195. ATKHLDM, DCYSUSM, LFOVAL2, IP, IFATN, PEFE, FMMOD, TREMFRQ, FM2FRQ2,
  1196. TEMPENV, ADCCR, FXWC, MICBA, ADCBA, FXBA,
  1197. MICBS, ADCBS, FXBS, CDCS, GPSCS, SPCS0, SPCS1, SPCS2,
  1198. SPBYPASS, AC97SLOT, CDSRCS, GPSRCS, ZVSRCS, MICIDX, ADCIDX, FXIDX,
  1199. 0xff /* end */
  1200. };
  1201. static unsigned char saved_regs_audigy[] = {
  1202. A_ADCIDX, A_MICIDX, A_FXWC1, A_FXWC2, A_SAMPLE_RATE,
  1203. A_FXRT2, A_SENDAMOUNTS, A_FXRT1,
  1204. 0xff /* end */
  1205. };
  1206. static int __devinit alloc_pm_buffer(struct snd_emu10k1 *emu)
  1207. {
  1208. int size;
  1209. size = ARRAY_SIZE(saved_regs);
  1210. if (emu->audigy)
  1211. size += ARRAY_SIZE(saved_regs_audigy);
  1212. emu->saved_ptr = vmalloc(4 * NUM_G * size);
  1213. if (! emu->saved_ptr)
  1214. return -ENOMEM;
  1215. if (snd_emu10k1_efx_alloc_pm_buffer(emu) < 0)
  1216. return -ENOMEM;
  1217. if (emu->card_capabilities->ca0151_chip &&
  1218. snd_p16v_alloc_pm_buffer(emu) < 0)
  1219. return -ENOMEM;
  1220. return 0;
  1221. }
  1222. static void free_pm_buffer(struct snd_emu10k1 *emu)
  1223. {
  1224. vfree(emu->saved_ptr);
  1225. snd_emu10k1_efx_free_pm_buffer(emu);
  1226. if (emu->card_capabilities->ca0151_chip)
  1227. snd_p16v_free_pm_buffer(emu);
  1228. }
  1229. void snd_emu10k1_suspend_regs(struct snd_emu10k1 *emu)
  1230. {
  1231. int i;
  1232. unsigned char *reg;
  1233. unsigned int *val;
  1234. val = emu->saved_ptr;
  1235. for (reg = saved_regs; *reg != 0xff; reg++)
  1236. for (i = 0; i < NUM_G; i++, val++)
  1237. *val = snd_emu10k1_ptr_read(emu, *reg, i);
  1238. if (emu->audigy) {
  1239. for (reg = saved_regs_audigy; *reg != 0xff; reg++)
  1240. for (i = 0; i < NUM_G; i++, val++)
  1241. *val = snd_emu10k1_ptr_read(emu, *reg, i);
  1242. }
  1243. if (emu->audigy)
  1244. emu->saved_a_iocfg = inl(emu->port + A_IOCFG);
  1245. emu->saved_hcfg = inl(emu->port + HCFG);
  1246. }
  1247. void snd_emu10k1_resume_init(struct snd_emu10k1 *emu)
  1248. {
  1249. if (emu->card_capabilities->ecard)
  1250. snd_emu10k1_ecard_init(emu);
  1251. else
  1252. snd_emu10k1_ptr_write(emu, AC97SLOT, 0, AC97SLOT_CNTR|AC97SLOT_LFE);
  1253. snd_emu10k1_init(emu, emu->enable_ir, 1);
  1254. }
  1255. void snd_emu10k1_resume_regs(struct snd_emu10k1 *emu)
  1256. {
  1257. int i;
  1258. unsigned char *reg;
  1259. unsigned int *val;
  1260. snd_emu10k1_audio_enable(emu);
  1261. /* resore for spdif */
  1262. if (emu->audigy)
  1263. outl(emu->port + A_IOCFG, emu->saved_a_iocfg);
  1264. outl(emu->port + HCFG, emu->saved_hcfg);
  1265. val = emu->saved_ptr;
  1266. for (reg = saved_regs; *reg != 0xff; reg++)
  1267. for (i = 0; i < NUM_G; i++, val++)
  1268. snd_emu10k1_ptr_write(emu, *reg, i, *val);
  1269. if (emu->audigy) {
  1270. for (reg = saved_regs_audigy; *reg != 0xff; reg++)
  1271. for (i = 0; i < NUM_G; i++, val++)
  1272. snd_emu10k1_ptr_write(emu, *reg, i, *val);
  1273. }
  1274. }
  1275. #endif
  1276. /* memory.c */
  1277. EXPORT_SYMBOL(snd_emu10k1_synth_alloc);
  1278. EXPORT_SYMBOL(snd_emu10k1_synth_free);
  1279. EXPORT_SYMBOL(snd_emu10k1_synth_bzero);
  1280. EXPORT_SYMBOL(snd_emu10k1_synth_copy_from_user);
  1281. EXPORT_SYMBOL(snd_emu10k1_memblk_map);
  1282. /* voice.c */
  1283. EXPORT_SYMBOL(snd_emu10k1_voice_alloc);
  1284. EXPORT_SYMBOL(snd_emu10k1_voice_free);
  1285. /* io.c */
  1286. EXPORT_SYMBOL(snd_emu10k1_ptr_read);
  1287. EXPORT_SYMBOL(snd_emu10k1_ptr_write);