virtio_pcm.h (f40a28679e0b7cb3a9cc6627a8dbb40961990f0a) virtio_pcm.h (da76e9f3e43a7195c69d370ee514cccae6517c76)
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_PCM_H
7#define VIRTIO_SND_PCM_H
8

--- 15 unchanged lines hidden (view full) ---

24 * @hw: Kernel ALSA substream hardware descriptor.
25 * @elapsed_period: Kernel work to handle the elapsed period state.
26 * @lock: Spinlock that protects fields shared by interrupt handlers and
27 * substream operators.
28 * @buffer_bytes: Current buffer size in bytes.
29 * @hw_ptr: Substream hardware pointer value in bytes [0 ... buffer_bytes).
30 * @xfer_enabled: Data transfer state (0 - off, 1 - on).
31 * @xfer_xrun: Data underflow/overflow state (0 - no xrun, 1 - xrun).
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_PCM_H
7#define VIRTIO_SND_PCM_H
8

--- 15 unchanged lines hidden (view full) ---

24 * @hw: Kernel ALSA substream hardware descriptor.
25 * @elapsed_period: Kernel work to handle the elapsed period state.
26 * @lock: Spinlock that protects fields shared by interrupt handlers and
27 * substream operators.
28 * @buffer_bytes: Current buffer size in bytes.
29 * @hw_ptr: Substream hardware pointer value in bytes [0 ... buffer_bytes).
30 * @xfer_enabled: Data transfer state (0 - off, 1 - on).
31 * @xfer_xrun: Data underflow/overflow state (0 - no xrun, 1 - xrun).
32 * @stopped: True if the substream is stopped and must be released on the device
33 * side.
32 * @msgs: Allocated I/O messages.
33 * @nmsgs: Number of allocated I/O messages.
34 * @msg_last_enqueued: Index of the last I/O message added to the virtqueue.
35 * @msg_count: Number of pending I/O messages in the virtqueue.
36 * @msg_empty: Notify when msg_count is zero.
37 */
38struct virtio_pcm_substream {
39 struct virtio_snd *snd;

--- 4 unchanged lines hidden (view full) ---

44 struct snd_pcm_substream *substream;
45 struct snd_pcm_hardware hw;
46 struct work_struct elapsed_period;
47 spinlock_t lock;
48 size_t buffer_bytes;
49 size_t hw_ptr;
50 bool xfer_enabled;
51 bool xfer_xrun;
34 * @msgs: Allocated I/O messages.
35 * @nmsgs: Number of allocated I/O messages.
36 * @msg_last_enqueued: Index of the last I/O message added to the virtqueue.
37 * @msg_count: Number of pending I/O messages in the virtqueue.
38 * @msg_empty: Notify when msg_count is zero.
39 */
40struct virtio_pcm_substream {
41 struct virtio_snd *snd;

--- 4 unchanged lines hidden (view full) ---

46 struct snd_pcm_substream *substream;
47 struct snd_pcm_hardware hw;
48 struct work_struct elapsed_period;
49 spinlock_t lock;
50 size_t buffer_bytes;
51 size_t hw_ptr;
52 bool xfer_enabled;
53 bool xfer_xrun;
54 bool stopped;
52 struct virtio_pcm_msg **msgs;
53 unsigned int nmsgs;
54 int msg_last_enqueued;
55 unsigned int msg_count;
56 wait_queue_head_t msg_empty;
57};
58
59/**

--- 15 unchanged lines hidden (view full) ---

75 */
76struct virtio_pcm {
77 struct list_head list;
78 u32 nid;
79 struct snd_pcm *pcm;
80 struct virtio_pcm_stream streams[SNDRV_PCM_STREAM_LAST + 1];
81};
82
55 struct virtio_pcm_msg **msgs;
56 unsigned int nmsgs;
57 int msg_last_enqueued;
58 unsigned int msg_count;
59 wait_queue_head_t msg_empty;
60};
61
62/**

--- 15 unchanged lines hidden (view full) ---

78 */
79struct virtio_pcm {
80 struct list_head list;
81 u32 nid;
82 struct snd_pcm *pcm;
83 struct virtio_pcm_stream streams[SNDRV_PCM_STREAM_LAST + 1];
84};
85
86extern const struct snd_pcm_ops virtsnd_pcm_ops;
87
83int virtsnd_pcm_validate(struct virtio_device *vdev);
84
85int virtsnd_pcm_parse_cfg(struct virtio_snd *snd);
86
87int virtsnd_pcm_build_devs(struct virtio_snd *snd);
88
89void virtsnd_pcm_event(struct virtio_snd *snd, struct virtio_snd_event *event);
90

--- 22 unchanged lines hidden ---
88int virtsnd_pcm_validate(struct virtio_device *vdev);
89
90int virtsnd_pcm_parse_cfg(struct virtio_snd *snd);
91
92int virtsnd_pcm_build_devs(struct virtio_snd *snd);
93
94void virtsnd_pcm_event(struct virtio_snd *snd, struct virtio_snd_event *event);
95

--- 22 unchanged lines hidden ---