Lines Matching refs: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);
81 struct virtio_snd *snd = vqueue->vdev->priv;
82 struct virtio_snd_queue *queue = virtsnd_event_queue(snd);
91 virtsnd_event_dispatch(snd, event);
102 * @snd: VirtIO sound device.
109 static int virtsnd_find_vqs(struct virtio_snd *snd)
111 struct virtio_device *vdev = snd->vdev;
137 snd->queues[i].vqueue = vqs[i];
144 snd->event_msgs = kmalloc_array(n, sizeof(*snd->event_msgs),
146 if (!snd->event_msgs)
151 &snd->event_msgs[i], false, GFP_KERNEL);
158 * @snd: VirtIO sound device.
162 static void virtsnd_enable_event_vq(struct virtio_snd *snd)
164 struct virtio_snd_queue *queue = virtsnd_event_queue(snd);
172 * @snd: VirtIO sound device.
176 static void virtsnd_disable_event_vq(struct virtio_snd *snd)
178 struct virtio_snd_queue *queue = virtsnd_event_queue(snd);
187 virtsnd_event_dispatch(snd, event);
194 * @snd: VirtIO sound device.
199 static int virtsnd_build_devs(struct virtio_snd *snd)
201 struct virtio_device *vdev = snd->vdev;
206 THIS_MODULE, 0, &snd->card);
210 snd->card->private_data = snd;
212 strscpy(snd->card->driver, VIRTIO_SND_CARD_DRIVER,
213 sizeof(snd->card->driver));
214 strscpy(snd->card->shortname, VIRTIO_SND_CARD_NAME,
215 sizeof(snd->card->shortname));
217 snprintf(snd->card->longname, sizeof(snd->card->longname),
222 snprintf(snd->card->longname, sizeof(snd->card->longname),
226 rc = virtsnd_jack_parse_cfg(snd);
230 rc = virtsnd_pcm_parse_cfg(snd);
234 rc = virtsnd_chmap_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 return snd_card_register(snd->card);
299 struct virtio_snd *snd;
303 snd = devm_kzalloc(&vdev->dev, sizeof(*snd), GFP_KERNEL);
304 if (!snd)
307 snd->vdev = vdev;
308 INIT_LIST_HEAD(&snd->ctl_msgs);
309 INIT_LIST_HEAD(&snd->pcm_list);
311 vdev->priv = snd;
314 spin_lock_init(&snd->queues[i].lock);
316 rc = virtsnd_find_vqs(snd);
322 rc = virtsnd_build_devs(snd);
326 virtsnd_enable_event_vq(snd);
343 struct virtio_snd *snd = vdev->priv;
346 virtsnd_disable_event_vq(snd);
347 virtsnd_ctl_msg_cancel_all(snd);
349 if (snd->card)
350 snd_card_free(snd->card);
355 for (i = 0; snd->substreams && i < snd->nsubstreams; ++i) {
356 struct virtio_pcm_substream *vss = &snd->substreams[i];
362 kfree(snd->event_msgs);
375 struct virtio_snd *snd = vdev->priv;
378 virtsnd_disable_event_vq(snd);
379 virtsnd_ctl_msg_cancel_all(snd);
384 for (i = 0; i < snd->nsubstreams; ++i)
385 cancel_work_sync(&snd->substreams[i].elapsed_period);
387 kfree(snd->event_msgs);
388 snd->event_msgs = NULL;
402 struct virtio_snd *snd = vdev->priv;
405 rc = virtsnd_find_vqs(snd);
411 virtsnd_enable_event_vq(snd);