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()
161 vss->msgs[i] = msg; in virtsnd_pcm_msg_alloc()
173 void virtsnd_pcm_msg_free(struct virtio_pcm_substream *vss) in virtsnd_pcm_msg_free() argument
177 for (i = 0; vss->msgs && i < vss->nmsgs; ++i) in virtsnd_pcm_msg_free()
178 kfree(vss->msgs[i]); in virtsnd_pcm_msg_free()
179 kfree(vss->msgs); in virtsnd_pcm_msg_free()
181 vss->msgs = NULL; in virtsnd_pcm_msg_free()
182 vss->nmsgs = 0; in virtsnd_pcm_msg_free()
200 int virtsnd_pcm_msg_send(struct virtio_pcm_substream *vss, unsigned long offset, in virtsnd_pcm_msg_send() argument
203 struct virtio_snd *snd = vss->snd; in virtsnd_pcm_msg_send()
205 struct virtqueue *vqueue = virtsnd_pcm_queue(vss)->vqueue; in virtsnd_pcm_msg_send()
206 unsigned long period_bytes = snd_pcm_lib_period_bytes(vss->substream); in virtsnd_pcm_msg_send()
208 unsigned int msg_count = vss->msg_count; in virtsnd_pcm_msg_send()
216 struct virtio_pcm_msg *msg = vss->msgs[i]; in virtsnd_pcm_msg_send()
230 msg->xfer.stream_id = cpu_to_le32(vss->sid); in virtsnd_pcm_msg_send()
233 if (vss->direction == SNDRV_PCM_STREAM_PLAYBACK) in virtsnd_pcm_msg_send()
243 vss->sid); in virtsnd_pcm_msg_send()
247 vss->msg_count++; in virtsnd_pcm_msg_send()
254 if (msg_count == vss->msg_count) in virtsnd_pcm_msg_send()
257 if (!(vss->features & (1U << VIRTIO_SND_PCM_F_MSG_POLLING))) in virtsnd_pcm_msg_send()
273 unsigned int virtsnd_pcm_msg_pending_num(struct virtio_pcm_substream *vss) in virtsnd_pcm_msg_pending_num() argument
278 spin_lock_irqsave(&vss->lock, flags); in virtsnd_pcm_msg_pending_num()
279 num = vss->msg_count; in virtsnd_pcm_msg_pending_num()
280 spin_unlock_irqrestore(&vss->lock, flags); in virtsnd_pcm_msg_pending_num()
304 struct virtio_pcm_substream *vss = msg->substream; in virtsnd_pcm_msg_complete() local
311 spin_lock(&vss->lock); in virtsnd_pcm_msg_complete()
316 if (vss->direction == SNDRV_PCM_STREAM_PLAYBACK || in virtsnd_pcm_msg_complete()
318 vss->hw_ptr += msg->length; in virtsnd_pcm_msg_complete()
320 vss->hw_ptr += written_bytes - sizeof(msg->status); in virtsnd_pcm_msg_complete()
322 if (vss->hw_ptr >= vss->buffer_bytes) in virtsnd_pcm_msg_complete()
323 vss->hw_ptr -= vss->buffer_bytes; in virtsnd_pcm_msg_complete()
327 vss->xfer_xrun = false; in virtsnd_pcm_msg_complete()
328 vss->msg_count--; in virtsnd_pcm_msg_complete()
330 if (vss->xfer_enabled) { in virtsnd_pcm_msg_complete()
331 struct snd_pcm_runtime *runtime = vss->substream->runtime; in virtsnd_pcm_msg_complete()
337 schedule_work(&vss->elapsed_period); in virtsnd_pcm_msg_complete()
338 } else if (!vss->msg_count) { in virtsnd_pcm_msg_complete()
339 wake_up_all(&vss->msg_empty); in virtsnd_pcm_msg_complete()
341 spin_unlock(&vss->lock); in virtsnd_pcm_msg_complete()
402 virtsnd_pcm_ctl_msg_alloc(struct virtio_pcm_substream *vss, in virtsnd_pcm_ctl_msg_alloc() argument
420 hdr->stream_id = cpu_to_le32(vss->sid); in virtsnd_pcm_ctl_msg_alloc()