sb8_main.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  1. /*
  2. * Copyright (c) by Jaroslav Kysela <perex@suse.cz>
  3. * Uros Bizjak <uros@kss-loka.si>
  4. *
  5. * Routines for control of 8-bit SoundBlaster cards and clones
  6. * Please note: I don't have access to old SB8 soundcards.
  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. *
  25. * Thu Apr 29 20:36:17 BST 1999 George David Morrison <gdm@gedamo.demon.co.uk>
  26. * DSP can't respond to commands whilst in "high speed" mode. Caused
  27. * glitching during playback. Fixed.
  28. *
  29. * Wed Jul 12 22:02:55 CEST 2000 Uros Bizjak <uros@kss-loka.si>
  30. * Cleaned up and rewrote lowlevel routines.
  31. */
  32. #include <sound/driver.h>
  33. #include <asm/io.h>
  34. #include <asm/dma.h>
  35. #include <linux/init.h>
  36. #include <linux/time.h>
  37. #include <sound/core.h>
  38. #include <sound/sb.h>
  39. MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>, Uros Bizjak <uros@kss-loka.si>");
  40. MODULE_DESCRIPTION("Routines for control of 8-bit SoundBlaster cards and clones");
  41. MODULE_LICENSE("GPL");
  42. #define SB8_CLOCK 1000000
  43. #define SB8_DEN(v) ((SB8_CLOCK + (v) / 2) / (v))
  44. #define SB8_RATE(v) (SB8_CLOCK / SB8_DEN(v))
  45. static struct snd_ratnum clock = {
  46. .num = SB8_CLOCK,
  47. .den_min = 1,
  48. .den_max = 256,
  49. .den_step = 1,
  50. };
  51. static struct snd_pcm_hw_constraint_ratnums hw_constraints_clock = {
  52. .nrats = 1,
  53. .rats = &clock,
  54. };
  55. static struct snd_ratnum stereo_clocks[] = {
  56. {
  57. .num = SB8_CLOCK,
  58. .den_min = SB8_DEN(22050),
  59. .den_max = SB8_DEN(22050),
  60. .den_step = 1,
  61. },
  62. {
  63. .num = SB8_CLOCK,
  64. .den_min = SB8_DEN(11025),
  65. .den_max = SB8_DEN(11025),
  66. .den_step = 1,
  67. }
  68. };
  69. static int snd_sb8_hw_constraint_rate_channels(struct snd_pcm_hw_params *params,
  70. struct snd_pcm_hw_rule *rule)
  71. {
  72. struct snd_interval *c = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
  73. if (c->min > 1) {
  74. unsigned int num = 0, den = 0;
  75. int err = snd_interval_ratnum(hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE),
  76. 2, stereo_clocks, &num, &den);
  77. if (err >= 0 && den) {
  78. params->rate_num = num;
  79. params->rate_den = den;
  80. }
  81. return err;
  82. }
  83. return 0;
  84. }
  85. static int snd_sb8_hw_constraint_channels_rate(struct snd_pcm_hw_params *params,
  86. struct snd_pcm_hw_rule *rule)
  87. {
  88. struct snd_interval *r = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
  89. if (r->min > SB8_RATE(22050) || r->max <= SB8_RATE(11025)) {
  90. struct snd_interval t = { .min = 1, .max = 1 };
  91. return snd_interval_refine(hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS), &t);
  92. }
  93. return 0;
  94. }
  95. static int snd_sb8_playback_prepare(struct snd_pcm_substream *substream)
  96. {
  97. unsigned long flags;
  98. struct snd_sb *chip = snd_pcm_substream_chip(substream);
  99. struct snd_pcm_runtime *runtime = substream->runtime;
  100. unsigned int mixreg, rate, size, count;
  101. rate = runtime->rate;
  102. switch (chip->hardware) {
  103. case SB_HW_PRO:
  104. if (runtime->channels > 1) {
  105. snd_assert(rate == SB8_RATE(11025) || rate == SB8_RATE(22050), return -EINVAL);
  106. chip->playback_format = SB_DSP_HI_OUTPUT_AUTO;
  107. break;
  108. }
  109. /* fallthru */
  110. case SB_HW_201:
  111. if (rate > 23000) {
  112. chip->playback_format = SB_DSP_HI_OUTPUT_AUTO;
  113. break;
  114. }
  115. /* fallthru */
  116. case SB_HW_20:
  117. chip->playback_format = SB_DSP_LO_OUTPUT_AUTO;
  118. break;
  119. case SB_HW_10:
  120. chip->playback_format = SB_DSP_OUTPUT;
  121. break;
  122. default:
  123. return -EINVAL;
  124. }
  125. size = chip->p_dma_size = snd_pcm_lib_buffer_bytes(substream);
  126. count = chip->p_period_size = snd_pcm_lib_period_bytes(substream);
  127. spin_lock_irqsave(&chip->reg_lock, flags);
  128. snd_sbdsp_command(chip, SB_DSP_SPEAKER_ON);
  129. if (runtime->channels > 1) {
  130. /* set playback stereo mode */
  131. spin_lock(&chip->mixer_lock);
  132. mixreg = snd_sbmixer_read(chip, SB_DSP_STEREO_SW);
  133. snd_sbmixer_write(chip, SB_DSP_STEREO_SW, mixreg | 0x02);
  134. spin_unlock(&chip->mixer_lock);
  135. /* Soundblaster hardware programming reference guide, 3-23 */
  136. snd_sbdsp_command(chip, SB_DSP_DMA8_EXIT);
  137. runtime->dma_area[0] = 0x80;
  138. snd_dma_program(chip->dma8, runtime->dma_addr, 1, DMA_MODE_WRITE);
  139. /* force interrupt */
  140. chip->mode = SB_MODE_HALT;
  141. snd_sbdsp_command(chip, SB_DSP_OUTPUT);
  142. snd_sbdsp_command(chip, 0);
  143. snd_sbdsp_command(chip, 0);
  144. }
  145. snd_sbdsp_command(chip, SB_DSP_SAMPLE_RATE);
  146. if (runtime->channels > 1) {
  147. snd_sbdsp_command(chip, 256 - runtime->rate_den / 2);
  148. spin_lock(&chip->mixer_lock);
  149. /* save output filter status and turn it off */
  150. mixreg = snd_sbmixer_read(chip, SB_DSP_PLAYBACK_FILT);
  151. snd_sbmixer_write(chip, SB_DSP_PLAYBACK_FILT, mixreg | 0x20);
  152. spin_unlock(&chip->mixer_lock);
  153. /* just use force_mode16 for temporary storate... */
  154. chip->force_mode16 = mixreg;
  155. } else {
  156. snd_sbdsp_command(chip, 256 - runtime->rate_den);
  157. }
  158. if (chip->playback_format != SB_DSP_OUTPUT) {
  159. count--;
  160. snd_sbdsp_command(chip, SB_DSP_BLOCK_SIZE);
  161. snd_sbdsp_command(chip, count & 0xff);
  162. snd_sbdsp_command(chip, count >> 8);
  163. }
  164. spin_unlock_irqrestore(&chip->reg_lock, flags);
  165. snd_dma_program(chip->dma8, runtime->dma_addr,
  166. size, DMA_MODE_WRITE | DMA_AUTOINIT);
  167. return 0;
  168. }
  169. static int snd_sb8_playback_trigger(struct snd_pcm_substream *substream,
  170. int cmd)
  171. {
  172. unsigned long flags;
  173. struct snd_sb *chip = snd_pcm_substream_chip(substream);
  174. unsigned int count;
  175. spin_lock_irqsave(&chip->reg_lock, flags);
  176. switch (cmd) {
  177. case SNDRV_PCM_TRIGGER_START:
  178. snd_sbdsp_command(chip, chip->playback_format);
  179. if (chip->playback_format == SB_DSP_OUTPUT) {
  180. count = chip->p_period_size - 1;
  181. snd_sbdsp_command(chip, count & 0xff);
  182. snd_sbdsp_command(chip, count >> 8);
  183. }
  184. break;
  185. case SNDRV_PCM_TRIGGER_STOP:
  186. if (chip->playback_format == SB_DSP_HI_OUTPUT_AUTO) {
  187. struct snd_pcm_runtime *runtime = substream->runtime;
  188. snd_sbdsp_reset(chip);
  189. if (runtime->channels > 1) {
  190. spin_lock(&chip->mixer_lock);
  191. /* restore output filter and set hardware to mono mode */
  192. snd_sbmixer_write(chip, SB_DSP_STEREO_SW, chip->force_mode16 & ~0x02);
  193. spin_unlock(&chip->mixer_lock);
  194. }
  195. } else {
  196. snd_sbdsp_command(chip, SB_DSP_DMA8_OFF);
  197. }
  198. snd_sbdsp_command(chip, SB_DSP_SPEAKER_OFF);
  199. }
  200. spin_unlock_irqrestore(&chip->reg_lock, flags);
  201. chip->mode = (cmd == SNDRV_PCM_TRIGGER_START) ? SB_MODE_PLAYBACK_8 : SB_MODE_HALT;
  202. return 0;
  203. }
  204. static int snd_sb8_hw_params(struct snd_pcm_substream *substream,
  205. struct snd_pcm_hw_params *hw_params)
  206. {
  207. return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
  208. }
  209. static int snd_sb8_hw_free(struct snd_pcm_substream *substream)
  210. {
  211. snd_pcm_lib_free_pages(substream);
  212. return 0;
  213. }
  214. static int snd_sb8_capture_prepare(struct snd_pcm_substream *substream)
  215. {
  216. unsigned long flags;
  217. struct snd_sb *chip = snd_pcm_substream_chip(substream);
  218. struct snd_pcm_runtime *runtime = substream->runtime;
  219. unsigned int mixreg, rate, size, count;
  220. rate = runtime->rate;
  221. switch (chip->hardware) {
  222. case SB_HW_PRO:
  223. if (runtime->channels > 1) {
  224. snd_assert(rate == SB8_RATE(11025) || rate == SB8_RATE(22050), return -EINVAL);
  225. chip->capture_format = SB_DSP_HI_INPUT_AUTO;
  226. break;
  227. }
  228. chip->capture_format = (rate > 23000) ? SB_DSP_HI_INPUT_AUTO : SB_DSP_LO_INPUT_AUTO;
  229. break;
  230. case SB_HW_201:
  231. if (rate > 13000) {
  232. chip->capture_format = SB_DSP_HI_INPUT_AUTO;
  233. break;
  234. }
  235. /* fallthru */
  236. case SB_HW_20:
  237. chip->capture_format = SB_DSP_LO_INPUT_AUTO;
  238. break;
  239. case SB_HW_10:
  240. chip->capture_format = SB_DSP_INPUT;
  241. break;
  242. default:
  243. return -EINVAL;
  244. }
  245. size = chip->c_dma_size = snd_pcm_lib_buffer_bytes(substream);
  246. count = chip->c_period_size = snd_pcm_lib_period_bytes(substream);
  247. spin_lock_irqsave(&chip->reg_lock, flags);
  248. snd_sbdsp_command(chip, SB_DSP_SPEAKER_OFF);
  249. if (runtime->channels > 1)
  250. snd_sbdsp_command(chip, SB_DSP_STEREO_8BIT);
  251. snd_sbdsp_command(chip, SB_DSP_SAMPLE_RATE);
  252. if (runtime->channels > 1) {
  253. snd_sbdsp_command(chip, 256 - runtime->rate_den / 2);
  254. spin_lock(&chip->mixer_lock);
  255. /* save input filter status and turn it off */
  256. mixreg = snd_sbmixer_read(chip, SB_DSP_CAPTURE_FILT);
  257. snd_sbmixer_write(chip, SB_DSP_CAPTURE_FILT, mixreg | 0x20);
  258. spin_unlock(&chip->mixer_lock);
  259. /* just use force_mode16 for temporary storate... */
  260. chip->force_mode16 = mixreg;
  261. } else {
  262. snd_sbdsp_command(chip, 256 - runtime->rate_den);
  263. }
  264. if (chip->capture_format != SB_DSP_OUTPUT) {
  265. count--;
  266. snd_sbdsp_command(chip, SB_DSP_BLOCK_SIZE);
  267. snd_sbdsp_command(chip, count & 0xff);
  268. snd_sbdsp_command(chip, count >> 8);
  269. }
  270. spin_unlock_irqrestore(&chip->reg_lock, flags);
  271. snd_dma_program(chip->dma8, runtime->dma_addr,
  272. size, DMA_MODE_READ | DMA_AUTOINIT);
  273. return 0;
  274. }
  275. static int snd_sb8_capture_trigger(struct snd_pcm_substream *substream,
  276. int cmd)
  277. {
  278. unsigned long flags;
  279. struct snd_sb *chip = snd_pcm_substream_chip(substream);
  280. unsigned int count;
  281. spin_lock_irqsave(&chip->reg_lock, flags);
  282. switch (cmd) {
  283. case SNDRV_PCM_TRIGGER_START:
  284. snd_sbdsp_command(chip, chip->capture_format);
  285. if (chip->capture_format == SB_DSP_INPUT) {
  286. count = chip->c_period_size - 1;
  287. snd_sbdsp_command(chip, count & 0xff);
  288. snd_sbdsp_command(chip, count >> 8);
  289. }
  290. break;
  291. case SNDRV_PCM_TRIGGER_STOP:
  292. if (chip->capture_format == SB_DSP_HI_INPUT_AUTO) {
  293. struct snd_pcm_runtime *runtime = substream->runtime;
  294. snd_sbdsp_reset(chip);
  295. if (runtime->channels > 1) {
  296. /* restore input filter status */
  297. spin_lock(&chip->mixer_lock);
  298. snd_sbmixer_write(chip, SB_DSP_CAPTURE_FILT, chip->force_mode16);
  299. spin_unlock(&chip->mixer_lock);
  300. /* set hardware to mono mode */
  301. snd_sbdsp_command(chip, SB_DSP_MONO_8BIT);
  302. }
  303. } else {
  304. snd_sbdsp_command(chip, SB_DSP_DMA8_OFF);
  305. }
  306. snd_sbdsp_command(chip, SB_DSP_SPEAKER_OFF);
  307. }
  308. spin_unlock_irqrestore(&chip->reg_lock, flags);
  309. chip->mode = (cmd == SNDRV_PCM_TRIGGER_START) ? SB_MODE_CAPTURE_8 : SB_MODE_HALT;
  310. return 0;
  311. }
  312. irqreturn_t snd_sb8dsp_interrupt(struct snd_sb *chip)
  313. {
  314. struct snd_pcm_substream *substream;
  315. struct snd_pcm_runtime *runtime;
  316. snd_sb_ack_8bit(chip);
  317. switch (chip->mode) {
  318. case SB_MODE_PLAYBACK_8: /* ok.. playback is active */
  319. substream = chip->playback_substream;
  320. runtime = substream->runtime;
  321. if (chip->playback_format == SB_DSP_OUTPUT)
  322. snd_sb8_playback_trigger(substream, SNDRV_PCM_TRIGGER_START);
  323. snd_pcm_period_elapsed(substream);
  324. break;
  325. case SB_MODE_CAPTURE_8:
  326. substream = chip->capture_substream;
  327. runtime = substream->runtime;
  328. if (chip->capture_format == SB_DSP_INPUT)
  329. snd_sb8_capture_trigger(substream, SNDRV_PCM_TRIGGER_START);
  330. snd_pcm_period_elapsed(substream);
  331. break;
  332. }
  333. return IRQ_HANDLED;
  334. }
  335. static snd_pcm_uframes_t snd_sb8_playback_pointer(struct snd_pcm_substream *substream)
  336. {
  337. struct snd_sb *chip = snd_pcm_substream_chip(substream);
  338. size_t ptr;
  339. if (chip->mode != SB_MODE_PLAYBACK_8)
  340. return 0;
  341. ptr = snd_dma_pointer(chip->dma8, chip->p_dma_size);
  342. return bytes_to_frames(substream->runtime, ptr);
  343. }
  344. static snd_pcm_uframes_t snd_sb8_capture_pointer(struct snd_pcm_substream *substream)
  345. {
  346. struct snd_sb *chip = snd_pcm_substream_chip(substream);
  347. size_t ptr;
  348. if (chip->mode != SB_MODE_CAPTURE_8)
  349. return 0;
  350. ptr = snd_dma_pointer(chip->dma8, chip->c_dma_size);
  351. return bytes_to_frames(substream->runtime, ptr);
  352. }
  353. /*
  354. */
  355. static struct snd_pcm_hardware snd_sb8_playback =
  356. {
  357. .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
  358. SNDRV_PCM_INFO_MMAP_VALID),
  359. .formats = SNDRV_PCM_FMTBIT_U8,
  360. .rates = (SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000 |
  361. SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_22050),
  362. .rate_min = 4000,
  363. .rate_max = 23000,
  364. .channels_min = 1,
  365. .channels_max = 1,
  366. .buffer_bytes_max = 65536,
  367. .period_bytes_min = 64,
  368. .period_bytes_max = 65536,
  369. .periods_min = 1,
  370. .periods_max = 1024,
  371. .fifo_size = 0,
  372. };
  373. static struct snd_pcm_hardware snd_sb8_capture =
  374. {
  375. .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
  376. SNDRV_PCM_INFO_MMAP_VALID),
  377. .formats = SNDRV_PCM_FMTBIT_U8,
  378. .rates = (SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000 |
  379. SNDRV_PCM_RATE_11025),
  380. .rate_min = 4000,
  381. .rate_max = 13000,
  382. .channels_min = 1,
  383. .channels_max = 1,
  384. .buffer_bytes_max = 65536,
  385. .period_bytes_min = 64,
  386. .period_bytes_max = 65536,
  387. .periods_min = 1,
  388. .periods_max = 1024,
  389. .fifo_size = 0,
  390. };
  391. /*
  392. *
  393. */
  394. static int snd_sb8_open(struct snd_pcm_substream *substream)
  395. {
  396. struct snd_sb *chip = snd_pcm_substream_chip(substream);
  397. struct snd_pcm_runtime *runtime = substream->runtime;
  398. unsigned long flags;
  399. spin_lock_irqsave(&chip->open_lock, flags);
  400. if (chip->open) {
  401. spin_unlock_irqrestore(&chip->open_lock, flags);
  402. return -EAGAIN;
  403. }
  404. chip->open |= SB_OPEN_PCM;
  405. spin_unlock_irqrestore(&chip->open_lock, flags);
  406. if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
  407. chip->playback_substream = substream;
  408. runtime->hw = snd_sb8_playback;
  409. } else {
  410. chip->capture_substream = substream;
  411. runtime->hw = snd_sb8_capture;
  412. }
  413. switch (chip->hardware) {
  414. case SB_HW_PRO:
  415. runtime->hw.rate_max = 44100;
  416. runtime->hw.channels_max = 2;
  417. snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
  418. snd_sb8_hw_constraint_rate_channels, NULL,
  419. SNDRV_PCM_HW_PARAM_CHANNELS,
  420. SNDRV_PCM_HW_PARAM_RATE, -1);
  421. snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
  422. snd_sb8_hw_constraint_channels_rate, NULL,
  423. SNDRV_PCM_HW_PARAM_RATE, -1);
  424. break;
  425. case SB_HW_201:
  426. if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
  427. runtime->hw.rate_max = 44100;
  428. } else {
  429. runtime->hw.rate_max = 15000;
  430. }
  431. default:
  432. break;
  433. }
  434. snd_pcm_hw_constraint_ratnums(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
  435. &hw_constraints_clock);
  436. return 0;
  437. }
  438. static int snd_sb8_close(struct snd_pcm_substream *substream)
  439. {
  440. unsigned long flags;
  441. struct snd_sb *chip = snd_pcm_substream_chip(substream);
  442. chip->playback_substream = NULL;
  443. chip->capture_substream = NULL;
  444. spin_lock_irqsave(&chip->open_lock, flags);
  445. chip->open &= ~SB_OPEN_PCM;
  446. spin_unlock_irqrestore(&chip->open_lock, flags);
  447. return 0;
  448. }
  449. /*
  450. * Initialization part
  451. */
  452. static struct snd_pcm_ops snd_sb8_playback_ops = {
  453. .open = snd_sb8_open,
  454. .close = snd_sb8_close,
  455. .ioctl = snd_pcm_lib_ioctl,
  456. .hw_params = snd_sb8_hw_params,
  457. .hw_free = snd_sb8_hw_free,
  458. .prepare = snd_sb8_playback_prepare,
  459. .trigger = snd_sb8_playback_trigger,
  460. .pointer = snd_sb8_playback_pointer,
  461. };
  462. static struct snd_pcm_ops snd_sb8_capture_ops = {
  463. .open = snd_sb8_open,
  464. .close = snd_sb8_close,
  465. .ioctl = snd_pcm_lib_ioctl,
  466. .hw_params = snd_sb8_hw_params,
  467. .hw_free = snd_sb8_hw_free,
  468. .prepare = snd_sb8_capture_prepare,
  469. .trigger = snd_sb8_capture_trigger,
  470. .pointer = snd_sb8_capture_pointer,
  471. };
  472. int snd_sb8dsp_pcm(struct snd_sb *chip, int device, struct snd_pcm ** rpcm)
  473. {
  474. struct snd_card *card = chip->card;
  475. struct snd_pcm *pcm;
  476. int err;
  477. if (rpcm)
  478. *rpcm = NULL;
  479. if ((err = snd_pcm_new(card, "SB8 DSP", device, 1, 1, &pcm)) < 0)
  480. return err;
  481. sprintf(pcm->name, "DSP v%i.%i", chip->version >> 8, chip->version & 0xff);
  482. pcm->info_flags = SNDRV_PCM_INFO_HALF_DUPLEX;
  483. pcm->private_data = chip;
  484. snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_sb8_playback_ops);
  485. snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_sb8_capture_ops);
  486. snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
  487. snd_dma_isa_data(),
  488. 64*1024, 64*1024);
  489. if (rpcm)
  490. *rpcm = pcm;
  491. return 0;
  492. }
  493. EXPORT_SYMBOL(snd_sb8dsp_pcm);
  494. EXPORT_SYMBOL(snd_sb8dsp_interrupt);
  495. /* sb8_midi.c */
  496. EXPORT_SYMBOL(snd_sb8dsp_midi_interrupt);
  497. EXPORT_SYMBOL(snd_sb8dsp_midi);
  498. /*
  499. * INIT part
  500. */
  501. static int __init alsa_sb8_init(void)
  502. {
  503. return 0;
  504. }
  505. static void __exit alsa_sb8_exit(void)
  506. {
  507. }
  508. module_init(alsa_sb8_init)
  509. module_exit(alsa_sb8_exit)