Lines Matching refs:vss
122 * @vss: VirtIO PCM substream.
132 int virtsnd_pcm_msg_alloc(struct virtio_pcm_substream *vss,
135 struct snd_pcm_runtime *runtime = vss->substream->runtime;
138 vss->msgs = kcalloc(periods, sizeof(*vss->msgs), GFP_KERNEL);
139 if (!vss->msgs)
142 vss->nmsgs = periods;
153 msg->substream = vss;
162 vss->msgs[i] = msg;
170 * @vss: VirtIO PCM substream.
174 void virtsnd_pcm_msg_free(struct virtio_pcm_substream *vss)
178 for (i = 0; vss->msgs && i < vss->nmsgs; ++i)
179 kfree(vss->msgs[i]);
180 kfree(vss->msgs);
182 vss->msgs = NULL;
183 vss->nmsgs = 0;
188 * @vss: VirtIO PCM substream.
201 int virtsnd_pcm_msg_send(struct virtio_pcm_substream *vss)
203 struct snd_pcm_runtime *runtime = vss->substream->runtime;
204 struct virtio_snd *snd = vss->snd;
206 struct virtqueue *vqueue = virtsnd_pcm_queue(vss)->vqueue;
211 i = (vss->msg_last_enqueued + 1) % runtime->periods;
212 n = runtime->periods - vss->msg_count;
215 struct virtio_pcm_msg *msg = vss->msgs[i];
223 msg->xfer.stream_id = cpu_to_le32(vss->sid);
226 if (vss->direction == SNDRV_PCM_STREAM_PLAYBACK)
236 vss->sid);
240 vss->msg_last_enqueued = i;
241 vss->msg_count++;
244 if (!(vss->features & (1U << VIRTIO_SND_PCM_F_MSG_POLLING)))
255 * @vss: VirtIO substream.
260 unsigned int virtsnd_pcm_msg_pending_num(struct virtio_pcm_substream *vss)
265 spin_lock_irqsave(&vss->lock, flags);
266 num = vss->msg_count;
267 spin_unlock_irqrestore(&vss->lock, flags);
291 struct virtio_pcm_substream *vss = msg->substream;
298 spin_lock(&vss->lock);
303 if (vss->direction == SNDRV_PCM_STREAM_PLAYBACK ||
305 vss->hw_ptr += msg->length;
307 vss->hw_ptr += written_bytes - sizeof(msg->status);
309 if (vss->hw_ptr >= vss->buffer_bytes)
310 vss->hw_ptr -= vss->buffer_bytes;
312 vss->xfer_xrun = false;
313 vss->msg_count--;
315 if (vss->xfer_enabled) {
316 struct snd_pcm_runtime *runtime = vss->substream->runtime;
322 schedule_work(&vss->elapsed_period);
324 virtsnd_pcm_msg_send(vss);
325 } else if (!vss->msg_count) {
326 wake_up_all(&vss->msg_empty);
328 spin_unlock(&vss->lock);
383 * @vss: VirtIO PCM substream.
391 virtsnd_pcm_ctl_msg_alloc(struct virtio_pcm_substream *vss,
409 hdr->stream_id = cpu_to_le32(vss->sid);