Lines Matching refs:snd

55 static void virtsnd_event_dispatch(struct virtio_snd *snd,  in virtsnd_event_dispatch()  argument
61 virtsnd_jack_event(snd, event); in virtsnd_event_dispatch()
65 virtsnd_pcm_event(snd, event); in virtsnd_event_dispatch()
68 virtsnd_kctl_event(snd, event); in virtsnd_event_dispatch()
84 struct virtio_snd *snd = vqueue->vdev->priv; in virtsnd_event_notify_cb() local
85 struct virtio_snd_queue *queue = virtsnd_event_queue(snd); in virtsnd_event_notify_cb()
94 virtsnd_event_dispatch(snd, event); in virtsnd_event_notify_cb()
110 static int virtsnd_find_vqs(struct virtio_snd *snd) in virtsnd_find_vqs() argument
112 struct virtio_device *vdev = snd->vdev; in virtsnd_find_vqs()
135 snd->queues[i].vqueue = vqs[i]; in virtsnd_find_vqs()
142 snd->event_msgs = kmalloc_array(n, sizeof(*snd->event_msgs), in virtsnd_find_vqs()
144 if (!snd->event_msgs) in virtsnd_find_vqs()
149 &snd->event_msgs[i], false, GFP_KERNEL); in virtsnd_find_vqs()
160 static void virtsnd_enable_event_vq(struct virtio_snd *snd) in virtsnd_enable_event_vq() argument
162 struct virtio_snd_queue *queue = virtsnd_event_queue(snd); in virtsnd_enable_event_vq()
174 static void virtsnd_disable_event_vq(struct virtio_snd *snd) in virtsnd_disable_event_vq() argument
176 struct virtio_snd_queue *queue = virtsnd_event_queue(snd); in virtsnd_disable_event_vq()
185 virtsnd_event_dispatch(snd, event); in virtsnd_disable_event_vq()
197 static int virtsnd_build_devs(struct virtio_snd *snd) in virtsnd_build_devs() argument
199 struct virtio_device *vdev = snd->vdev; in virtsnd_build_devs()
204 THIS_MODULE, 0, &snd->card); in virtsnd_build_devs()
208 snd->card->private_data = snd; in virtsnd_build_devs()
210 strscpy(snd->card->driver, VIRTIO_SND_CARD_DRIVER, in virtsnd_build_devs()
211 sizeof(snd->card->driver)); in virtsnd_build_devs()
212 strscpy(snd->card->shortname, VIRTIO_SND_CARD_NAME, in virtsnd_build_devs()
213 sizeof(snd->card->shortname)); in virtsnd_build_devs()
215 snprintf(snd->card->longname, sizeof(snd->card->longname), in virtsnd_build_devs()
220 snprintf(snd->card->longname, sizeof(snd->card->longname), in virtsnd_build_devs()
224 rc = virtsnd_jack_parse_cfg(snd); in virtsnd_build_devs()
228 rc = virtsnd_pcm_parse_cfg(snd); in virtsnd_build_devs()
232 rc = virtsnd_chmap_parse_cfg(snd); in virtsnd_build_devs()
237 rc = virtsnd_kctl_parse_cfg(snd); in virtsnd_build_devs()
242 if (snd->njacks) { in virtsnd_build_devs()
243 rc = virtsnd_jack_build_devs(snd); in virtsnd_build_devs()
248 if (snd->nsubstreams) { in virtsnd_build_devs()
249 rc = virtsnd_pcm_build_devs(snd); in virtsnd_build_devs()
254 if (snd->nchmaps) { in virtsnd_build_devs()
255 rc = virtsnd_chmap_build_devs(snd); in virtsnd_build_devs()
260 if (snd->nkctls) { in virtsnd_build_devs()
261 rc = virtsnd_kctl_build_devs(snd); in virtsnd_build_devs()
266 return snd_card_register(snd->card); in virtsnd_build_devs()
309 struct virtio_snd *snd; in virtsnd_probe() local
313 snd = devm_kzalloc(&vdev->dev, sizeof(*snd), GFP_KERNEL); in virtsnd_probe()
314 if (!snd) in virtsnd_probe()
317 snd->vdev = vdev; in virtsnd_probe()
318 INIT_LIST_HEAD(&snd->ctl_msgs); in virtsnd_probe()
319 INIT_LIST_HEAD(&snd->pcm_list); in virtsnd_probe()
321 vdev->priv = snd; in virtsnd_probe()
324 spin_lock_init(&snd->queues[i].lock); in virtsnd_probe()
326 rc = virtsnd_find_vqs(snd); in virtsnd_probe()
332 rc = virtsnd_build_devs(snd); in virtsnd_probe()
336 virtsnd_enable_event_vq(snd); in virtsnd_probe()
353 struct virtio_snd *snd = vdev->priv; in virtsnd_remove() local
356 virtsnd_disable_event_vq(snd); in virtsnd_remove()
357 virtsnd_ctl_msg_cancel_all(snd); in virtsnd_remove()
359 if (snd->card) in virtsnd_remove()
360 snd_card_free(snd->card); in virtsnd_remove()
365 for (i = 0; snd->substreams && i < snd->nsubstreams; ++i) { in virtsnd_remove()
366 struct virtio_pcm_substream *vss = &snd->substreams[i]; in virtsnd_remove()
372 kfree(snd->event_msgs); in virtsnd_remove()
385 struct virtio_snd *snd = vdev->priv; in virtsnd_freeze() local
388 virtsnd_disable_event_vq(snd); in virtsnd_freeze()
389 virtsnd_ctl_msg_cancel_all(snd); in virtsnd_freeze()
394 for (i = 0; i < snd->nsubstreams; ++i) in virtsnd_freeze()
395 cancel_work_sync(&snd->substreams[i].elapsed_period); in virtsnd_freeze()
397 kfree(snd->event_msgs); in virtsnd_freeze()
398 snd->event_msgs = NULL; in virtsnd_freeze()
412 struct virtio_snd *snd = vdev->priv; in virtsnd_restore() local
415 rc = virtsnd_find_vqs(snd); in virtsnd_restore()
421 virtsnd_enable_event_vq(snd); in virtsnd_restore()