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);
383 mutex_lock(&substream->pcm->open_mutex);
411 mutex_unlock(&substream->pcm->open_mutex);
420 mutex_lock(&substream->pcm->open_mutex);
439 mutex_unlock(&substream->pcm->open_mutex);
450 mutex_lock(&substream->pcm->open_mutex);
475 mutex_unlock(&substream->pcm->open_mutex);
506 struct snd_pcm *pcm = pstr->pcm;
510 sprintf(name, "pcm%i%c", pcm->device,
512 entry = snd_info_create_card_entry(pcm->card, name,
513 pcm->card->proc_root);
518 entry = snd_info_create_card_entry(pcm->card, "info", pstr->proc_root);
522 entry = snd_info_create_card_entry(pcm->card, "xrun_debug",
548 entry = snd_info_create_card_entry(substream->pcm->card, name,
561 card = substream->pcm->card;
608 if (!pstr->pcm->no_device_suspend)
609 snd_pcm_suspend_all(pstr->pcm);
620 .name = "pcm",
626 * @pcm: the pcm instance
630 * Creates a new stream for the pcm.
631 * The corresponding stream on the pcm must have been empty before
637 int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count)
640 struct snd_pcm_str *pstr = &pcm->streams[stream];
647 pstr->pcm = pcm;
652 snd_device_initialize(&pstr->dev, pcm->card);
655 dev_set_name(&pstr->dev, "pcmC%iD%i%c", pcm->card->number, pcm->device,
658 if (!pcm->internal) {
661 pcm_err(pcm, "Error in snd_pcm_stream_proc_init\n");
670 substream->pcm = pcm;
681 if (!pcm->internal) {
684 pcm_err(pcm,
708 struct snd_pcm *pcm;
723 pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
724 if (!pcm)
726 pcm->card = card;
727 pcm->device = device;
728 pcm->internal = internal;
729 mutex_init(&pcm->open_mutex);
730 init_waitqueue_head(&pcm->open_wait);
731 INIT_LIST_HEAD(&pcm->list);
733 strlcpy(pcm->id, id, sizeof(pcm->id));
735 err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK,
740 err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, capture_count);
744 err = snd_device_new(card, SNDRV_DEV_PCM, pcm,
750 *rpcm = pcm;
754 snd_pcm_free(pcm);
765 * @rpcm: the pointer to store the new pcm instance
769 * The pcm operators have to be set afterwards to the new instance
789 * @rpcm: the pointer to store the new pcm instance
797 * The pcm operators have to be set afterwards to the new instance
814 struct snd_card *card = pstr->pcm->card;
853 #define pcm_call_notify(pcm, call) \
857 _notify->call(pcm); \
860 #define pcm_call_notify(pcm, call) do {} while (0)
863 static int snd_pcm_free(struct snd_pcm *pcm)
865 if (!pcm)
867 if (!pcm->internal)
868 pcm_call_notify(pcm, n_unregister);
869 if (pcm->private_free)
870 pcm->private_free(pcm);
871 snd_pcm_lib_preallocate_free_for_all(pcm);
872 snd_pcm_free_stream(&pcm->streams[SNDRV_PCM_STREAM_PLAYBACK]);
873 snd_pcm_free_stream(&pcm->streams[SNDRV_PCM_STREAM_CAPTURE]);
874 kfree(pcm);
880 struct snd_pcm *pcm = device->device_data;
881 return snd_pcm_free(pcm);
884 int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream,
895 if (snd_BUG_ON(!pcm || !rsubstream))
901 pstr = &pcm->streams[stream];
905 card = pcm->card;
908 if (pcm->info_flags & SNDRV_PCM_INFO_HALF_DUPLEX) {
911 for (substream = pcm->streams[opposite].substream; substream;
977 substream->private_data = pcm->private_data;
1019 struct snd_pcm *pcm = pstr->pcm;
1028 if (pcm->dev_class > SNDRV_PCM_CLASS_LAST)
1031 str = strs[pcm->dev_class];
1054 struct snd_pcm *pcm;
1058 pcm = device->device_data;
1061 err = snd_pcm_add(pcm);
1066 if (pcm->streams[cidx].substream == NULL)
1076 /* register pcm */
1077 err = snd_register_device(devtype, pcm->card, pcm->device,
1078 &snd_pcm_f_ops[cidx], pcm,
1079 &pcm->streams[cidx].dev);
1081 list_del_init(&pcm->list);
1085 for (substream = pcm->streams[cidx].substream; substream; substream = substream->next)
1089 pcm_call_notify(pcm, n_register);
1098 struct snd_pcm *pcm = device->device_data;
1103 mutex_lock(&pcm->open_mutex);
1104 wake_up(&pcm->open_wait);
1105 list_del_init(&pcm->list);
1107 for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) {
1123 for (substream = pcm->streams[cidx].substream; substream; substream = substream->next)
1126 pcm_call_notify(pcm, n_disconnect);
1128 snd_unregister_device(&pcm->streams[cidx].dev);
1129 free_chmap(&pcm->streams[cidx]);
1131 mutex_unlock(&pcm->open_mutex);
1148 struct snd_pcm *pcm;
1158 list_for_each_entry(pcm, &snd_pcm_devices, list)
1159 notify->n_unregister(pcm);
1162 list_for_each_entry(pcm, &snd_pcm_devices, list)
1163 notify->n_register(pcm);
1179 struct snd_pcm *pcm;
1182 list_for_each_entry(pcm, &snd_pcm_devices, list) {
1184 pcm->card->number, pcm->device, pcm->id, pcm->name);
1185 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream)
1187 pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream_count);
1188 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream)
1190 pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream_count);
1202 entry = snd_info_create_module_entry(THIS_MODULE, "pcm", NULL);