Merge tag 'omap-for-v4.6/fixes-rc2-v2-signed' of git://git.kernel.org/pub/scm/linux...
[linux-2.6-block.git] / sound / core / compress_offload.c
index 7fac3cae8abd0a232a3d7a1c2563999495df6ec2..a9933c07a6bf542e38b54ec8ed70204fbc429d55 100644 (file)
@@ -69,11 +69,14 @@ struct snd_compr_file {
 
 /*
  * a note on stream states used:
- * we use follwing states in the compressed core
+ * we use following states in the compressed core
  * SNDRV_PCM_STATE_OPEN: When stream has been opened.
  * SNDRV_PCM_STATE_SETUP: When stream has been initialized. This is done by
- *     calling SNDRV_COMPRESS_SET_PARAMS. running streams will come to this
+ *     calling SNDRV_COMPRESS_SET_PARAMS. Running streams will come to this
  *     state at stop by calling SNDRV_COMPRESS_STOP, or at end of drain.
+ * SNDRV_PCM_STATE_PREPARED: When a stream has been written to (for
+ *     playback only). User after setting up stream writes the data buffer
+ *     before starting the stream.
  * SNDRV_PCM_STATE_RUNNING: When stream has been started and is
  *     decoding/encoding and rendering/capturing data.
  * SNDRV_PCM_STATE_DRAINING: When stream is draining current data. This is done
@@ -286,6 +289,7 @@ static ssize_t snd_compr_write(struct file *f, const char __user *buf,
        mutex_lock(&stream->device->lock);
        /* write is allowed when stream is running or has been steup */
        if (stream->runtime->state != SNDRV_PCM_STATE_SETUP &&
+           stream->runtime->state != SNDRV_PCM_STATE_PREPARED &&
                        stream->runtime->state != SNDRV_PCM_STATE_RUNNING) {
                mutex_unlock(&stream->device->lock);
                return -EBADFD;
@@ -700,7 +704,7 @@ static int snd_compress_wait_for_drain(struct snd_compr_stream *stream)
 
        /*
         * We are called with lock held. So drop the lock while we wait for
-        * drain complete notfication from the driver
+        * drain complete notification from the driver
         *
         * It is expected that driver will notify the drain completion and then
         * stream will be moved to SETUP state, even if draining resulted in an
@@ -755,7 +759,7 @@ static int snd_compr_next_track(struct snd_compr_stream *stream)
        if (stream->runtime->state != SNDRV_PCM_STATE_RUNNING)
                return -EPERM;
 
-       /* you can signal next track isf this is intended to be a gapless stream
+       /* you can signal next track if this is intended to be a gapless stream
         * and current track metadata is set
         */
        if (stream->metadata_set == false)