Lines Matching refs:vss

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