Lines Matching refs:pcm

16 #include <sound/pcm.h>
33 static int snd_pcm_free(struct snd_pcm *pcm);
40 struct snd_pcm *pcm;
42 list_for_each_entry(pcm, &snd_pcm_devices, list) {
43 if (pcm->card == card && pcm->device == device)
44 return pcm;
51 struct snd_pcm *pcm;
53 list_for_each_entry(pcm, &snd_pcm_devices, list) {
54 if (pcm->card == card && pcm->device > device)
55 return pcm->device;
56 else if (pcm->card->number > card->number)
64 struct snd_pcm *pcm;
69 list_for_each_entry(pcm, &snd_pcm_devices, list) {
70 if (pcm->card == newpcm->card && pcm->device == newpcm->device)
72 if (pcm->card->number > newpcm->card->number ||
73 (pcm->card == newpcm->card &&
74 pcm->device > newpcm->device)) {
75 list_add(&newpcm->list, pcm->list.prev);
106 struct snd_pcm *pcm;
122 pcm = snd_pcm_get(card, device);
123 if (pcm == NULL) {
127 pstr = &pcm->streams[stream];
144 mutex_lock(&pcm->open_mutex);
146 mutex_unlock(&pcm->open_mutex);
385 mutex_lock(&substream->pcm->open_mutex);
413 mutex_unlock(&substream->pcm->open_mutex);
422 mutex_lock(&substream->pcm->open_mutex);
441 mutex_unlock(&substream->pcm->open_mutex);
452 mutex_lock(&substream->pcm->open_mutex);
477 mutex_unlock(&substream->pcm->open_mutex);
508 struct snd_pcm *pcm = pstr->pcm;
512 sprintf(name, "pcm%i%c", pcm->device,
514 entry = snd_info_create_card_entry(pcm->card, name,
515 pcm->card->proc_root);
520 entry = snd_info_create_card_entry(pcm->card, "info", pstr->proc_root);
524 entry = snd_info_create_card_entry(pcm->card, "xrun_debug",
550 entry = snd_info_create_card_entry(substream->pcm->card, name,
563 card = substream->pcm->card;
610 if (!pstr->pcm->no_device_suspend)
611 snd_pcm_suspend_all(pstr->pcm);
622 .name = "pcm",
628 * @pcm: the pcm instance
632 * Creates a new stream for the pcm.
633 * The corresponding stream on the pcm must have been empty before
639 int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count)
642 struct snd_pcm_str *pstr = &pcm->streams[stream];
649 pstr->pcm = pcm;
654 err = snd_device_alloc(&pstr->dev, pcm->card);
657 dev_set_name(pstr->dev, "pcmC%iD%i%c", pcm->card->number, pcm->device,
663 if (!pcm->internal) {
666 pcm_err(pcm, "Error in snd_pcm_stream_proc_init\n");
675 substream->pcm = pcm;
686 if (!pcm->internal) {
689 pcm_err(pcm,
713 struct snd_pcm *pcm;
728 pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
729 if (!pcm)
731 pcm->card = card;
732 pcm->device = device;
733 pcm->internal = internal;
734 mutex_init(&pcm->open_mutex);
735 init_waitqueue_head(&pcm->open_wait);
736 INIT_LIST_HEAD(&pcm->list);
738 strscpy(pcm->id, id, sizeof(pcm->id));
740 err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK,
745 err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, capture_count);
749 err = snd_device_new(card, SNDRV_DEV_PCM, pcm,
755 *rpcm = pcm;
759 snd_pcm_free(pcm);
770 * @rpcm: the pointer to store the new pcm instance
774 * The pcm operators have to be set afterwards to the new instance
794 * @rpcm: the pointer to store the new pcm instance
802 * The pcm operators have to be set afterwards to the new instance
819 struct snd_card *card = pstr->pcm->card;
856 #define pcm_call_notify(pcm, call) \
860 _notify->call(pcm); \
863 #define pcm_call_notify(pcm, call) do {} while (0)
866 static int snd_pcm_free(struct snd_pcm *pcm)
868 if (!pcm)
870 if (!pcm->internal)
871 pcm_call_notify(pcm, n_unregister);
872 if (pcm->private_free)
873 pcm->private_free(pcm);
874 snd_pcm_lib_preallocate_free_for_all(pcm);
875 snd_pcm_free_stream(&pcm->streams[SNDRV_PCM_STREAM_PLAYBACK]);
876 snd_pcm_free_stream(&pcm->streams[SNDRV_PCM_STREAM_CAPTURE]);
877 kfree(pcm);
883 struct snd_pcm *pcm = device->device_data;
884 return snd_pcm_free(pcm);
887 int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
898 if (snd_BUG_ON(!pcm || !rsubstream))
904 pstr = &pcm->streams[stream];
908 card = pcm->card;
911 if (pcm->info_flags & SNDRV_PCM_INFO_HALF_DUPLEX) {
914 for (substream = pcm->streams[opposite].substream; substream;
980 substream->private_data = pcm->private_data;
1023 struct snd_pcm *pcm = pstr->pcm;
1032 if (pcm->dev_class > SNDRV_PCM_CLASS_LAST)
1035 str = strs[pcm->dev_class];
1058 struct snd_pcm *pcm;
1062 pcm = device->device_data;
1065 err = snd_pcm_add(pcm);
1070 if (pcm->streams[cidx].substream == NULL)
1080 /* register pcm */
1081 err = snd_register_device(devtype, pcm->card, pcm->device,
1082 &snd_pcm_f_ops[cidx], pcm,
1083 pcm->streams[cidx].dev);
1085 list_del_init(&pcm->list);
1089 for (substream = pcm->streams[cidx].substream; substream; substream = substream->next)
1093 pcm_call_notify(pcm, n_register);
1102 struct snd_pcm *pcm = device->device_data;
1107 mutex_lock(&pcm->open_mutex);
1108 wake_up(&pcm->open_wait);
1109 list_del_init(&pcm->list);
1111 for_each_pcm_substream(pcm, cidx, substream) {
1125 for_each_pcm_substream(pcm, cidx, substream)
1128 pcm_call_notify(pcm, n_disconnect);
1130 if (pcm->streams[cidx].dev)
1131 snd_unregister_device(pcm->streams[cidx].dev);
1132 free_chmap(&pcm->streams[cidx]);
1134 mutex_unlock(&pcm->open_mutex);
1153 struct snd_pcm *pcm;
1163 list_for_each_entry(pcm, &snd_pcm_devices, list)
1164 notify->n_unregister(pcm);
1167 list_for_each_entry(pcm, &snd_pcm_devices, list)
1168 notify->n_register(pcm);
1184 struct snd_pcm *pcm;
1187 list_for_each_entry(pcm, &snd_pcm_devices, list) {
1189 pcm->card->number, pcm->device, pcm->id, pcm->name);
1190 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream)
1192 pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream_count);
1193 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream)
1195 pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream_count);
1207 entry = snd_info_create_module_entry(THIS_MODULE, "pcm", NULL);