Lines Matching refs:pcm

47 static int snd_pcm_free(struct snd_pcm *pcm);
54 struct snd_pcm *pcm; in snd_pcm_get() local
56 list_for_each_entry(pcm, &snd_pcm_devices, list) { in snd_pcm_get()
57 if (pcm->card == card && pcm->device == device) in snd_pcm_get()
58 return pcm; in snd_pcm_get()
65 struct snd_pcm *pcm; in snd_pcm_next() local
67 list_for_each_entry(pcm, &snd_pcm_devices, list) { in snd_pcm_next()
68 if (pcm->card == card && pcm->device > device) in snd_pcm_next()
69 return pcm->device; in snd_pcm_next()
70 else if (pcm->card->number > card->number) in snd_pcm_next()
78 struct snd_pcm *pcm; in snd_pcm_add() local
83 list_for_each_entry(pcm, &snd_pcm_devices, list) { in snd_pcm_add()
84 if (pcm->card == newpcm->card && pcm->device == newpcm->device) in snd_pcm_add()
86 if (pcm->card->number > newpcm->card->number || in snd_pcm_add()
87 (pcm->card == newpcm->card && in snd_pcm_add()
88 pcm->device > newpcm->device)) { in snd_pcm_add()
89 list_add(&newpcm->list, pcm->list.prev); in snd_pcm_add()
120 struct snd_pcm *pcm; in snd_pcm_control_ioctl() local
135 pcm = snd_pcm_get(card, device); in snd_pcm_control_ioctl()
136 if (pcm == NULL) { in snd_pcm_control_ioctl()
140 pstr = &pcm->streams[stream]; in snd_pcm_control_ioctl()
157 mutex_lock(&pcm->open_mutex); in snd_pcm_control_ioctl()
159 mutex_unlock(&pcm->open_mutex); in snd_pcm_control_ioctl()
395 mutex_lock(&substream->pcm->open_mutex); in snd_pcm_substream_proc_hw_params_read()
423 mutex_unlock(&substream->pcm->open_mutex); in snd_pcm_substream_proc_hw_params_read()
432 mutex_lock(&substream->pcm->open_mutex); in snd_pcm_substream_proc_sw_params_read()
451 mutex_unlock(&substream->pcm->open_mutex); in snd_pcm_substream_proc_sw_params_read()
462 mutex_lock(&substream->pcm->open_mutex); in snd_pcm_substream_proc_status_read()
487 mutex_unlock(&substream->pcm->open_mutex); in snd_pcm_substream_proc_status_read()
518 struct snd_pcm *pcm = pstr->pcm; in snd_pcm_stream_proc_init() local
522 sprintf(name, "pcm%i%c", pcm->device, in snd_pcm_stream_proc_init()
524 entry = snd_info_create_card_entry(pcm->card, name, in snd_pcm_stream_proc_init()
525 pcm->card->proc_root); in snd_pcm_stream_proc_init()
534 entry = snd_info_create_card_entry(pcm->card, "info", pstr->proc_root); in snd_pcm_stream_proc_init()
545 entry = snd_info_create_card_entry(pcm->card, "xrun_debug", in snd_pcm_stream_proc_init()
581 card = substream->pcm->card; in snd_pcm_substream_proc_init()
697 int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count) in snd_pcm_new_stream() argument
700 struct snd_pcm_str *pstr = &pcm->streams[stream]; in snd_pcm_new_stream()
707 pstr->pcm = pcm; in snd_pcm_new_stream()
712 snd_device_initialize(&pstr->dev, pcm->card); in snd_pcm_new_stream()
714 dev_set_name(&pstr->dev, "pcmC%iD%i%c", pcm->card->number, pcm->device, in snd_pcm_new_stream()
717 if (!pcm->internal) { in snd_pcm_new_stream()
720 pcm_err(pcm, "Error in snd_pcm_stream_proc_init\n"); in snd_pcm_new_stream()
729 substream->pcm = pcm; in snd_pcm_new_stream()
740 if (!pcm->internal) { in snd_pcm_new_stream()
743 pcm_err(pcm, in snd_pcm_new_stream()
769 struct snd_pcm *pcm; in _snd_pcm_new() local
784 pcm = kzalloc(sizeof(*pcm), GFP_KERNEL); in _snd_pcm_new()
785 if (!pcm) in _snd_pcm_new()
787 pcm->card = card; in _snd_pcm_new()
788 pcm->device = device; in _snd_pcm_new()
789 pcm->internal = internal; in _snd_pcm_new()
790 mutex_init(&pcm->open_mutex); in _snd_pcm_new()
791 init_waitqueue_head(&pcm->open_wait); in _snd_pcm_new()
792 INIT_LIST_HEAD(&pcm->list); in _snd_pcm_new()
794 strlcpy(pcm->id, id, sizeof(pcm->id)); in _snd_pcm_new()
796 err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_PLAYBACK, in _snd_pcm_new()
801 err = snd_pcm_new_stream(pcm, SNDRV_PCM_STREAM_CAPTURE, capture_count); in _snd_pcm_new()
805 err = snd_device_new(card, SNDRV_DEV_PCM, pcm, in _snd_pcm_new()
811 *rpcm = pcm; in _snd_pcm_new()
815 snd_pcm_free(pcm); in _snd_pcm_new()
875 snd_ctl_remove(pstr->pcm->card, pstr->chmap_kctl); in free_chmap()
908 #define pcm_call_notify(pcm, call) \ argument
912 _notify->call(pcm); \
915 #define pcm_call_notify(pcm, call) do {} while (0) argument
918 static int snd_pcm_free(struct snd_pcm *pcm) in snd_pcm_free() argument
920 if (!pcm) in snd_pcm_free()
922 if (!pcm->internal) in snd_pcm_free()
923 pcm_call_notify(pcm, n_unregister); in snd_pcm_free()
924 if (pcm->private_free) in snd_pcm_free()
925 pcm->private_free(pcm); in snd_pcm_free()
926 snd_pcm_lib_preallocate_free_for_all(pcm); in snd_pcm_free()
927 snd_pcm_free_stream(&pcm->streams[SNDRV_PCM_STREAM_PLAYBACK]); in snd_pcm_free()
928 snd_pcm_free_stream(&pcm->streams[SNDRV_PCM_STREAM_CAPTURE]); in snd_pcm_free()
929 kfree(pcm); in snd_pcm_free()
935 struct snd_pcm *pcm = device->device_data; in snd_pcm_dev_free() local
936 return snd_pcm_free(pcm); in snd_pcm_dev_free()
939 int snd_pcm_attach_substream(struct snd_pcm *pcm, int stream, in snd_pcm_attach_substream() argument
950 if (snd_BUG_ON(!pcm || !rsubstream)) in snd_pcm_attach_substream()
956 pstr = &pcm->streams[stream]; in snd_pcm_attach_substream()
960 card = pcm->card; in snd_pcm_attach_substream()
963 if (pcm->info_flags & SNDRV_PCM_INFO_HALF_DUPLEX) { in snd_pcm_attach_substream()
966 for (substream = pcm->streams[opposite].substream; substream; in snd_pcm_attach_substream()
1030 substream->private_data = pcm->private_data; in snd_pcm_attach_substream()
1069 struct snd_pcm *pcm = pstr->pcm; in show_pcm_class() local
1078 if (pcm->dev_class > SNDRV_PCM_CLASS_LAST) in show_pcm_class()
1081 str = strs[pcm->dev_class]; in show_pcm_class()
1104 struct snd_pcm *pcm; in snd_pcm_dev_register() local
1108 pcm = device->device_data; in snd_pcm_dev_register()
1111 err = snd_pcm_add(pcm); in snd_pcm_dev_register()
1116 if (pcm->streams[cidx].substream == NULL) in snd_pcm_dev_register()
1127 err = snd_register_device(devtype, pcm->card, pcm->device, in snd_pcm_dev_register()
1128 &snd_pcm_f_ops[cidx], pcm, in snd_pcm_dev_register()
1129 &pcm->streams[cidx].dev); in snd_pcm_dev_register()
1131 list_del_init(&pcm->list); in snd_pcm_dev_register()
1135 for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) in snd_pcm_dev_register()
1139 pcm_call_notify(pcm, n_register); in snd_pcm_dev_register()
1148 struct snd_pcm *pcm = device->device_data; in snd_pcm_dev_disconnect() local
1153 mutex_lock(&pcm->open_mutex); in snd_pcm_dev_disconnect()
1154 wake_up(&pcm->open_wait); in snd_pcm_dev_disconnect()
1155 list_del_init(&pcm->list); in snd_pcm_dev_disconnect()
1157 for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) { in snd_pcm_dev_disconnect()
1172 pcm_call_notify(pcm, n_disconnect); in snd_pcm_dev_disconnect()
1174 snd_unregister_device(&pcm->streams[cidx].dev); in snd_pcm_dev_disconnect()
1175 free_chmap(&pcm->streams[cidx]); in snd_pcm_dev_disconnect()
1177 mutex_unlock(&pcm->open_mutex); in snd_pcm_dev_disconnect()
1194 struct snd_pcm *pcm; in snd_pcm_notify() local
1204 list_for_each_entry(pcm, &snd_pcm_devices, list) in snd_pcm_notify()
1205 notify->n_unregister(pcm); in snd_pcm_notify()
1208 list_for_each_entry(pcm, &snd_pcm_devices, list) in snd_pcm_notify()
1209 notify->n_register(pcm); in snd_pcm_notify()
1225 struct snd_pcm *pcm; in snd_pcm_proc_read() local
1228 list_for_each_entry(pcm, &snd_pcm_devices, list) { in snd_pcm_proc_read()
1230 pcm->card->number, pcm->device, pcm->id, pcm->name); in snd_pcm_proc_read()
1231 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) in snd_pcm_proc_read()
1233 pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream_count); in snd_pcm_proc_read()
1234 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) in snd_pcm_proc_read()
1236 pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream_count); in snd_pcm_proc_read()