sound/virtio/virtio_pcm.h
Source file repositories/reference/linux-study-clean/sound/virtio/virtio_pcm.h
File Facts
- System
- Linux kernel
- Corpus path
sound/virtio/virtio_pcm.h- Extension
.h- Size
- 3904 bytes
- Lines
- 127
- 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/atomic.hlinux/virtio_config.hsound/pcm.hsound/pcm-indirect.h
Detected Declarations
struct virtio_pcmstruct virtio_pcm_msgstruct virtio_pcm_substreamstruct virtio_pcm_streamstruct virtio_pcm
Annotated Snippet
struct virtio_pcm_substream {
struct virtio_snd *snd;
u32 nid;
u32 sid;
u32 direction;
u32 features;
struct snd_pcm_substream *substream;
struct snd_pcm_indirect pcm_indirect;
struct snd_pcm_hardware hw;
struct work_struct elapsed_period;
spinlock_t lock;
size_t buffer_bytes;
size_t hw_ptr;
bool xfer_enabled;
bool xfer_xrun;
bool stopped;
bool suspended;
struct virtio_pcm_msg **msgs;
unsigned int nmsgs;
unsigned int msg_count;
wait_queue_head_t msg_empty;
};
/**
* struct virtio_pcm_stream - VirtIO PCM stream.
* @substreams: VirtIO substreams belonging to the stream.
* @nsubstreams: Number of substreams.
* @chmaps: Kernel channel maps belonging to the stream.
* @nchmaps: Number of channel maps.
*/
struct virtio_pcm_stream {
struct virtio_pcm_substream **substreams;
u32 nsubstreams;
struct snd_pcm_chmap_elem *chmaps;
u32 nchmaps;
};
/**
* struct virtio_pcm - VirtIO PCM device.
* @list: VirtIO PCM list entry.
* @nid: Function group node identifier.
* @pcm: Kernel PCM device.
* @streams: VirtIO PCM streams (playback and capture).
*/
struct virtio_pcm {
struct list_head list;
u32 nid;
struct snd_pcm *pcm;
struct virtio_pcm_stream streams[SNDRV_PCM_STREAM_LAST + 1];
};
extern const struct snd_pcm_ops virtsnd_pcm_ops[];
int virtsnd_pcm_validate(struct virtio_device *vdev);
int virtsnd_pcm_parse_cfg(struct virtio_snd *snd);
int virtsnd_pcm_build_devs(struct virtio_snd *snd);
void virtsnd_pcm_event(struct virtio_snd *snd, struct virtio_snd_event *event);
void virtsnd_pcm_tx_notify_cb(struct virtqueue *vqueue);
void virtsnd_pcm_rx_notify_cb(struct virtqueue *vqueue);
struct virtio_pcm *virtsnd_pcm_find(struct virtio_snd *snd, u32 nid);
struct virtio_pcm *virtsnd_pcm_find_or_create(struct virtio_snd *snd, u32 nid);
struct virtio_snd_msg *
virtsnd_pcm_ctl_msg_alloc(struct virtio_pcm_substream *vss,
unsigned int command, gfp_t gfp);
int virtsnd_pcm_msg_alloc(struct virtio_pcm_substream *vss,
unsigned int periods, unsigned int period_bytes);
void virtsnd_pcm_msg_free(struct virtio_pcm_substream *vss);
int virtsnd_pcm_msg_send(struct virtio_pcm_substream *vss, unsigned long offset,
unsigned long bytes);
unsigned int virtsnd_pcm_msg_pending_num(struct virtio_pcm_substream *vss);
#endif /* VIRTIO_SND_PCM_H */
Annotation
- Immediate include surface: `linux/atomic.h`, `linux/virtio_config.h`, `sound/pcm.h`, `sound/pcm-indirect.h`.
- Detected declarations: `struct virtio_pcm`, `struct virtio_pcm_msg`, `struct virtio_pcm_substream`, `struct virtio_pcm_stream`, `struct virtio_pcm`.
- 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.