Lines Matching defs: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);
105 struct snd_pcm *pcm;
120 pcm = snd_pcm_get(card, device);
121 if (pcm == NULL)
123 pstr = &pcm->streams[stream];
134 guard(mutex)(&pcm->open_mutex);
378 guard(mutex)(&substream->pcm->open_mutex);
413 guard(mutex)(&substream->pcm->open_mutex);
441 guard(mutex)(&substream->pcm->open_mutex);
498 struct snd_pcm *pcm = pstr->pcm;
502 sprintf(name, "pcm%i%c", pcm->device,
504 entry = snd_info_create_card_entry(pcm->card, name,
505 pcm->card->proc_root);
510 entry = snd_info_create_card_entry(pcm->card, "info", pstr->proc_root);
514 entry = snd_info_create_card_entry(pcm->card, "xrun_debug",
540 entry = snd_info_create_card_entry(substream->pcm->card, name,
553 card = substream->pcm->card;
599 if (!pstr->pcm->no_device_suspend)
600 snd_pcm_suspend_all(pstr->pcm);
610 .name = "pcm",
616 * @pcm: the pcm instance
620 * Creates a new stream for the pcm.
621 * The corresponding stream on the pcm must have been empty before
627 int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count)
630 struct snd_pcm_str *pstr = &pcm->streams[stream];
637 pstr->pcm = pcm;
642 err = snd_device_alloc(&pstr->dev, pcm->card);
645 dev_set_name(pstr->dev, "pcmC%iD%i%c", pcm->card->number, pcm->device,
651 if (!pcm->internal) {
654 pcm_err(pcm, "Error in snd_pcm_stream_proc_init\n");
663 substream->pcm = pcm;
674 if (!pcm->internal) {
677 pcm_err(pcm,
701 struct snd_pcm *pcm;
716 pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
717 if (!pcm)
719 pcm->card = card;
720 pcm->device = device;
721 pcm->internal = internal;
722 mutex_init(&pcm->open_mutex);
723 init_waitqueue_head(&pcm->open_wait);
724 INIT_LIST_HEAD(&pcm->list);
726 strscpy(pcm->id, id, sizeof(pcm->id));
728 err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK,
733 err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, capture_count);
737 err = snd_device_new(card, SNDRV_DEV_PCM, pcm,
743 *rpcm = pcm;
747 snd_pcm_free(pcm);
758 * @rpcm: the pointer to store the new pcm instance
762 * The pcm operators have to be set afterwards to the new instance
782 * @rpcm: the pointer to store the new pcm instance
790 * The pcm operators have to be set afterwards to the new instance
807 struct snd_card *card = pstr->pcm->card;
844 #define pcm_call_notify(pcm, call) \
848 _notify->call(pcm); \
851 #define pcm_call_notify(pcm, call) do {} while (0)
854 static int snd_pcm_free(struct snd_pcm *pcm)
856 if (!pcm)
858 if (!pcm->internal)
859 pcm_call_notify(pcm, n_unregister);
860 if (pcm->private_free)
861 pcm->private_free(pcm);
862 snd_pcm_lib_preallocate_free_for_all(pcm);
863 snd_pcm_free_stream(&pcm->streams[SNDRV_PCM_STREAM_PLAYBACK]);
864 snd_pcm_free_stream(&pcm->streams[SNDRV_PCM_STREAM_CAPTURE]);
865 kfree(pcm);
871 struct snd_pcm *pcm = device->device_data;
872 return snd_pcm_free(pcm);
875 int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
886 if (snd_BUG_ON(!pcm || !rsubstream))
892 pstr = &pcm->streams[stream];
896 card = pcm->card;
899 if (pcm->info_flags & SNDRV_PCM_INFO_HALF_DUPLEX) {
902 for (substream = pcm->streams[opposite].substream; substream;
968 substream->private_data = pcm->private_data;
1013 struct snd_pcm *pcm = pstr->pcm;
1022 if (pcm->dev_class > SNDRV_PCM_CLASS_LAST)
1025 str = strs[pcm->dev_class];
1048 struct snd_pcm *pcm;
1052 pcm = device->device_data;
1055 err = snd_pcm_add(pcm);
1060 if (pcm->streams[cidx].substream == NULL)
1070 /* register pcm */
1071 err = snd_register_device(devtype, pcm->card, pcm->device,
1072 &snd_pcm_f_ops[cidx], pcm,
1073 pcm->streams[cidx].dev);
1075 list_del_init(&pcm->list);
1079 for (substream = pcm->streams[cidx].substream; substream; substream = substream->next)
1083 pcm_call_notify(pcm, n_register);
1089 struct snd_pcm *pcm = device->device_data;
1094 guard(mutex)(&pcm->open_mutex);
1095 wake_up(&pcm->open_wait);
1096 list_del_init(&pcm->list);
1098 for_each_pcm_substream(pcm, cidx, substream) {
1112 for_each_pcm_substream(pcm, cidx, substream)
1115 pcm_call_notify(pcm, n_disconnect);
1117 if (pcm->streams[cidx].dev)
1118 snd_unregister_device(pcm->streams[cidx].dev);
1119 free_chmap(&pcm->streams[cidx]);
1138 struct snd_pcm *pcm;
1148 list_for_each_entry(pcm, &snd_pcm_devices, list)
1149 notify->n_unregister(pcm);
1152 list_for_each_entry(pcm, &snd_pcm_devices, list)
1153 notify->n_register(pcm);
1168 struct snd_pcm *pcm;
1171 list_for_each_entry(pcm, &snd_pcm_devices, list) {
1173 pcm->card->number, pcm->device, pcm->id, pcm->name);
1174 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream)
1176 pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream_count);
1177 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream)
1179 pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream_count);
1190 entry = snd_info_create_module_entry(THIS_MODULE, "pcm", NULL);