~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/sound/virtio/virtio_card.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0+ */
  2 /*
  3  * virtio-snd: Virtio sound device
  4  * Copyright (C) 2021 OpenSynergy GmbH
  5  */
  6 #ifndef VIRTIO_SND_CARD_H
  7 #define VIRTIO_SND_CARD_H
  8 
  9 #include <linux/slab.h>
 10 #include <linux/virtio.h>
 11 #include <sound/core.h>
 12 #include <uapi/linux/virtio_snd.h>
 13 
 14 #include "virtio_ctl_msg.h"
 15 #include "virtio_pcm.h"
 16 
 17 #define VIRTIO_SND_CARD_DRIVER  "virtio-snd"
 18 #define VIRTIO_SND_CARD_NAME    "VirtIO SoundCard"
 19 #define VIRTIO_SND_PCM_NAME     "VirtIO PCM"
 20 
 21 struct virtio_jack;
 22 struct virtio_pcm_substream;
 23 
 24 /**
 25  * struct virtio_snd_queue - Virtqueue wrapper structure.
 26  * @lock: Used to synchronize access to a virtqueue.
 27  * @vqueue: Underlying virtqueue.
 28  */
 29 struct virtio_snd_queue {
 30         spinlock_t lock;
 31         struct virtqueue *vqueue;
 32 };
 33 
 34 /**
 35  * struct virtio_kctl - VirtIO control element.
 36  * @kctl: ALSA control element.
 37  * @items: Items for the ENUMERATED element type.
 38  */
 39 struct virtio_kctl {
 40         struct snd_kcontrol *kctl;
 41         struct virtio_snd_ctl_enum_item *items;
 42 };
 43 
 44 /**
 45  * struct virtio_snd - VirtIO sound card device.
 46  * @vdev: Underlying virtio device.
 47  * @queues: Virtqueue wrappers.
 48  * @card: ALSA sound card.
 49  * @ctl_msgs: Pending control request list.
 50  * @event_msgs: Device events.
 51  * @pcm_list: VirtIO PCM device list.
 52  * @jacks: VirtIO jacks.
 53  * @njacks: Number of jacks.
 54  * @substreams: VirtIO PCM substreams.
 55  * @nsubstreams: Number of PCM substreams.
 56  * @chmaps: VirtIO channel maps.
 57  * @nchmaps: Number of channel maps.
 58  * @kctl_infos: VirtIO control element information.
 59  * @kctls: VirtIO control elements.
 60  * @nkctls: Number of control elements.
 61  */
 62 struct virtio_snd {
 63         struct virtio_device *vdev;
 64         struct virtio_snd_queue queues[VIRTIO_SND_VQ_MAX];
 65         struct snd_card *card;
 66         struct list_head ctl_msgs;
 67         struct virtio_snd_event *event_msgs;
 68         struct list_head pcm_list;
 69         struct virtio_jack *jacks;
 70         u32 njacks;
 71         struct virtio_pcm_substream *substreams;
 72         u32 nsubstreams;
 73         struct virtio_snd_chmap_info *chmaps;
 74         u32 nchmaps;
 75         struct virtio_snd_ctl_info *kctl_infos;
 76         struct virtio_kctl *kctls;
 77         u32 nkctls;
 78 };
 79 
 80 /* Message completion timeout in milliseconds (module parameter). */
 81 extern u32 virtsnd_msg_timeout_ms;
 82 
 83 static inline struct virtio_snd_queue *
 84 virtsnd_control_queue(struct virtio_snd *snd)
 85 {
 86         return &snd->queues[VIRTIO_SND_VQ_CONTROL];
 87 }
 88 
 89 static inline struct virtio_snd_queue *
 90 virtsnd_event_queue(struct virtio_snd *snd)
 91 {
 92         return &snd->queues[VIRTIO_SND_VQ_EVENT];
 93 }
 94 
 95 static inline struct virtio_snd_queue *
 96 virtsnd_tx_queue(struct virtio_snd *snd)
 97 {
 98         return &snd->queues[VIRTIO_SND_VQ_TX];
 99 }
100 
101 static inline struct virtio_snd_queue *
102 virtsnd_rx_queue(struct virtio_snd *snd)
103 {
104         return &snd->queues[VIRTIO_SND_VQ_RX];
105 }
106 
107 static inline struct virtio_snd_queue *
108 virtsnd_pcm_queue(struct virtio_pcm_substream *vss)
109 {
110         if (vss->direction == SNDRV_PCM_STREAM_PLAYBACK)
111                 return virtsnd_tx_queue(vss->snd);
112         else
113                 return virtsnd_rx_queue(vss->snd);
114 }
115 
116 int virtsnd_jack_parse_cfg(struct virtio_snd *snd);
117 
118 int virtsnd_jack_build_devs(struct virtio_snd *snd);
119 
120 void virtsnd_jack_event(struct virtio_snd *snd,
121                         struct virtio_snd_event *event);
122 
123 int virtsnd_chmap_parse_cfg(struct virtio_snd *snd);
124 
125 int virtsnd_chmap_build_devs(struct virtio_snd *snd);
126 
127 int virtsnd_kctl_parse_cfg(struct virtio_snd *snd);
128 
129 int virtsnd_kctl_build_devs(struct virtio_snd *snd);
130 
131 void virtsnd_kctl_event(struct virtio_snd *snd, struct virtio_snd_event *event);
132 
133 #endif /* VIRTIO_SND_CARD_H */
134 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php