Lines Matching refs:pcm

42 static int snd_pcm_free(struct snd_pcm *pcm);
49 struct snd_pcm *pcm; in snd_pcm_get() local
51 list_for_each_entry(pcm, &snd_pcm_devices, list) { in snd_pcm_get()
52 if (pcm->card == card && pcm->device == device) in snd_pcm_get()
53 return pcm; in snd_pcm_get()
60 struct snd_pcm *pcm; in snd_pcm_next() local
62 list_for_each_entry(pcm, &snd_pcm_devices, list) { in snd_pcm_next()
63 if (pcm->card == card && pcm->device > device) in snd_pcm_next()
64 return pcm->device; in snd_pcm_next()
65 else if (pcm->card->number > card->number) in snd_pcm_next()
73 struct snd_pcm *pcm; in snd_pcm_add() local
78 list_for_each_entry(pcm, &snd_pcm_devices, list) { in snd_pcm_add()
79 if (pcm->card == newpcm->card && pcm->device == newpcm->device) in snd_pcm_add()
81 if (pcm->card->number > newpcm->card->number || in snd_pcm_add()
82 (pcm->card == newpcm->card && in snd_pcm_add()
83 pcm->device > newpcm->device)) { in snd_pcm_add()
84 list_add(&newpcm->list, pcm->list.prev); in snd_pcm_add()
115 struct snd_pcm *pcm; in snd_pcm_control_ioctl() local
130 pcm = snd_pcm_get(card, device); in snd_pcm_control_ioctl()
131 if (pcm == NULL) { in snd_pcm_control_ioctl()
135 pstr = &pcm->streams[stream]; in snd_pcm_control_ioctl()
388 mutex_lock(&substream->pcm->open_mutex); in snd_pcm_substream_proc_hw_params_read()
416 mutex_unlock(&substream->pcm->open_mutex); in snd_pcm_substream_proc_hw_params_read()
425 mutex_lock(&substream->pcm->open_mutex); in snd_pcm_substream_proc_sw_params_read()
444 mutex_unlock(&substream->pcm->open_mutex); in snd_pcm_substream_proc_sw_params_read()
455 mutex_lock(&substream->pcm->open_mutex); in snd_pcm_substream_proc_status_read()
480 mutex_unlock(&substream->pcm->open_mutex); in snd_pcm_substream_proc_status_read()
516 struct snd_pcm *pcm = pstr->pcm; in snd_pcm_stream_proc_init() local
520 sprintf(name, "pcm%i%c", pcm->device, in snd_pcm_stream_proc_init()
522 if ((entry = snd_info_create_card_entry(pcm->card, name, pcm->card->proc_root)) == NULL) in snd_pcm_stream_proc_init()
531 if ((entry = snd_info_create_card_entry(pcm->card, "info", pstr->proc_root)) != NULL) { in snd_pcm_stream_proc_init()
541 if ((entry = snd_info_create_card_entry(pcm->card, "xrun_debug", in snd_pcm_stream_proc_init()
576 card = substream->pcm->card; in snd_pcm_substream_proc_init()
687 int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count) in snd_pcm_new_stream() argument
690 struct snd_pcm_str *pstr = &pcm->streams[stream]; in snd_pcm_new_stream()
697 pstr->pcm = pcm; in snd_pcm_new_stream()
702 snd_device_initialize(&pstr->dev, pcm->card); in snd_pcm_new_stream()
704 dev_set_name(&pstr->dev, "pcmC%iD%i%c", pcm->card->number, pcm->device, in snd_pcm_new_stream()
707 if (!pcm->internal) { in snd_pcm_new_stream()
710 pcm_err(pcm, "Error in snd_pcm_stream_proc_init\n"); in snd_pcm_new_stream()
719 substream->pcm = pcm; in snd_pcm_new_stream()
730 if (!pcm->internal) { in snd_pcm_new_stream()
733 pcm_err(pcm, in snd_pcm_new_stream()
759 struct snd_pcm *pcm; in _snd_pcm_new() local
771 pcm = kzalloc(sizeof(*pcm), GFP_KERNEL); in _snd_pcm_new()
772 if (!pcm) in _snd_pcm_new()
774 pcm->card = card; in _snd_pcm_new()
775 pcm->device = device; in _snd_pcm_new()
776 pcm->internal = internal; in _snd_pcm_new()
777 mutex_init(&pcm->open_mutex); in _snd_pcm_new()
778 init_waitqueue_head(&pcm->open_wait); in _snd_pcm_new()
779 INIT_LIST_HEAD(&pcm->list); in _snd_pcm_new()
781 strlcpy(pcm->id, id, sizeof(pcm->id)); in _snd_pcm_new()
782 if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK, playback_count)) < 0) { in _snd_pcm_new()
783 snd_pcm_free(pcm); in _snd_pcm_new()
786 if ((err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, capture_count)) < 0) { in _snd_pcm_new()
787 snd_pcm_free(pcm); in _snd_pcm_new()
790 if ((err = snd_device_new(card, SNDRV_DEV_PCM, pcm, &ops)) < 0) { in _snd_pcm_new()
791 snd_pcm_free(pcm); in _snd_pcm_new()
795 *rpcm = pcm; in _snd_pcm_new()
878 static int snd_pcm_free(struct snd_pcm *pcm) in snd_pcm_free() argument
882 if (!pcm) in snd_pcm_free()
884 if (!pcm->internal) { in snd_pcm_free()
886 notify->n_unregister(pcm); in snd_pcm_free()
888 if (pcm->private_free) in snd_pcm_free()
889 pcm->private_free(pcm); in snd_pcm_free()
890 snd_pcm_lib_preallocate_free_for_all(pcm); in snd_pcm_free()
891 snd_pcm_free_stream(&pcm->streams[SNDRV_PCM_STREAM_PLAYBACK]); in snd_pcm_free()
892 snd_pcm_free_stream(&pcm->streams[SNDRV_PCM_STREAM_CAPTURE]); in snd_pcm_free()
893 kfree(pcm); in snd_pcm_free()
899 struct snd_pcm *pcm = device->device_data; in snd_pcm_dev_free() local
900 return snd_pcm_free(pcm); in snd_pcm_dev_free()
903 int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream, in snd_pcm_attach_substream() argument
914 if (snd_BUG_ON(!pcm || !rsubstream)) in snd_pcm_attach_substream()
920 pstr = &pcm->streams[stream]; in snd_pcm_attach_substream()
924 card = pcm->card; in snd_pcm_attach_substream()
927 if (pcm->info_flags & SNDRV_PCM_INFO_HALF_DUPLEX) { in snd_pcm_attach_substream()
930 for (substream = pcm->streams[opposite].substream; substream; in snd_pcm_attach_substream()
994 substream->private_data = pcm->private_data; in snd_pcm_attach_substream()
1031 struct snd_pcm *pcm = pstr->pcm; in show_pcm_class() local
1040 if (pcm->dev_class > SNDRV_PCM_CLASS_LAST) in show_pcm_class()
1043 str = strs[pcm->dev_class]; in show_pcm_class()
1067 struct snd_pcm *pcm; in snd_pcm_dev_register() local
1071 pcm = device->device_data; in snd_pcm_dev_register()
1072 if (pcm->internal) in snd_pcm_dev_register()
1076 err = snd_pcm_add(pcm); in snd_pcm_dev_register()
1081 if (pcm->streams[cidx].substream == NULL) in snd_pcm_dev_register()
1092 err = snd_register_device(devtype, pcm->card, pcm->device, in snd_pcm_dev_register()
1093 &snd_pcm_f_ops[cidx], pcm, in snd_pcm_dev_register()
1094 &pcm->streams[cidx].dev); in snd_pcm_dev_register()
1096 list_del_init(&pcm->list); in snd_pcm_dev_register()
1100 for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) in snd_pcm_dev_register()
1105 notify->n_register(pcm); in snd_pcm_dev_register()
1114 struct snd_pcm *pcm = device->device_data; in snd_pcm_dev_disconnect() local
1120 mutex_lock(&pcm->open_mutex); in snd_pcm_dev_disconnect()
1121 wake_up(&pcm->open_wait); in snd_pcm_dev_disconnect()
1122 list_del_init(&pcm->list); in snd_pcm_dev_disconnect()
1124 for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) { in snd_pcm_dev_disconnect()
1134 if (!pcm->internal) { in snd_pcm_dev_disconnect()
1136 notify->n_disconnect(pcm); in snd_pcm_dev_disconnect()
1139 if (!pcm->internal) in snd_pcm_dev_disconnect()
1140 snd_unregister_device(&pcm->streams[cidx].dev); in snd_pcm_dev_disconnect()
1141 if (pcm->streams[cidx].chmap_kctl) { in snd_pcm_dev_disconnect()
1142 snd_ctl_remove(pcm->card, pcm->streams[cidx].chmap_kctl); in snd_pcm_dev_disconnect()
1143 pcm->streams[cidx].chmap_kctl = NULL; in snd_pcm_dev_disconnect()
1146 mutex_unlock(&pcm->open_mutex); in snd_pcm_dev_disconnect()
1162 struct snd_pcm *pcm; in snd_pcm_notify() local
1172 list_for_each_entry(pcm, &snd_pcm_devices, list) in snd_pcm_notify()
1173 notify->n_unregister(pcm); in snd_pcm_notify()
1176 list_for_each_entry(pcm, &snd_pcm_devices, list) in snd_pcm_notify()
1177 notify->n_register(pcm); in snd_pcm_notify()
1192 struct snd_pcm *pcm; in snd_pcm_proc_read() local
1195 list_for_each_entry(pcm, &snd_pcm_devices, list) { in snd_pcm_proc_read()
1197 pcm->card->number, pcm->device, pcm->id, pcm->name); in snd_pcm_proc_read()
1198 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) in snd_pcm_proc_read()
1200 pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream_count); in snd_pcm_proc_read()
1201 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) in snd_pcm_proc_read()
1203 pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream_count); in snd_pcm_proc_read()