Commit da76e9f3 authored by Anton Yakovlev's avatar Anton Yakovlev Committed by Takashi Iwai

ALSA: virtio: PCM substream operators

Introduce the operators required for the operation of substreams.
Signed-off-by: default avatarAnton Yakovlev <anton.yakovlev@opensynergy.com>
Link: https://lore.kernel.org/r/20210302164709.3142702-7-anton.yakovlev@opensynergy.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent f40a2867
......@@ -6,5 +6,6 @@ virtio_snd-objs := \
virtio_card.o \
virtio_ctl_msg.o \
virtio_pcm.o \
virtio_pcm_msg.o
virtio_pcm_msg.o \
virtio_pcm_ops.o
......@@ -470,6 +470,8 @@ int virtsnd_pcm_build_devs(struct virtio_snd *snd)
for (kss = ks->substream; kss; kss = kss->next)
vs->substreams[kss->number]->substream = kss;
snd_pcm_set_ops(vpcm->pcm, i, &virtsnd_pcm_ops);
}
snd_pcm_set_managed_buffer_all(vpcm->pcm,
......
......@@ -29,6 +29,8 @@ struct virtio_pcm_msg;
* @hw_ptr: Substream hardware pointer value in bytes [0 ... buffer_bytes).
* @xfer_enabled: Data transfer state (0 - off, 1 - on).
* @xfer_xrun: Data underflow/overflow state (0 - no xrun, 1 - xrun).
* @stopped: True if the substream is stopped and must be released on the device
* side.
* @msgs: Allocated I/O messages.
* @nmsgs: Number of allocated I/O messages.
* @msg_last_enqueued: Index of the last I/O message added to the virtqueue.
......@@ -49,6 +51,7 @@ struct virtio_pcm_substream {
size_t hw_ptr;
bool xfer_enabled;
bool xfer_xrun;
bool stopped;
struct virtio_pcm_msg **msgs;
unsigned int nmsgs;
int msg_last_enqueued;
......@@ -80,6 +83,8 @@ struct virtio_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);
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment