On Wed, 2011-09-07 at 16:20 +0100, Dimitris Papastamos wrote:
On Fri, Sep 02, 2011 at 11:36:24AM +0530, Vinod Koul wrote:
This patch ads core.c, the file which implements the ioctls and registers the devices
Signed-off-by: Vinod Koul vinod.koul@linux.intel.com Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com
sound/compress_offload/core.c | 632 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 632 insertions(+), 0 deletions(-) create mode 100644 sound/compress_offload/core.c
diff --git a/sound/compress_offload/core.c b/sound/compress_offload/core.c new file mode 100644 index 0000000..1797dba --- /dev/null +++ b/sound/compress_offload/core.c @@ -0,0 +1,632 @@
+static int snd_compr_start(struct snd_compr_stream *stream) +{
- int retval;
- if (stream->runtime->state != SNDRV_PCM_STATE_PREPARED)
return -EPERM;
- retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_START);
- if (!retval)
stream->runtime->state = SNDRV_PCM_STATE_RUNNING;
- return retval;
+}
+static int snd_compr_stop(struct snd_compr_stream *stream) +{
- int retval;
- if (stream->runtime->state != SNDRV_PCM_STATE_PREPARED)
return -EPERM;
- retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_STOP);
- if (!retval) {
stream->runtime->state = SNDRV_PCM_STATE_SETUP;
wake_up(&stream->runtime->sleep);
- }
- return retval;
+}
+static int snd_compr_drain(struct snd_compr_stream *stream) +{
- int retval;
- if (stream->runtime->state != SNDRV_PCM_STATE_PREPARED ||
stream->runtime->state != SNDRV_PCM_STATE_PAUSED)
return -EPERM;
- retval = stream->ops->trigger(stream, SND_COMPR_TRIGGER_DRAIN);
- if (!retval) {
stream->runtime->state = SNDRV_PCM_STATE_SETUP;
wake_up(&stream->runtime->sleep);
- }
- return retval;
+}
How is it expected to have stream->runtime->state == SNDRV_PCM_STATE_PREPARED? This is not set anywhere in the core code. Do we need to just add another ioctl for _PREPARE?
Nope. My thoughts on this were that _TRIGGER_START should be called only when first data has been written, i.e when we are in _SETUP state. So write in _SETUP state should move this to _PREPARED, and obviously I have missed that part, Thanks will fix this