[ALSA] adding __devinitdata to pci_device_id
[deliverable/linux.git] / sound / core / pcm.c
CommitLineData
1da177e4
LT
1/*
2 * Digital Audio (PCM) abstract layer
3 * Copyright (c) by Jaroslav Kysela <perex@suse.cz>
4 *
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21
22#include <sound/driver.h>
23#include <linux/init.h>
24#include <linux/slab.h>
25#include <linux/time.h>
1a60d4c5 26#include <linux/mutex.h>
1da177e4
LT
27#include <sound/core.h>
28#include <sound/minors.h>
29#include <sound/pcm.h>
30#include <sound/control.h>
31#include <sound/info.h>
32
33MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>, Abramo Bagnara <abramo@alsa-project.org>");
34MODULE_DESCRIPTION("Midlevel PCM code for ALSA.");
35MODULE_LICENSE("GPL");
36
f87135f5 37static LIST_HEAD(snd_pcm_devices);
1da177e4 38static LIST_HEAD(snd_pcm_notify_list);
1a60d4c5 39static DEFINE_MUTEX(register_mutex);
1da177e4 40
877211f5
TI
41static int snd_pcm_free(struct snd_pcm *pcm);
42static int snd_pcm_dev_free(struct snd_device *device);
43static int snd_pcm_dev_register(struct snd_device *device);
44static int snd_pcm_dev_disconnect(struct snd_device *device);
45static int snd_pcm_dev_unregister(struct snd_device *device);
1da177e4 46
f87135f5
CL
47static struct snd_pcm *snd_pcm_search(struct snd_card *card, int device)
48{
49 struct list_head *p;
50 struct snd_pcm *pcm;
51
52 list_for_each(p, &snd_pcm_devices) {
53 pcm = list_entry(p, struct snd_pcm, list);
54 if (pcm->card == card && pcm->device == device)
55 return pcm;
56 }
57 return NULL;
58}
59
877211f5
TI
60static int snd_pcm_control_ioctl(struct snd_card *card,
61 struct snd_ctl_file *control,
1da177e4
LT
62 unsigned int cmd, unsigned long arg)
63{
1da177e4
LT
64 switch (cmd) {
65 case SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE:
66 {
67 int device;
68
69 if (get_user(device, (int __user *)arg))
70 return -EFAULT;
1a60d4c5 71 mutex_lock(&register_mutex);
1da177e4
LT
72 device = device < 0 ? 0 : device + 1;
73 while (device < SNDRV_PCM_DEVICES) {
f87135f5 74 if (snd_pcm_search(card, device))
1da177e4
LT
75 break;
76 device++;
77 }
78 if (device == SNDRV_PCM_DEVICES)
79 device = -1;
1a60d4c5 80 mutex_unlock(&register_mutex);
1da177e4
LT
81 if (put_user(device, (int __user *)arg))
82 return -EFAULT;
83 return 0;
84 }
85 case SNDRV_CTL_IOCTL_PCM_INFO:
86 {
877211f5 87 struct snd_pcm_info __user *info;
1da177e4 88 unsigned int device, subdevice;
877211f5
TI
89 int stream;
90 struct snd_pcm *pcm;
91 struct snd_pcm_str *pstr;
92 struct snd_pcm_substream *substream;
f87135f5
CL
93 int err;
94
877211f5 95 info = (struct snd_pcm_info __user *)arg;
1da177e4
LT
96 if (get_user(device, &info->device))
97 return -EFAULT;
1da177e4
LT
98 if (get_user(stream, &info->stream))
99 return -EFAULT;
100 if (stream < 0 || stream > 1)
101 return -EINVAL;
1da177e4
LT
102 if (get_user(subdevice, &info->subdevice))
103 return -EFAULT;
1a60d4c5 104 mutex_lock(&register_mutex);
f87135f5
CL
105 pcm = snd_pcm_search(card, device);
106 if (pcm == NULL) {
107 err = -ENXIO;
108 goto _error;
109 }
110 pstr = &pcm->streams[stream];
111 if (pstr->substream_count == 0) {
112 err = -ENOENT;
113 goto _error;
114 }
115 if (subdevice >= pstr->substream_count) {
116 err = -ENXIO;
117 goto _error;
118 }
119 for (substream = pstr->substream; substream;
120 substream = substream->next)
1da177e4
LT
121 if (substream->number == (int)subdevice)
122 break;
f87135f5
CL
123 if (substream == NULL) {
124 err = -ENXIO;
125 goto _error;
126 }
127 err = snd_pcm_info_user(substream, info);
128 _error:
1a60d4c5 129 mutex_unlock(&register_mutex);
f87135f5 130 return err;
1da177e4
LT
131 }
132 case SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE:
133 {
134 int val;
135
136 if (get_user(val, (int __user *)arg))
137 return -EFAULT;
138 control->prefer_pcm_subdevice = val;
139 return 0;
140 }
141 }
142 return -ENOIOCTLCMD;
143}
21a3479a
JK
144
145#if defined(CONFIG_PROC_FS) && defined(CONFIG_SND_VERBOSE_PROCFS)
146
1da177e4
LT
147#define STATE(v) [SNDRV_PCM_STATE_##v] = #v
148#define STREAM(v) [SNDRV_PCM_STREAM_##v] = #v
149#define READY(v) [SNDRV_PCM_READY_##v] = #v
150#define XRUN(v) [SNDRV_PCM_XRUN_##v] = #v
151#define SILENCE(v) [SNDRV_PCM_SILENCE_##v] = #v
152#define TSTAMP(v) [SNDRV_PCM_TSTAMP_##v] = #v
153#define ACCESS(v) [SNDRV_PCM_ACCESS_##v] = #v
154#define START(v) [SNDRV_PCM_START_##v] = #v
155#define FORMAT(v) [SNDRV_PCM_FORMAT_##v] = #v
156#define SUBFORMAT(v) [SNDRV_PCM_SUBFORMAT_##v] = #v
157
1da177e4
LT
158static char *snd_pcm_format_names[] = {
159 FORMAT(S8),
160 FORMAT(U8),
161 FORMAT(S16_LE),
162 FORMAT(S16_BE),
163 FORMAT(U16_LE),
164 FORMAT(U16_BE),
165 FORMAT(S24_LE),
166 FORMAT(S24_BE),
167 FORMAT(U24_LE),
168 FORMAT(U24_BE),
169 FORMAT(S32_LE),
170 FORMAT(S32_BE),
171 FORMAT(U32_LE),
172 FORMAT(U32_BE),
173 FORMAT(FLOAT_LE),
174 FORMAT(FLOAT_BE),
175 FORMAT(FLOAT64_LE),
176 FORMAT(FLOAT64_BE),
177 FORMAT(IEC958_SUBFRAME_LE),
178 FORMAT(IEC958_SUBFRAME_BE),
179 FORMAT(MU_LAW),
180 FORMAT(A_LAW),
181 FORMAT(IMA_ADPCM),
182 FORMAT(MPEG),
183 FORMAT(GSM),
184 FORMAT(SPECIAL),
185 FORMAT(S24_3LE),
186 FORMAT(S24_3BE),
187 FORMAT(U24_3LE),
188 FORMAT(U24_3BE),
189 FORMAT(S20_3LE),
190 FORMAT(S20_3BE),
191 FORMAT(U20_3LE),
192 FORMAT(U20_3BE),
193 FORMAT(S18_3LE),
194 FORMAT(S18_3BE),
195 FORMAT(U18_3LE),
196 FORMAT(U18_3BE),
197};
198
12831c15 199static const char *snd_pcm_format_name(snd_pcm_format_t format)
e28563cc
TI
200{
201 return snd_pcm_format_names[format];
202}
203
e28563cc
TI
204static char *snd_pcm_stream_names[] = {
205 STREAM(PLAYBACK),
206 STREAM(CAPTURE),
207};
208
209static char *snd_pcm_state_names[] = {
210 STATE(OPEN),
211 STATE(SETUP),
212 STATE(PREPARED),
213 STATE(RUNNING),
214 STATE(XRUN),
215 STATE(DRAINING),
216 STATE(PAUSED),
217 STATE(SUSPENDED),
218};
219
220static char *snd_pcm_access_names[] = {
221 ACCESS(MMAP_INTERLEAVED),
222 ACCESS(MMAP_NONINTERLEAVED),
223 ACCESS(MMAP_COMPLEX),
224 ACCESS(RW_INTERLEAVED),
225 ACCESS(RW_NONINTERLEAVED),
226};
227
1da177e4
LT
228static char *snd_pcm_subformat_names[] = {
229 SUBFORMAT(STD),
230};
231
232static char *snd_pcm_tstamp_mode_names[] = {
233 TSTAMP(NONE),
234 TSTAMP(MMAP),
235};
236
877211f5 237static const char *snd_pcm_stream_name(int stream)
1da177e4
LT
238{
239 snd_assert(stream <= SNDRV_PCM_STREAM_LAST, return NULL);
240 return snd_pcm_stream_names[stream];
241}
242
243static const char *snd_pcm_access_name(snd_pcm_access_t access)
244{
1da177e4
LT
245 return snd_pcm_access_names[access];
246}
247
1da177e4
LT
248static const char *snd_pcm_subformat_name(snd_pcm_subformat_t subformat)
249{
1da177e4
LT
250 return snd_pcm_subformat_names[subformat];
251}
252
877211f5 253static const char *snd_pcm_tstamp_mode_name(int mode)
1da177e4
LT
254{
255 snd_assert(mode <= SNDRV_PCM_TSTAMP_LAST, return NULL);
256 return snd_pcm_tstamp_mode_names[mode];
257}
258
259static const char *snd_pcm_state_name(snd_pcm_state_t state)
260{
1da177e4
LT
261 return snd_pcm_state_names[state];
262}
263
264#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
265#include <linux/soundcard.h>
1a60d4c5 266
1da177e4
LT
267static const char *snd_pcm_oss_format_name(int format)
268{
269 switch (format) {
270 case AFMT_MU_LAW:
271 return "MU_LAW";
272 case AFMT_A_LAW:
273 return "A_LAW";
274 case AFMT_IMA_ADPCM:
275 return "IMA_ADPCM";
276 case AFMT_U8:
277 return "U8";
278 case AFMT_S16_LE:
279 return "S16_LE";
280 case AFMT_S16_BE:
281 return "S16_BE";
282 case AFMT_S8:
283 return "S8";
284 case AFMT_U16_LE:
285 return "U16_LE";
286 case AFMT_U16_BE:
287 return "U16_BE";
288 case AFMT_MPEG:
289 return "MPEG";
290 default:
291 return "unknown";
292 }
293}
294#endif
295
877211f5
TI
296static void snd_pcm_proc_info_read(struct snd_pcm_substream *substream,
297 struct snd_info_buffer *buffer)
1da177e4 298{
877211f5 299 struct snd_pcm_info *info;
1da177e4
LT
300 int err;
301
7c22f1aa
TI
302 if (! substream)
303 return;
1da177e4
LT
304
305 info = kmalloc(sizeof(*info), GFP_KERNEL);
306 if (! info) {
307 printk(KERN_DEBUG "snd_pcm_proc_info_read: cannot malloc\n");
308 return;
309 }
310
311 err = snd_pcm_info(substream, info);
312 if (err < 0) {
313 snd_iprintf(buffer, "error %d\n", err);
314 kfree(info);
315 return;
316 }
317 snd_iprintf(buffer, "card: %d\n", info->card);
318 snd_iprintf(buffer, "device: %d\n", info->device);
319 snd_iprintf(buffer, "subdevice: %d\n", info->subdevice);
320 snd_iprintf(buffer, "stream: %s\n", snd_pcm_stream_name(info->stream));
321 snd_iprintf(buffer, "id: %s\n", info->id);
322 snd_iprintf(buffer, "name: %s\n", info->name);
323 snd_iprintf(buffer, "subname: %s\n", info->subname);
324 snd_iprintf(buffer, "class: %d\n", info->dev_class);
325 snd_iprintf(buffer, "subclass: %d\n", info->dev_subclass);
326 snd_iprintf(buffer, "subdevices_count: %d\n", info->subdevices_count);
327 snd_iprintf(buffer, "subdevices_avail: %d\n", info->subdevices_avail);
328 kfree(info);
329}
330
877211f5
TI
331static void snd_pcm_stream_proc_info_read(struct snd_info_entry *entry,
332 struct snd_info_buffer *buffer)
1da177e4 333{
877211f5
TI
334 snd_pcm_proc_info_read(((struct snd_pcm_str *)entry->private_data)->substream,
335 buffer);
1da177e4
LT
336}
337
877211f5
TI
338static void snd_pcm_substream_proc_info_read(struct snd_info_entry *entry,
339 struct snd_info_buffer *buffer)
1da177e4 340{
877211f5
TI
341 snd_pcm_proc_info_read((struct snd_pcm_substream *)entry->private_data,
342 buffer);
1da177e4
LT
343}
344
877211f5
TI
345static void snd_pcm_substream_proc_hw_params_read(struct snd_info_entry *entry,
346 struct snd_info_buffer *buffer)
1da177e4 347{
877211f5
TI
348 struct snd_pcm_substream *substream = entry->private_data;
349 struct snd_pcm_runtime *runtime = substream->runtime;
1da177e4
LT
350 if (!runtime) {
351 snd_iprintf(buffer, "closed\n");
352 return;
353 }
354 snd_pcm_stream_lock_irq(substream);
355 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) {
356 snd_iprintf(buffer, "no setup\n");
357 snd_pcm_stream_unlock_irq(substream);
358 return;
359 }
360 snd_iprintf(buffer, "access: %s\n", snd_pcm_access_name(runtime->access));
361 snd_iprintf(buffer, "format: %s\n", snd_pcm_format_name(runtime->format));
362 snd_iprintf(buffer, "subformat: %s\n", snd_pcm_subformat_name(runtime->subformat));
363 snd_iprintf(buffer, "channels: %u\n", runtime->channels);
364 snd_iprintf(buffer, "rate: %u (%u/%u)\n", runtime->rate, runtime->rate_num, runtime->rate_den);
365 snd_iprintf(buffer, "period_size: %lu\n", runtime->period_size);
366 snd_iprintf(buffer, "buffer_size: %lu\n", runtime->buffer_size);
367 snd_iprintf(buffer, "tick_time: %u\n", runtime->tick_time);
368#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
369 if (substream->oss.oss) {
370 snd_iprintf(buffer, "OSS format: %s\n", snd_pcm_oss_format_name(runtime->oss.format));
371 snd_iprintf(buffer, "OSS channels: %u\n", runtime->oss.channels);
372 snd_iprintf(buffer, "OSS rate: %u\n", runtime->oss.rate);
373 snd_iprintf(buffer, "OSS period bytes: %lu\n", (unsigned long)runtime->oss.period_bytes);
374 snd_iprintf(buffer, "OSS periods: %u\n", runtime->oss.periods);
375 snd_iprintf(buffer, "OSS period frames: %lu\n", (unsigned long)runtime->oss.period_frames);
376 }
377#endif
378 snd_pcm_stream_unlock_irq(substream);
379}
380
877211f5
TI
381static void snd_pcm_substream_proc_sw_params_read(struct snd_info_entry *entry,
382 struct snd_info_buffer *buffer)
1da177e4 383{
877211f5
TI
384 struct snd_pcm_substream *substream = entry->private_data;
385 struct snd_pcm_runtime *runtime = substream->runtime;
1da177e4
LT
386 if (!runtime) {
387 snd_iprintf(buffer, "closed\n");
388 return;
389 }
390 snd_pcm_stream_lock_irq(substream);
391 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) {
392 snd_iprintf(buffer, "no setup\n");
393 snd_pcm_stream_unlock_irq(substream);
394 return;
395 }
396 snd_iprintf(buffer, "tstamp_mode: %s\n", snd_pcm_tstamp_mode_name(runtime->tstamp_mode));
397 snd_iprintf(buffer, "period_step: %u\n", runtime->period_step);
398 snd_iprintf(buffer, "sleep_min: %u\n", runtime->sleep_min);
399 snd_iprintf(buffer, "avail_min: %lu\n", runtime->control->avail_min);
400 snd_iprintf(buffer, "xfer_align: %lu\n", runtime->xfer_align);
401 snd_iprintf(buffer, "start_threshold: %lu\n", runtime->start_threshold);
402 snd_iprintf(buffer, "stop_threshold: %lu\n", runtime->stop_threshold);
403 snd_iprintf(buffer, "silence_threshold: %lu\n", runtime->silence_threshold);
404 snd_iprintf(buffer, "silence_size: %lu\n", runtime->silence_size);
405 snd_iprintf(buffer, "boundary: %lu\n", runtime->boundary);
406 snd_pcm_stream_unlock_irq(substream);
407}
408
877211f5
TI
409static void snd_pcm_substream_proc_status_read(struct snd_info_entry *entry,
410 struct snd_info_buffer *buffer)
1da177e4 411{
877211f5
TI
412 struct snd_pcm_substream *substream = entry->private_data;
413 struct snd_pcm_runtime *runtime = substream->runtime;
414 struct snd_pcm_status status;
1da177e4
LT
415 int err;
416 if (!runtime) {
417 snd_iprintf(buffer, "closed\n");
418 return;
419 }
420 memset(&status, 0, sizeof(status));
421 err = snd_pcm_status(substream, &status);
422 if (err < 0) {
423 snd_iprintf(buffer, "error %d\n", err);
424 return;
425 }
426 snd_iprintf(buffer, "state: %s\n", snd_pcm_state_name(status.state));
427 snd_iprintf(buffer, "trigger_time: %ld.%09ld\n",
428 status.trigger_tstamp.tv_sec, status.trigger_tstamp.tv_nsec);
429 snd_iprintf(buffer, "tstamp : %ld.%09ld\n",
430 status.tstamp.tv_sec, status.tstamp.tv_nsec);
431 snd_iprintf(buffer, "delay : %ld\n", status.delay);
432 snd_iprintf(buffer, "avail : %ld\n", status.avail);
433 snd_iprintf(buffer, "avail_max : %ld\n", status.avail_max);
434 snd_iprintf(buffer, "-----\n");
435 snd_iprintf(buffer, "hw_ptr : %ld\n", runtime->status->hw_ptr);
436 snd_iprintf(buffer, "appl_ptr : %ld\n", runtime->control->appl_ptr);
437}
1da177e4
LT
438
439#ifdef CONFIG_SND_DEBUG
877211f5
TI
440static void snd_pcm_xrun_debug_read(struct snd_info_entry *entry,
441 struct snd_info_buffer *buffer)
1da177e4 442{
877211f5 443 struct snd_pcm_str *pstr = entry->private_data;
1da177e4
LT
444 snd_iprintf(buffer, "%d\n", pstr->xrun_debug);
445}
446
877211f5
TI
447static void snd_pcm_xrun_debug_write(struct snd_info_entry *entry,
448 struct snd_info_buffer *buffer)
1da177e4 449{
877211f5 450 struct snd_pcm_str *pstr = entry->private_data;
1da177e4
LT
451 char line[64];
452 if (!snd_info_get_line(buffer, line, sizeof(line)))
453 pstr->xrun_debug = simple_strtoul(line, NULL, 10);
454}
455#endif
456
877211f5 457static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr)
1da177e4 458{
877211f5
TI
459 struct snd_pcm *pcm = pstr->pcm;
460 struct snd_info_entry *entry;
1da177e4
LT
461 char name[16];
462
463 sprintf(name, "pcm%i%c", pcm->device,
464 pstr->stream == SNDRV_PCM_STREAM_PLAYBACK ? 'p' : 'c');
465 if ((entry = snd_info_create_card_entry(pcm->card, name, pcm->card->proc_root)) == NULL)
466 return -ENOMEM;
467 entry->mode = S_IFDIR | S_IRUGO | S_IXUGO;
468 if (snd_info_register(entry) < 0) {
469 snd_info_free_entry(entry);
470 return -ENOMEM;
471 }
472 pstr->proc_root = entry;
473
474 if ((entry = snd_info_create_card_entry(pcm->card, "info", pstr->proc_root)) != NULL) {
475 snd_info_set_text_ops(entry, pstr, 256, snd_pcm_stream_proc_info_read);
476 if (snd_info_register(entry) < 0) {
477 snd_info_free_entry(entry);
478 entry = NULL;
479 }
480 }
481 pstr->proc_info_entry = entry;
482
483#ifdef CONFIG_SND_DEBUG
877211f5
TI
484 if ((entry = snd_info_create_card_entry(pcm->card, "xrun_debug",
485 pstr->proc_root)) != NULL) {
1da177e4
LT
486 entry->c.text.read_size = 64;
487 entry->c.text.read = snd_pcm_xrun_debug_read;
488 entry->c.text.write_size = 64;
489 entry->c.text.write = snd_pcm_xrun_debug_write;
bd7bf042 490 entry->mode |= S_IWUSR;
1da177e4
LT
491 entry->private_data = pstr;
492 if (snd_info_register(entry) < 0) {
493 snd_info_free_entry(entry);
494 entry = NULL;
495 }
496 }
497 pstr->proc_xrun_debug_entry = entry;
498#endif
499 return 0;
500}
501
877211f5 502static int snd_pcm_stream_proc_done(struct snd_pcm_str *pstr)
1da177e4
LT
503{
504#ifdef CONFIG_SND_DEBUG
505 if (pstr->proc_xrun_debug_entry) {
506 snd_info_unregister(pstr->proc_xrun_debug_entry);
507 pstr->proc_xrun_debug_entry = NULL;
508 }
509#endif
510 if (pstr->proc_info_entry) {
511 snd_info_unregister(pstr->proc_info_entry);
512 pstr->proc_info_entry = NULL;
513 }
514 if (pstr->proc_root) {
515 snd_info_unregister(pstr->proc_root);
516 pstr->proc_root = NULL;
517 }
518 return 0;
519}
520
877211f5 521static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream)
1da177e4 522{
877211f5
TI
523 struct snd_info_entry *entry;
524 struct snd_card *card;
1da177e4
LT
525 char name[16];
526
527 card = substream->pcm->card;
528
529 sprintf(name, "sub%i", substream->number);
530 if ((entry = snd_info_create_card_entry(card, name, substream->pstr->proc_root)) == NULL)
531 return -ENOMEM;
532 entry->mode = S_IFDIR | S_IRUGO | S_IXUGO;
533 if (snd_info_register(entry) < 0) {
534 snd_info_free_entry(entry);
535 return -ENOMEM;
536 }
537 substream->proc_root = entry;
538
539 if ((entry = snd_info_create_card_entry(card, "info", substream->proc_root)) != NULL) {
540 snd_info_set_text_ops(entry, substream, 256, snd_pcm_substream_proc_info_read);
541 if (snd_info_register(entry) < 0) {
542 snd_info_free_entry(entry);
543 entry = NULL;
544 }
545 }
546 substream->proc_info_entry = entry;
547
548 if ((entry = snd_info_create_card_entry(card, "hw_params", substream->proc_root)) != NULL) {
549 snd_info_set_text_ops(entry, substream, 256, snd_pcm_substream_proc_hw_params_read);
550 if (snd_info_register(entry) < 0) {
551 snd_info_free_entry(entry);
552 entry = NULL;
553 }
554 }
555 substream->proc_hw_params_entry = entry;
556
557 if ((entry = snd_info_create_card_entry(card, "sw_params", substream->proc_root)) != NULL) {
558 snd_info_set_text_ops(entry, substream, 256, snd_pcm_substream_proc_sw_params_read);
559 if (snd_info_register(entry) < 0) {
560 snd_info_free_entry(entry);
561 entry = NULL;
562 }
563 }
564 substream->proc_sw_params_entry = entry;
565
566 if ((entry = snd_info_create_card_entry(card, "status", substream->proc_root)) != NULL) {
567 snd_info_set_text_ops(entry, substream, 256, snd_pcm_substream_proc_status_read);
568 if (snd_info_register(entry) < 0) {
569 snd_info_free_entry(entry);
570 entry = NULL;
571 }
572 }
573 substream->proc_status_entry = entry;
574
575 return 0;
576}
577
877211f5 578static int snd_pcm_substream_proc_done(struct snd_pcm_substream *substream)
1da177e4
LT
579{
580 if (substream->proc_info_entry) {
581 snd_info_unregister(substream->proc_info_entry);
582 substream->proc_info_entry = NULL;
583 }
584 if (substream->proc_hw_params_entry) {
585 snd_info_unregister(substream->proc_hw_params_entry);
586 substream->proc_hw_params_entry = NULL;
587 }
588 if (substream->proc_sw_params_entry) {
589 snd_info_unregister(substream->proc_sw_params_entry);
590 substream->proc_sw_params_entry = NULL;
591 }
592 if (substream->proc_status_entry) {
593 snd_info_unregister(substream->proc_status_entry);
594 substream->proc_status_entry = NULL;
595 }
596 if (substream->proc_root) {
597 snd_info_unregister(substream->proc_root);
598 substream->proc_root = NULL;
599 }
600 return 0;
601}
e28563cc
TI
602#else /* !CONFIG_PROC_FS */
603static inline int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr) { return 0; }
604static inline int snd_pcm_stream_proc_done(struct snd_pcm_str *pstr) { return 0; }
605static inline int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream) { return 0; }
606static inline int snd_pcm_substream_proc_done(struct snd_pcm_substream *substream) { return 0; }
607#endif /* CONFIG_PROC_FS */
1da177e4
LT
608
609/**
610 * snd_pcm_new_stream - create a new PCM stream
611 * @pcm: the pcm instance
612 * @stream: the stream direction, SNDRV_PCM_STREAM_XXX
613 * @substream_count: the number of substreams
614 *
615 * Creates a new stream for the pcm.
616 * The corresponding stream on the pcm must have been empty before
617 * calling this, i.e. zero must be given to the argument of
618 * snd_pcm_new().
619 *
620 * Returns zero if successful, or a negative error code on failure.
621 */
877211f5 622int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count)
1da177e4
LT
623{
624 int idx, err;
877211f5
TI
625 struct snd_pcm_str *pstr = &pcm->streams[stream];
626 struct snd_pcm_substream *substream, *prev;
1da177e4
LT
627
628#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
1a60d4c5 629 mutex_init(&pstr->oss.setup_mutex);
1da177e4
LT
630#endif
631 pstr->stream = stream;
632 pstr->pcm = pcm;
633 pstr->substream_count = substream_count;
1da177e4
LT
634 if (substream_count > 0) {
635 err = snd_pcm_stream_proc_init(pstr);
73e77ba0
TI
636 if (err < 0) {
637 snd_printk(KERN_ERR "Error in snd_pcm_stream_proc_init\n");
1da177e4 638 return err;
73e77ba0 639 }
1da177e4
LT
640 }
641 prev = NULL;
642 for (idx = 0, prev = NULL; idx < substream_count; idx++) {
ca2c0966 643 substream = kzalloc(sizeof(*substream), GFP_KERNEL);
73e77ba0
TI
644 if (substream == NULL) {
645 snd_printk(KERN_ERR "Cannot allocate PCM substream\n");
1da177e4 646 return -ENOMEM;
73e77ba0 647 }
1da177e4
LT
648 substream->pcm = pcm;
649 substream->pstr = pstr;
650 substream->number = idx;
651 substream->stream = stream;
652 sprintf(substream->name, "subdevice #%i", idx);
653 substream->buffer_bytes_max = UINT_MAX;
654 if (prev == NULL)
655 pstr->substream = substream;
656 else
657 prev->next = substream;
658 err = snd_pcm_substream_proc_init(substream);
659 if (err < 0) {
73e77ba0 660 snd_printk(KERN_ERR "Error in snd_pcm_stream_proc_init\n");
1da177e4
LT
661 kfree(substream);
662 return err;
663 }
664 substream->group = &substream->self_group;
665 spin_lock_init(&substream->self_group.lock);
666 INIT_LIST_HEAD(&substream->self_group.substreams);
667 list_add_tail(&substream->link_list, &substream->self_group.substreams);
668 spin_lock_init(&substream->timer_lock);
669 prev = substream;
670 }
671 return 0;
672}
673
674/**
675 * snd_pcm_new - create a new PCM instance
676 * @card: the card instance
677 * @id: the id string
678 * @device: the device index (zero based)
679 * @playback_count: the number of substreams for playback
680 * @capture_count: the number of substreams for capture
681 * @rpcm: the pointer to store the new pcm instance
682 *
683 * Creates a new PCM instance.
684 *
685 * The pcm operators have to be set afterwards to the new instance
686 * via snd_pcm_set_ops().
687 *
688 * Returns zero if successful, or a negative error code on failure.
689 */
877211f5 690int snd_pcm_new(struct snd_card *card, char *id, int device,
1da177e4 691 int playback_count, int capture_count,
877211f5 692 struct snd_pcm ** rpcm)
1da177e4 693{
877211f5 694 struct snd_pcm *pcm;
1da177e4 695 int err;
877211f5 696 static struct snd_device_ops ops = {
1da177e4
LT
697 .dev_free = snd_pcm_dev_free,
698 .dev_register = snd_pcm_dev_register,
699 .dev_disconnect = snd_pcm_dev_disconnect,
700 .dev_unregister = snd_pcm_dev_unregister
701 };
702
703 snd_assert(rpcm != NULL, return -EINVAL);
704 *rpcm = NULL;
705 snd_assert(card != NULL, return -ENXIO);
ca2c0966 706 pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
73e77ba0
TI
707 if (pcm == NULL) {
708 snd_printk(KERN_ERR "Cannot allocate PCM\n");
1da177e4 709 return -ENOMEM;
73e77ba0 710 }
1da177e4
LT
711 pcm->card = card;
712 pcm->device = device;
73e77ba0 713 if (id)
1da177e4 714 strlcpy(pcm->id, id, sizeof(pcm->id));
1da177e4
LT
715 if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK, playback_count)) < 0) {
716 snd_pcm_free(pcm);
717 return err;
718 }
719 if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, capture_count)) < 0) {
720 snd_pcm_free(pcm);
721 return err;
722 }
1a60d4c5 723 mutex_init(&pcm->open_mutex);
1da177e4
LT
724 init_waitqueue_head(&pcm->open_wait);
725 if ((err = snd_device_new(card, SNDRV_DEV_PCM, pcm, &ops)) < 0) {
726 snd_pcm_free(pcm);
727 return err;
728 }
729 *rpcm = pcm;
730 return 0;
731}
732
877211f5 733static void snd_pcm_free_stream(struct snd_pcm_str * pstr)
1da177e4 734{
877211f5 735 struct snd_pcm_substream *substream, *substream_next;
1da177e4 736#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
877211f5 737 struct snd_pcm_oss_setup *setup, *setupn;
1da177e4
LT
738#endif
739 substream = pstr->substream;
740 while (substream) {
741 substream_next = substream->next;
742 snd_pcm_substream_proc_done(substream);
743 kfree(substream);
744 substream = substream_next;
745 }
746 snd_pcm_stream_proc_done(pstr);
747#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
748 for (setup = pstr->oss.setup_list; setup; setup = setupn) {
749 setupn = setup->next;
750 kfree(setup->task_name);
751 kfree(setup);
752 }
753#endif
754}
755
877211f5 756static int snd_pcm_free(struct snd_pcm *pcm)
1da177e4
LT
757{
758 snd_assert(pcm != NULL, return -ENXIO);
759 if (pcm->private_free)
760 pcm->private_free(pcm);
761 snd_pcm_lib_preallocate_free_for_all(pcm);
762 snd_pcm_free_stream(&pcm->streams[SNDRV_PCM_STREAM_PLAYBACK]);
763 snd_pcm_free_stream(&pcm->streams[SNDRV_PCM_STREAM_CAPTURE]);
764 kfree(pcm);
765 return 0;
766}
767
877211f5 768static int snd_pcm_dev_free(struct snd_device *device)
1da177e4 769{
877211f5 770 struct snd_pcm *pcm = device->device_data;
1da177e4
LT
771 return snd_pcm_free(pcm);
772}
773
774static void snd_pcm_tick_timer_func(unsigned long data)
775{
877211f5 776 struct snd_pcm_substream *substream = (struct snd_pcm_substream *) data;
1da177e4
LT
777 snd_pcm_tick_elapsed(substream);
778}
779
3bf75f9b
TI
780int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
781 struct file *file,
782 struct snd_pcm_substream **rsubstream)
1da177e4 783{
877211f5
TI
784 struct snd_pcm_str * pstr;
785 struct snd_pcm_substream *substream;
786 struct snd_pcm_runtime *runtime;
787 struct snd_ctl_file *kctl;
788 struct snd_card *card;
1da177e4
LT
789 struct list_head *list;
790 int prefer_subdevice = -1;
791 size_t size;
792
793 snd_assert(rsubstream != NULL, return -EINVAL);
794 *rsubstream = NULL;
795 snd_assert(pcm != NULL, return -ENXIO);
796 pstr = &pcm->streams[stream];
3bf75f9b 797 if (pstr->substream == NULL || pstr->substream_count == 0)
1da177e4
LT
798 return -ENODEV;
799
800 card = pcm->card;
801 down_read(&card->controls_rwsem);
802 list_for_each(list, &card->ctl_files) {
803 kctl = snd_ctl_file(list);
804 if (kctl->pid == current->pid) {
805 prefer_subdevice = kctl->prefer_pcm_subdevice;
806 break;
807 }
808 }
809 up_read(&card->controls_rwsem);
810
1da177e4
LT
811 switch (stream) {
812 case SNDRV_PCM_STREAM_PLAYBACK:
813 if (pcm->info_flags & SNDRV_PCM_INFO_HALF_DUPLEX) {
814 for (substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; substream; substream = substream->next) {
815 if (SUBSTREAM_BUSY(substream))
816 return -EAGAIN;
817 }
818 }
819 break;
820 case SNDRV_PCM_STREAM_CAPTURE:
821 if (pcm->info_flags & SNDRV_PCM_INFO_HALF_DUPLEX) {
822 for (substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; substream; substream = substream->next) {
823 if (SUBSTREAM_BUSY(substream))
824 return -EAGAIN;
825 }
826 }
827 break;
828 default:
829 return -EINVAL;
830 }
831
832 if (prefer_subdevice >= 0) {
833 for (substream = pstr->substream; substream; substream = substream->next)
834 if (!SUBSTREAM_BUSY(substream) && substream->number == prefer_subdevice)
835 goto __ok;
836 }
837 for (substream = pstr->substream; substream; substream = substream->next)
838 if (!SUBSTREAM_BUSY(substream))
839 break;
840 __ok:
841 if (substream == NULL)
842 return -EAGAIN;
843
ca2c0966 844 runtime = kzalloc(sizeof(*runtime), GFP_KERNEL);
1da177e4
LT
845 if (runtime == NULL)
846 return -ENOMEM;
847
877211f5 848 size = PAGE_ALIGN(sizeof(struct snd_pcm_mmap_status));
1da177e4
LT
849 runtime->status = snd_malloc_pages(size, GFP_KERNEL);
850 if (runtime->status == NULL) {
851 kfree(runtime);
852 return -ENOMEM;
853 }
854 memset((void*)runtime->status, 0, size);
855
877211f5 856 size = PAGE_ALIGN(sizeof(struct snd_pcm_mmap_control));
1da177e4
LT
857 runtime->control = snd_malloc_pages(size, GFP_KERNEL);
858 if (runtime->control == NULL) {
877211f5
TI
859 snd_free_pages((void*)runtime->status,
860 PAGE_ALIGN(sizeof(struct snd_pcm_mmap_status)));
1da177e4
LT
861 kfree(runtime);
862 return -ENOMEM;
863 }
864 memset((void*)runtime->control, 0, size);
865
866 init_waitqueue_head(&runtime->sleep);
867 atomic_set(&runtime->mmap_count, 0);
868 init_timer(&runtime->tick_timer);
869 runtime->tick_timer.function = snd_pcm_tick_timer_func;
870 runtime->tick_timer.data = (unsigned long) substream;
871
872 runtime->status->state = SNDRV_PCM_STATE_OPEN;
873
874 substream->runtime = runtime;
875 substream->private_data = pcm->private_data;
3bf75f9b 876 substream->ffile = file;
1da177e4
LT
877 pstr->substream_opened++;
878 *rsubstream = substream;
879 return 0;
880}
881
3bf75f9b 882void snd_pcm_detach_substream(struct snd_pcm_substream *substream)
1da177e4 883{
877211f5 884 struct snd_pcm_runtime *runtime;
1da177e4
LT
885 substream->file = NULL;
886 runtime = substream->runtime;
887 snd_assert(runtime != NULL, return);
888 if (runtime->private_free != NULL)
889 runtime->private_free(runtime);
877211f5
TI
890 snd_free_pages((void*)runtime->status,
891 PAGE_ALIGN(sizeof(struct snd_pcm_mmap_status)));
892 snd_free_pages((void*)runtime->control,
893 PAGE_ALIGN(sizeof(struct snd_pcm_mmap_control)));
1da177e4
LT
894 kfree(runtime->hw_constraints.rules);
895 kfree(runtime);
896 substream->runtime = NULL;
897 substream->pstr->substream_opened--;
898}
899
877211f5 900static int snd_pcm_dev_register(struct snd_device *device)
1da177e4 901{
f87135f5 902 int cidx, err;
877211f5 903 struct snd_pcm_substream *substream;
1da177e4
LT
904 struct list_head *list;
905 char str[16];
877211f5 906 struct snd_pcm *pcm = device->device_data;
1da177e4
LT
907
908 snd_assert(pcm != NULL && device != NULL, return -ENXIO);
1a60d4c5 909 mutex_lock(&register_mutex);
f87135f5 910 if (snd_pcm_search(pcm->card, pcm->device)) {
1a60d4c5 911 mutex_unlock(&register_mutex);
1da177e4
LT
912 return -EBUSY;
913 }
f87135f5 914 list_add_tail(&pcm->list, &snd_pcm_devices);
1da177e4
LT
915 for (cidx = 0; cidx < 2; cidx++) {
916 int devtype = -1;
917 if (pcm->streams[cidx].substream == NULL)
918 continue;
919 switch (cidx) {
920 case SNDRV_PCM_STREAM_PLAYBACK:
921 sprintf(str, "pcmC%iD%ip", pcm->card->number, pcm->device);
1da177e4
LT
922 devtype = SNDRV_DEVICE_TYPE_PCM_PLAYBACK;
923 break;
924 case SNDRV_PCM_STREAM_CAPTURE:
925 sprintf(str, "pcmC%iD%ic", pcm->card->number, pcm->device);
1da177e4
LT
926 devtype = SNDRV_DEVICE_TYPE_PCM_CAPTURE;
927 break;
928 }
2af677fc
CL
929 if ((err = snd_register_device(devtype, pcm->card,
930 pcm->device,
f87135f5
CL
931 &snd_pcm_f_ops[cidx],
932 pcm, str)) < 0)
2af677fc 933 {
f87135f5 934 list_del(&pcm->list);
1a60d4c5 935 mutex_unlock(&register_mutex);
1da177e4
LT
936 return err;
937 }
938 for (substream = pcm->streams[cidx].substream; substream; substream = substream->next)
939 snd_pcm_timer_init(substream);
940 }
941 list_for_each(list, &snd_pcm_notify_list) {
877211f5
TI
942 struct snd_pcm_notify *notify;
943 notify = list_entry(list, struct snd_pcm_notify, list);
1da177e4
LT
944 notify->n_register(pcm);
945 }
1a60d4c5 946 mutex_unlock(&register_mutex);
1da177e4
LT
947 return 0;
948}
949
877211f5 950static int snd_pcm_dev_disconnect(struct snd_device *device)
1da177e4 951{
877211f5 952 struct snd_pcm *pcm = device->device_data;
1da177e4 953 struct list_head *list;
877211f5 954 struct snd_pcm_substream *substream;
f87135f5 955 int cidx;
1da177e4 956
1a60d4c5 957 mutex_lock(&register_mutex);
f87135f5 958 list_del_init(&pcm->list);
1da177e4
LT
959 for (cidx = 0; cidx < 2; cidx++)
960 for (substream = pcm->streams[cidx].substream; substream; substream = substream->next)
961 if (substream->runtime)
962 substream->runtime->status->state = SNDRV_PCM_STATE_DISCONNECTED;
963 list_for_each(list, &snd_pcm_notify_list) {
877211f5
TI
964 struct snd_pcm_notify *notify;
965 notify = list_entry(list, struct snd_pcm_notify, list);
1da177e4
LT
966 notify->n_disconnect(pcm);
967 }
1a60d4c5 968 mutex_unlock(&register_mutex);
1da177e4
LT
969 return 0;
970}
971
877211f5 972static int snd_pcm_dev_unregister(struct snd_device *device)
1da177e4 973{
f87135f5 974 int cidx, devtype;
877211f5 975 struct snd_pcm_substream *substream;
1da177e4 976 struct list_head *list;
877211f5 977 struct snd_pcm *pcm = device->device_data;
1da177e4
LT
978
979 snd_assert(pcm != NULL, return -ENXIO);
1a60d4c5 980 mutex_lock(&register_mutex);
f87135f5 981 list_del(&pcm->list);
1da177e4
LT
982 for (cidx = 0; cidx < 2; cidx++) {
983 devtype = -1;
984 switch (cidx) {
985 case SNDRV_PCM_STREAM_PLAYBACK:
986 devtype = SNDRV_DEVICE_TYPE_PCM_PLAYBACK;
987 break;
988 case SNDRV_PCM_STREAM_CAPTURE:
989 devtype = SNDRV_DEVICE_TYPE_PCM_CAPTURE;
990 break;
991 }
992 snd_unregister_device(devtype, pcm->card, pcm->device);
993 for (substream = pcm->streams[cidx].substream; substream; substream = substream->next)
994 snd_pcm_timer_done(substream);
995 }
996 list_for_each(list, &snd_pcm_notify_list) {
877211f5
TI
997 struct snd_pcm_notify *notify;
998 notify = list_entry(list, struct snd_pcm_notify, list);
1da177e4
LT
999 notify->n_unregister(pcm);
1000 }
1a60d4c5 1001 mutex_unlock(&register_mutex);
1da177e4
LT
1002 return snd_pcm_free(pcm);
1003}
1004
877211f5 1005int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree)
1da177e4 1006{
f87135f5 1007 struct list_head *p;
1da177e4
LT
1008
1009 snd_assert(notify != NULL && notify->n_register != NULL && notify->n_unregister != NULL, return -EINVAL);
1a60d4c5 1010 mutex_lock(&register_mutex);
1da177e4
LT
1011 if (nfree) {
1012 list_del(&notify->list);
f87135f5
CL
1013 list_for_each(p, &snd_pcm_devices)
1014 notify->n_unregister(list_entry(p,
1015 struct snd_pcm, list));
1da177e4
LT
1016 } else {
1017 list_add_tail(&notify->list, &snd_pcm_notify_list);
f87135f5
CL
1018 list_for_each(p, &snd_pcm_devices)
1019 notify->n_register(list_entry(p, struct snd_pcm, list));
1da177e4 1020 }
1a60d4c5 1021 mutex_unlock(&register_mutex);
1da177e4
LT
1022 return 0;
1023}
1024
e28563cc 1025#ifdef CONFIG_PROC_FS
1da177e4
LT
1026/*
1027 * Info interface
1028 */
1029
877211f5
TI
1030static void snd_pcm_proc_read(struct snd_info_entry *entry,
1031 struct snd_info_buffer *buffer)
1da177e4 1032{
f87135f5 1033 struct list_head *p;
877211f5 1034 struct snd_pcm *pcm;
1da177e4 1035
1a60d4c5 1036 mutex_lock(&register_mutex);
f87135f5
CL
1037 list_for_each(p, &snd_pcm_devices) {
1038 pcm = list_entry(p, struct snd_pcm, list);
1039 snd_iprintf(buffer, "%02i-%02i: %s : %s",
1040 pcm->card->number, pcm->device, pcm->id, pcm->name);
1da177e4 1041 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream)
877211f5
TI
1042 snd_iprintf(buffer, " : playback %i",
1043 pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream_count);
1da177e4 1044 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream)
877211f5
TI
1045 snd_iprintf(buffer, " : capture %i",
1046 pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream_count);
1da177e4
LT
1047 snd_iprintf(buffer, "\n");
1048 }
1a60d4c5 1049 mutex_unlock(&register_mutex);
1da177e4
LT
1050}
1051
877211f5 1052static struct snd_info_entry *snd_pcm_proc_entry = NULL;
1da177e4 1053
e28563cc 1054static void snd_pcm_proc_init(void)
1da177e4 1055{
877211f5 1056 struct snd_info_entry *entry;
1da177e4 1057
1da177e4 1058 if ((entry = snd_info_create_module_entry(THIS_MODULE, "pcm", NULL)) != NULL) {
877211f5
TI
1059 snd_info_set_text_ops(entry, NULL, SNDRV_CARDS * SNDRV_PCM_DEVICES * 128,
1060 snd_pcm_proc_read);
1da177e4
LT
1061 if (snd_info_register(entry) < 0) {
1062 snd_info_free_entry(entry);
1063 entry = NULL;
1064 }
1065 }
1066 snd_pcm_proc_entry = entry;
e28563cc
TI
1067}
1068
1069static void snd_pcm_proc_done(void)
1070{
1071 if (snd_pcm_proc_entry)
1072 snd_info_unregister(snd_pcm_proc_entry);
1073}
1074
1075#else /* !CONFIG_PROC_FS */
1076#define snd_pcm_proc_init()
1077#define snd_pcm_proc_done()
1078#endif /* CONFIG_PROC_FS */
1079
1080
1081/*
1082 * ENTRY functions
1083 */
1084
1085static int __init alsa_pcm_init(void)
1086{
1087 snd_ctl_register_ioctl(snd_pcm_control_ioctl);
1088 snd_ctl_register_ioctl_compat(snd_pcm_control_ioctl);
1089 snd_pcm_proc_init();
1da177e4
LT
1090 return 0;
1091}
1092
1093static void __exit alsa_pcm_exit(void)
1094{
1095 snd_ctl_unregister_ioctl(snd_pcm_control_ioctl);
1096 snd_ctl_unregister_ioctl_compat(snd_pcm_control_ioctl);
e28563cc 1097 snd_pcm_proc_done();
1da177e4
LT
1098}
1099
1100module_init(alsa_pcm_init)
1101module_exit(alsa_pcm_exit)
1102
1da177e4
LT
1103EXPORT_SYMBOL(snd_pcm_new);
1104EXPORT_SYMBOL(snd_pcm_new_stream);
1105EXPORT_SYMBOL(snd_pcm_notify);
1106EXPORT_SYMBOL(snd_pcm_open_substream);
1107EXPORT_SYMBOL(snd_pcm_release_substream);
1da177e4
LT
1108 /* pcm_native.c */
1109EXPORT_SYMBOL(snd_pcm_link_rwlock);
1da177e4
LT
1110#ifdef CONFIG_PM
1111EXPORT_SYMBOL(snd_pcm_suspend);
1112EXPORT_SYMBOL(snd_pcm_suspend_all);
1113#endif
1da177e4
LT
1114EXPORT_SYMBOL(snd_pcm_kernel_ioctl);
1115EXPORT_SYMBOL(snd_pcm_mmap_data);
1116#if SNDRV_PCM_INFO_MMAP_IOMEM
1117EXPORT_SYMBOL(snd_pcm_lib_mmap_iomem);
1118#endif
1119 /* pcm_misc.c */
1120EXPORT_SYMBOL(snd_pcm_format_signed);
1121EXPORT_SYMBOL(snd_pcm_format_unsigned);
1122EXPORT_SYMBOL(snd_pcm_format_linear);
1123EXPORT_SYMBOL(snd_pcm_format_little_endian);
1124EXPORT_SYMBOL(snd_pcm_format_big_endian);
1125EXPORT_SYMBOL(snd_pcm_format_width);
1126EXPORT_SYMBOL(snd_pcm_format_physical_width);
9502dcad 1127EXPORT_SYMBOL(snd_pcm_format_size);
1da177e4
LT
1128EXPORT_SYMBOL(snd_pcm_format_silence_64);
1129EXPORT_SYMBOL(snd_pcm_format_set_silence);
1130EXPORT_SYMBOL(snd_pcm_build_linear_format);
1131EXPORT_SYMBOL(snd_pcm_limit_hw_rates);
This page took 0.370488 seconds and 5 git commands to generate.