sound/virtio/virtio_card.h
Source file repositories/reference/linux-study-clean/sound/virtio/virtio_card.h
File Facts
- System
- Linux kernel
- Corpus path
sound/virtio/virtio_card.h- Extension
.h- Size
- 3412 bytes
- Lines
- 134
- Domain
- Driver Families
- Bucket
- sound/virtio
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/slab.hlinux/virtio.hsound/core.huapi/linux/virtio_snd.hvirtio_ctl_msg.hvirtio_pcm.h
Detected Declarations
struct virtio_jackstruct virtio_pcm_substreamstruct virtio_snd_queuestruct virtio_kctlstruct virtio_sndfunction virtsnd_control_queuefunction virtsnd_event_queuefunction virtsnd_tx_queuefunction virtsnd_rx_queuefunction virtsnd_pcm_queue
Annotated Snippet
struct virtio_snd_queue {
spinlock_t lock;
struct virtqueue *vqueue;
};
/**
* struct virtio_kctl - VirtIO control element.
* @kctl: ALSA control element.
* @items: Items for the ENUMERATED element type.
*/
struct virtio_kctl {
struct snd_kcontrol *kctl;
struct virtio_snd_ctl_enum_item *items;
};
/**
* struct virtio_snd - VirtIO sound card device.
* @vdev: Underlying virtio device.
* @queues: Virtqueue wrappers.
* @card: ALSA sound card.
* @ctl_msgs: Pending control request list.
* @event_msgs: Device events.
* @pcm_list: VirtIO PCM device list.
* @jacks: VirtIO jacks.
* @njacks: Number of jacks.
* @substreams: VirtIO PCM substreams.
* @nsubstreams: Number of PCM substreams.
* @chmaps: VirtIO channel maps.
* @nchmaps: Number of channel maps.
* @kctl_infos: VirtIO control element information.
* @kctls: VirtIO control elements.
* @nkctls: Number of control elements.
*/
struct virtio_snd {
struct virtio_device *vdev;
struct virtio_snd_queue queues[VIRTIO_SND_VQ_MAX];
struct snd_card *card;
struct list_head ctl_msgs;
struct virtio_snd_event *event_msgs;
struct list_head pcm_list;
struct virtio_jack *jacks;
u32 njacks;
struct virtio_pcm_substream *substreams;
u32 nsubstreams;
struct virtio_snd_chmap_info *chmaps;
u32 nchmaps;
struct virtio_snd_ctl_info *kctl_infos;
struct virtio_kctl *kctls;
u32 nkctls;
};
/* Message completion timeout in milliseconds (module parameter). */
extern u32 virtsnd_msg_timeout_ms;
static inline struct virtio_snd_queue *
virtsnd_control_queue(struct virtio_snd *snd)
{
return &snd->queues[VIRTIO_SND_VQ_CONTROL];
}
static inline struct virtio_snd_queue *
virtsnd_event_queue(struct virtio_snd *snd)
{
return &snd->queues[VIRTIO_SND_VQ_EVENT];
}
static inline struct virtio_snd_queue *
virtsnd_tx_queue(struct virtio_snd *snd)
{
return &snd->queues[VIRTIO_SND_VQ_TX];
}
static inline struct virtio_snd_queue *
virtsnd_rx_queue(struct virtio_snd *snd)
{
return &snd->queues[VIRTIO_SND_VQ_RX];
}
static inline struct virtio_snd_queue *
virtsnd_pcm_queue(struct virtio_pcm_substream *vss)
{
if (vss->direction == SNDRV_PCM_STREAM_PLAYBACK)
return virtsnd_tx_queue(vss->snd);
else
return virtsnd_rx_queue(vss->snd);
}
int virtsnd_jack_parse_cfg(struct virtio_snd *snd);
int virtsnd_jack_build_devs(struct virtio_snd *snd);
Annotation
- Immediate include surface: `linux/slab.h`, `linux/virtio.h`, `sound/core.h`, `uapi/linux/virtio_snd.h`, `virtio_ctl_msg.h`, `virtio_pcm.h`.
- Detected declarations: `struct virtio_jack`, `struct virtio_pcm_substream`, `struct virtio_snd_queue`, `struct virtio_kctl`, `struct virtio_snd`, `function virtsnd_control_queue`, `function virtsnd_event_queue`, `function virtsnd_tx_queue`, `function virtsnd_rx_queue`, `function virtsnd_pcm_queue`.
- Atlas domain: Driver Families / sound/virtio.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.