Lines Matching defs:snd

3  * virtio-snd: Virtio sound device
50 * @snd: VirtIO sound device.
55 static void virtsnd_event_dispatch(struct virtio_snd *snd,
61 virtsnd_jack_event(snd, event);
65 virtsnd_pcm_event(snd, event);
68 virtsnd_kctl_event(snd, event);
84 struct virtio_snd *snd = vqueue->vdev->priv;
85 struct virtio_snd_queue *queue = virtsnd_event_queue(snd);
93 virtsnd_event_dispatch(snd, event);
101 * @snd: VirtIO sound device.
108 static int virtsnd_find_vqs(struct virtio_snd *snd)
110 struct virtio_device *vdev = snd->vdev;
133 snd->queues[i].vqueue = vqs[i];
140 snd->event_msgs = kmalloc_array(n, sizeof(*snd->event_msgs),
142 if (!snd->event_msgs)
147 &snd->event_msgs[i], false, GFP_KERNEL);
154 * @snd: VirtIO sound device.
158 static void virtsnd_enable_event_vq(struct virtio_snd *snd)
160 struct virtio_snd_queue *queue = virtsnd_event_queue(snd);
168 * @snd: VirtIO sound device.
172 static void virtsnd_disable_event_vq(struct virtio_snd *snd)
174 struct virtio_snd_queue *queue = virtsnd_event_queue(snd);
182 virtsnd_event_dispatch(snd, event);
188 * @snd: VirtIO sound device.
193 static int virtsnd_build_devs(struct virtio_snd *snd)
195 struct virtio_device *vdev = snd->vdev;
200 THIS_MODULE, 0, &snd->card);
204 snd->card->private_data = snd;
206 strscpy(snd->card->driver, VIRTIO_SND_CARD_DRIVER,
207 sizeof(snd->card->driver));
208 strscpy(snd->card->shortname, VIRTIO_SND_CARD_NAME,
209 sizeof(snd->card->shortname));
211 snprintf(snd->card->longname, sizeof(snd->card->longname),
216 snprintf(snd->card->longname, sizeof(snd->card->longname),
220 rc = virtsnd_jack_parse_cfg(snd);
224 rc = virtsnd_pcm_parse_cfg(snd);
228 rc = virtsnd_chmap_parse_cfg(snd);
233 rc = virtsnd_kctl_parse_cfg(snd);
238 if (snd->njacks) {
239 rc = virtsnd_jack_build_devs(snd);
244 if (snd->nsubstreams) {
245 rc = virtsnd_pcm_build_devs(snd);
250 if (snd->nchmaps) {
251 rc = virtsnd_chmap_build_devs(snd);
256 if (snd->nkctls) {
257 rc = virtsnd_kctl_build_devs(snd);
262 return snd_card_register(snd->card);
305 struct virtio_snd *snd;
309 snd = devm_kzalloc(&vdev->dev, sizeof(*snd), GFP_KERNEL);
310 if (!snd)
313 snd->vdev = vdev;
314 INIT_LIST_HEAD(&snd->ctl_msgs);
315 INIT_LIST_HEAD(&snd->pcm_list);
317 vdev->priv = snd;
320 spin_lock_init(&snd->queues[i].lock);
322 rc = virtsnd_find_vqs(snd);
328 rc = virtsnd_build_devs(snd);
332 virtsnd_enable_event_vq(snd);
349 struct virtio_snd *snd = vdev->priv;
352 virtsnd_disable_event_vq(snd);
353 virtsnd_ctl_msg_cancel_all(snd);
355 if (snd->card)
356 snd_card_free(snd->card);
361 for (i = 0; snd->substreams && i < snd->nsubstreams; ++i) {
362 struct virtio_pcm_substream *vss = &snd->substreams[i];
368 kfree(snd->event_msgs);
381 struct virtio_snd *snd = vdev->priv;
384 virtsnd_disable_event_vq(snd);
385 virtsnd_ctl_msg_cancel_all(snd);
390 for (i = 0; i < snd->nsubstreams; ++i)
391 cancel_work_sync(&snd->substreams[i].elapsed_period);
393 kfree(snd->event_msgs);
394 snd->event_msgs = NULL;
408 struct virtio_snd *snd = vdev->priv;
411 rc = virtsnd_find_vqs(snd);
417 virtsnd_enable_event_vq(snd);