Re: [virtio-dev] [PATCH v2] snd: Add virtio sound device specification

From
Liam Girdwood <>
Date
2019-11-19T15:14:19+00:00
ID
Thread
Re: [virtio-dev] [PATCH v2] snd: Add virtio sound device specification
On Thu, 2019-11-14 at 14:23 +0100, Anton Yakovlev wrote:
> > > > 
> > > > +\subsection{Device Operation}\label{sec:Device Types / Sound
> > > > Device / Device Operation}
> > > > +
> > > > +All control messages are placed into the controlq virtqueue
> > > > and
> > > > use the following
> > > > +layout structure and definitions:
> > > > +
> > > > +\begin{lstlisting}
> > > > +enum {
> > > > +    /* PCM control request types */
> > > > +    VIRTIO_SND_R_PCM_CHMAP_INFO = 0,
> > > > +    VIRTIO_SND_R_PCM_SET_FORMAT,
> > > > +    VIRTIO_SND_R_PCM_PREPARE,
> > > > +    VIRTIO_SND_R_PCM_START,
> > > > +    VIRTIO_SND_R_PCM_STOP,
> > > > +    VIRTIO_SND_R_PCM_PAUSE,
> > > > +    VIRTIO_SND_R_PCM_UNPAUSE,
> > 
> > Where do I tear down the PCM when I'm finished with it ? i.e. to
> > free
> > resources.
> 
> Current workflow:
> - a PCM stream is preparing with the set_format/prepare/start
> requests
> - if necessary, resources are freed/released with the stop request
> 
> If needed, the stream can be temporary paused (the pause/unpause
> requests).

Temp pause/unpause is fine, since we can keep audio power ON to avoid
audio atifacts and we resume from the same position. 

However, there are times when we need to stop audio for longer periods
and restart (where we do want to power down) or when we want to recover
a stream by stopping and then restarting it (without having to resend
all the params and realloc buffers etc).

I would recommend you have something like VIRTIO_SND_R_PCM_FREE to free
all resource and not overload STOP.

Liam