Lines Matching refs:pcm
33 static int snd_pcm_free(struct snd_pcm *pcm);
40 struct snd_pcm *pcm; in snd_pcm_get() local
42 list_for_each_entry(pcm, &snd_pcm_devices, list) { in snd_pcm_get()
43 if (pcm->card == card && pcm->device == device) in snd_pcm_get()
44 return pcm; in snd_pcm_get()
51 struct snd_pcm *pcm; in snd_pcm_next() local
53 list_for_each_entry(pcm, &snd_pcm_devices, list) { in snd_pcm_next()
54 if (pcm->card == card && pcm->device > device) in snd_pcm_next()
55 return pcm->device; in snd_pcm_next()
56 else if (pcm->card->number > card->number) in snd_pcm_next()
64 struct snd_pcm *pcm; in snd_pcm_add() local
69 list_for_each_entry(pcm, &snd_pcm_devices, list) { in snd_pcm_add()
70 if (pcm->card == newpcm->card && pcm->device == newpcm->device) in snd_pcm_add()
72 if (pcm->card->number > newpcm->card->number || in snd_pcm_add()
73 (pcm->card == newpcm->card && in snd_pcm_add()
74 pcm->device > newpcm->device)) { in snd_pcm_add()
75 list_add(&newpcm->list, pcm->list.prev); in snd_pcm_add()
106 struct snd_pcm *pcm; in snd_pcm_control_ioctl() local
122 pcm = snd_pcm_get(card, device); in snd_pcm_control_ioctl()
123 if (pcm == NULL) { in snd_pcm_control_ioctl()
127 pstr = &pcm->streams[stream]; in snd_pcm_control_ioctl()
144 mutex_lock(&pcm->open_mutex); in snd_pcm_control_ioctl()
146 mutex_unlock(&pcm->open_mutex); in snd_pcm_control_ioctl()
382 mutex_lock(&substream->pcm->open_mutex); in snd_pcm_substream_proc_hw_params_read()
410 mutex_unlock(&substream->pcm->open_mutex); in snd_pcm_substream_proc_hw_params_read()
419 mutex_lock(&substream->pcm->open_mutex); in snd_pcm_substream_proc_sw_params_read()
438 mutex_unlock(&substream->pcm->open_mutex); in snd_pcm_substream_proc_sw_params_read()
449 mutex_lock(&substream->pcm->open_mutex); in snd_pcm_substream_proc_status_read()
474 mutex_unlock(&substream->pcm->open_mutex); in snd_pcm_substream_proc_status_read()
505 struct snd_pcm *pcm = pstr->pcm; in snd_pcm_stream_proc_init() local
509 sprintf(name, "pcm%i%c", pcm->device, in snd_pcm_stream_proc_init()
511 entry = snd_info_create_card_entry(pcm->card, name, in snd_pcm_stream_proc_init()
512 pcm->card->proc_root); in snd_pcm_stream_proc_init()
517 entry = snd_info_create_card_entry(pcm->card, "info", pstr->proc_root); in snd_pcm_stream_proc_init()
521 entry = snd_info_create_card_entry(pcm->card, "xrun_debug", in snd_pcm_stream_proc_init()
547 entry = snd_info_create_card_entry(substream->pcm->card, name, in create_substream_info_entry()
560 card = substream->pcm->card; in snd_pcm_substream_proc_init()
607 if (!pstr->pcm->no_device_suspend) in do_pcm_suspend()
608 snd_pcm_suspend_all(pstr->pcm); in do_pcm_suspend()
636 int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count) in snd_pcm_new_stream() argument
639 struct snd_pcm_str *pstr = &pcm->streams[stream]; in snd_pcm_new_stream()
646 pstr->pcm = pcm; in snd_pcm_new_stream()
651 snd_device_initialize(&pstr->dev, pcm->card); in snd_pcm_new_stream()
654 dev_set_name(&pstr->dev, "pcmC%iD%i%c", pcm->card->number, pcm->device, in snd_pcm_new_stream()
657 if (!pcm->internal) { in snd_pcm_new_stream()
660 pcm_err(pcm, "Error in snd_pcm_stream_proc_init\n"); in snd_pcm_new_stream()
669 substream->pcm = pcm; in snd_pcm_new_stream()
680 if (!pcm->internal) { in snd_pcm_new_stream()
683 pcm_err(pcm, in snd_pcm_new_stream()
707 struct snd_pcm *pcm; in _snd_pcm_new() local
722 pcm = kzalloc(sizeof(*pcm), GFP_KERNEL); in _snd_pcm_new()
723 if (!pcm) in _snd_pcm_new()
725 pcm->card = card; in _snd_pcm_new()
726 pcm->device = device; in _snd_pcm_new()
727 pcm->internal = internal; in _snd_pcm_new()
728 mutex_init(&pcm->open_mutex); in _snd_pcm_new()
729 init_waitqueue_head(&pcm->open_wait); in _snd_pcm_new()
730 INIT_LIST_HEAD(&pcm->list); in _snd_pcm_new()
732 strlcpy(pcm->id, id, sizeof(pcm->id)); in _snd_pcm_new()
734 err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK, in _snd_pcm_new()
739 err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, capture_count); in _snd_pcm_new()
743 err = snd_device_new(card, SNDRV_DEV_PCM, pcm, in _snd_pcm_new()
749 *rpcm = pcm; in _snd_pcm_new()
753 snd_pcm_free(pcm); in _snd_pcm_new()
813 struct snd_card *card = pstr->pcm->card; in free_chmap()
852 #define pcm_call_notify(pcm, call) \ argument
856 _notify->call(pcm); \
859 #define pcm_call_notify(pcm, call) do {} while (0) argument
862 static int snd_pcm_free(struct snd_pcm *pcm) in snd_pcm_free() argument
864 if (!pcm) in snd_pcm_free()
866 if (!pcm->internal) in snd_pcm_free()
867 pcm_call_notify(pcm, n_unregister); in snd_pcm_free()
868 if (pcm->private_free) in snd_pcm_free()
869 pcm->private_free(pcm); in snd_pcm_free()
870 snd_pcm_lib_preallocate_free_for_all(pcm); in snd_pcm_free()
871 snd_pcm_free_stream(&pcm->streams[SNDRV_PCM_STREAM_PLAYBACK]); in snd_pcm_free()
872 snd_pcm_free_stream(&pcm->streams[SNDRV_PCM_STREAM_CAPTURE]); in snd_pcm_free()
873 kfree(pcm); in snd_pcm_free()
879 struct snd_pcm *pcm = device->device_data; in snd_pcm_dev_free() local
880 return snd_pcm_free(pcm); in snd_pcm_dev_free()
883 int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream, in snd_pcm_attach_substream() argument
894 if (snd_BUG_ON(!pcm || !rsubstream)) in snd_pcm_attach_substream()
900 pstr = &pcm->streams[stream]; in snd_pcm_attach_substream()
904 card = pcm->card; in snd_pcm_attach_substream()
907 if (pcm->info_flags & SNDRV_PCM_INFO_HALF_DUPLEX) { in snd_pcm_attach_substream()
910 for (substream = pcm->streams[opposite].substream; substream; in snd_pcm_attach_substream()
976 substream->private_data = pcm->private_data; in snd_pcm_attach_substream()
1018 struct snd_pcm *pcm = pstr->pcm; in show_pcm_class() local
1027 if (pcm->dev_class > SNDRV_PCM_CLASS_LAST) in show_pcm_class()
1030 str = strs[pcm->dev_class]; in show_pcm_class()
1053 struct snd_pcm *pcm; in snd_pcm_dev_register() local
1057 pcm = device->device_data; in snd_pcm_dev_register()
1060 err = snd_pcm_add(pcm); in snd_pcm_dev_register()
1065 if (pcm->streams[cidx].substream == NULL) in snd_pcm_dev_register()
1076 err = snd_register_device(devtype, pcm->card, pcm->device, in snd_pcm_dev_register()
1077 &snd_pcm_f_ops[cidx], pcm, in snd_pcm_dev_register()
1078 &pcm->streams[cidx].dev); in snd_pcm_dev_register()
1080 list_del_init(&pcm->list); in snd_pcm_dev_register()
1084 for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) in snd_pcm_dev_register()
1088 pcm_call_notify(pcm, n_register); in snd_pcm_dev_register()
1097 struct snd_pcm *pcm = device->device_data; in snd_pcm_dev_disconnect() local
1102 mutex_lock(&pcm->open_mutex); in snd_pcm_dev_disconnect()
1103 wake_up(&pcm->open_wait); in snd_pcm_dev_disconnect()
1104 list_del_init(&pcm->list); in snd_pcm_dev_disconnect()
1106 for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) { in snd_pcm_dev_disconnect()
1122 for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) in snd_pcm_dev_disconnect()
1125 pcm_call_notify(pcm, n_disconnect); in snd_pcm_dev_disconnect()
1127 snd_unregister_device(&pcm->streams[cidx].dev); in snd_pcm_dev_disconnect()
1128 free_chmap(&pcm->streams[cidx]); in snd_pcm_dev_disconnect()
1130 mutex_unlock(&pcm->open_mutex); in snd_pcm_dev_disconnect()
1147 struct snd_pcm *pcm; in snd_pcm_notify() local
1157 list_for_each_entry(pcm, &snd_pcm_devices, list) in snd_pcm_notify()
1158 notify->n_unregister(pcm); in snd_pcm_notify()
1161 list_for_each_entry(pcm, &snd_pcm_devices, list) in snd_pcm_notify()
1162 notify->n_register(pcm); in snd_pcm_notify()
1178 struct snd_pcm *pcm; in snd_pcm_proc_read() local
1181 list_for_each_entry(pcm, &snd_pcm_devices, list) { in snd_pcm_proc_read()
1183 pcm->card->number, pcm->device, pcm->id, pcm->name); in snd_pcm_proc_read()
1184 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) in snd_pcm_proc_read()
1186 pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream_count); in snd_pcm_proc_read()
1187 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) in snd_pcm_proc_read()
1189 pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream_count); in snd_pcm_proc_read()