• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/src/linux/linux-2.6/sound/core/

Lines Matching refs:rmidi

228 	struct snd_rawmidi *rmidi;
237 rmidi = snd_rawmidi_search(card, device);
239 if (rmidi == NULL) {
243 if (!try_module_get(rmidi->card->module)) {
248 mutex_lock(&rmidi->open_mutex);
250 if (!(rmidi->info_flags & SNDRV_RAWMIDI_INFO_INPUT)) {
254 if (subdevice >= 0 && (unsigned int)subdevice >= rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substream_count) {
258 if (rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substream_opened >=
259 rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substream_count) {
265 if (!(rmidi->info_flags & SNDRV_RAWMIDI_INFO_OUTPUT)) {
269 if (subdevice >= 0 && (unsigned int)subdevice >= rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substream_count) {
273 if (rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substream_opened >=
274 rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substream_count) {
279 list1 = rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substreams.next;
281 if (list1 == &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substreams) {
297 list2 = rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams.next;
299 if (list2 == &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams) {
329 rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substream_opened++;
353 rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substream_opened++;
358 mutex_unlock(&rmidi->open_mutex);
360 rfile->rmidi = rmidi;
371 module_put(rmidi->card->module);
373 mutex_unlock(&rmidi->open_mutex);
385 struct snd_rawmidi *rmidi;
391 rmidi = snd_lookup_minor_data(iminor(inode),
395 rmidi = snd_lookup_oss_minor_data(iminor(inode),
401 if (rmidi == NULL)
405 card = rmidi->card;
419 add_wait_queue(&rmidi->open_wait, &wait);
420 mutex_lock(&rmidi->open_mutex);
432 err = snd_rawmidi_kernel_open(rmidi->card, rmidi->device,
444 mutex_unlock(&rmidi->open_mutex);
446 mutex_lock(&rmidi->open_mutex);
458 remove_wait_queue(&rmidi->open_wait, &wait);
465 mutex_unlock(&rmidi->open_mutex);
471 struct snd_rawmidi *rmidi;
477 rmidi = rfile->rmidi;
478 mutex_lock(&rmidi->open_mutex);
489 rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substream_opened--;
510 rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substream_opened--;
512 mutex_unlock(&rmidi->open_mutex);
513 module_put(rmidi->card->module);
520 struct snd_rawmidi *rmidi;
525 rmidi = rfile->rmidi;
526 wake_up(&rmidi->open_wait);
528 snd_card_file_remove(rmidi->card, file);
535 struct snd_rawmidi *rmidi;
539 rmidi = substream->rmidi;
541 info->card = rmidi->card->number;
542 info->device = rmidi->device;
545 info->flags = rmidi->info_flags;
546 strcpy(info->id, rmidi->id);
547 strcpy(info->name, rmidi->name);
569 struct snd_rawmidi *rmidi;
574 rmidi = snd_rawmidi_search(card, info->device);
576 if (!rmidi)
580 pstr = &rmidi->streams[info->stream];
1305 struct snd_rawmidi *rmidi;
1309 rmidi = entry->private_data;
1310 snd_iprintf(buffer, "%s\n\n", rmidi->name);
1311 mutex_lock(&rmidi->open_mutex);
1312 if (rmidi->info_flags & SNDRV_RAWMIDI_INFO_OUTPUT) {
1314 &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams,
1333 if (rmidi->info_flags & SNDRV_RAWMIDI_INFO_INPUT) {
1335 &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substreams,
1354 mutex_unlock(&rmidi->open_mutex);
1373 static int snd_rawmidi_alloc_substreams(struct snd_rawmidi *rmidi,
1389 substream->rmidi = rmidi;
1415 struct snd_rawmidi *rmidi;
1426 rmidi = kzalloc(sizeof(*rmidi), GFP_KERNEL);
1427 if (rmidi == NULL) {
1431 rmidi->card = card;
1432 rmidi->device = device;
1433 mutex_init(&rmidi->open_mutex);
1434 init_waitqueue_head(&rmidi->open_wait);
1435 INIT_LIST_HEAD(&rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substreams);
1436 INIT_LIST_HEAD(&rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams);
1439 strlcpy(rmidi->id, id, sizeof(rmidi->id));
1440 if ((err = snd_rawmidi_alloc_substreams(rmidi,
1441 &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT],
1444 snd_rawmidi_free(rmidi);
1447 if ((err = snd_rawmidi_alloc_substreams(rmidi,
1448 &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT],
1451 snd_rawmidi_free(rmidi);
1454 if ((err = snd_device_new(card, SNDRV_DEV_RAWMIDI, rmidi, &ops)) < 0) {
1455 snd_rawmidi_free(rmidi);
1458 *rrawmidi = rmidi;
1473 static int snd_rawmidi_free(struct snd_rawmidi *rmidi)
1475 snd_assert(rmidi != NULL, return -ENXIO);
1477 snd_info_free_entry(rmidi->proc_entry);
1478 rmidi->proc_entry = NULL;
1480 if (rmidi->ops && rmidi->ops->dev_unregister)
1481 rmidi->ops->dev_unregister(rmidi);
1484 snd_rawmidi_free_substreams(&rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT]);
1485 snd_rawmidi_free_substreams(&rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT]);
1486 if (rmidi->private_free)
1487 rmidi->private_free(rmidi);
1488 kfree(rmidi);
1494 struct snd_rawmidi *rmidi = device->device_data;
1495 return snd_rawmidi_free(rmidi);
1502 struct snd_rawmidi *rmidi = device->private_data;
1503 rmidi->seq_dev = NULL;
1512 struct snd_rawmidi *rmidi = device->device_data;
1514 if (rmidi->device >= SNDRV_RAWMIDI_DEVICES)
1517 if (snd_rawmidi_search(rmidi->card, rmidi->device)) {
1521 list_add_tail(&rmidi->list, &snd_rawmidi_devices);
1522 sprintf(name, "midiC%iD%i", rmidi->card->number, rmidi->device);
1524 rmidi->card, rmidi->device,
1525 &snd_rawmidi_f_ops, rmidi, name)) < 0) {
1526 snd_printk(KERN_ERR "unable to register rawmidi device %i:%i\n", rmidi->card->number, rmidi->device);
1527 list_del(&rmidi->list);
1531 if (rmidi->ops && rmidi->ops->dev_register &&
1532 (err = rmidi->ops->dev_register(rmidi)) < 0) {
1533 snd_unregister_device(SNDRV_DEVICE_TYPE_RAWMIDI, rmidi->card, rmidi->device);
1534 list_del(&rmidi->list);
1539 rmidi->ossreg = 0;
1540 if ((int)rmidi->device == midi_map[rmidi->card->number]) {
1542 rmidi->card, 0, &snd_rawmidi_f_ops,
1543 rmidi, name) < 0) {
1544 snd_printk(KERN_ERR "unable to register OSS rawmidi device %i:%i\n", rmidi->card->number, 0);
1546 rmidi->ossreg++;
1548 snd_oss_info_register(SNDRV_OSS_INFO_DEV_MIDI, rmidi->card->number, rmidi->name);
1552 if ((int)rmidi->device == amidi_map[rmidi->card->number]) {
1554 rmidi->card, 1, &snd_rawmidi_f_ops,
1555 rmidi, name) < 0) {
1556 snd_printk(KERN_ERR "unable to register OSS rawmidi device %i:%i\n", rmidi->card->number, 1);
1558 rmidi->ossreg++;
1563 sprintf(name, "midi%d", rmidi->device);
1564 entry = snd_info_create_card_entry(rmidi->card, name, rmidi->card->proc_root);
1566 entry->private_data = rmidi;
1573 rmidi->proc_entry = entry;
1576 if (!rmidi->ops || !rmidi->ops->dev_register) { /* own registration mechanism */
1577 if (snd_seq_device_new(rmidi->card, rmidi->device, SNDRV_SEQ_DEV_ID_MIDISYNTH, 0, &rmidi->seq_dev) >= 0) {
1578 rmidi->seq_dev->private_data = rmidi;
1579 rmidi->seq_dev->private_free = snd_rawmidi_dev_seq_free;
1580 sprintf(rmidi->seq_dev->name, "MIDI %d-%d", rmidi->card->number, rmidi->device);
1581 snd_device_register(rmidi->card, rmidi->seq_dev);
1590 struct snd_rawmidi *rmidi = device->device_data;
1593 list_del_init(&rmidi->list);
1595 if (rmidi->ossreg) {
1596 if ((int)rmidi->device == midi_map[rmidi->card->number]) {
1597 snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_MIDI, rmidi->card, 0);
1599 snd_oss_info_unregister(SNDRV_OSS_INFO_DEV_MIDI, rmidi->card->number);
1602 if ((int)rmidi->device == amidi_map[rmidi->card->number])
1603 snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_MIDI, rmidi->card, 1);
1604 rmidi->ossreg = 0;
1607 snd_unregister_device(SNDRV_DEVICE_TYPE_RAWMIDI, rmidi->card, rmidi->device);
1614 * @rmidi: the rawmidi instance
1620 void snd_rawmidi_set_ops(struct snd_rawmidi *rmidi, int stream,
1625 list_for_each_entry(substream, &rmidi->streams[stream].substreams, list)